diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/soundsourcem4a/m4a/ip.h | 2 | ||||
-rw-r--r-- | plugins/soundsourcem4a/m4a/mp4-mixxx.cpp | 4 | ||||
-rw-r--r-- | plugins/soundsourcem4a/soundsourcem4a.cpp | 19 |
3 files changed, 14 insertions, 11 deletions
diff --git a/plugins/soundsourcem4a/m4a/ip.h b/plugins/soundsourcem4a/m4a/ip.h index c5fc97f5e6..b2a9c1e589 100644 --- a/plugins/soundsourcem4a/m4a/ip.h +++ b/plugins/soundsourcem4a/m4a/ip.h @@ -69,7 +69,7 @@ struct input_plugin_data { struct input_plugin_data { // filled by ip-layer // QString filename; - char *filename; + char *filenameUtf8; int fd; unsigned int remote : 1; diff --git a/plugins/soundsourcem4a/m4a/mp4-mixxx.cpp b/plugins/soundsourcem4a/m4a/mp4-mixxx.cpp index 0ab967af34..d094175097 100644 --- a/plugins/soundsourcem4a/m4a/mp4-mixxx.cpp +++ b/plugins/soundsourcem4a/m4a/mp4-mixxx.cpp @@ -170,9 +170,9 @@ static int mp4_open(struct input_plugin_data *ip_data) /* open mpeg-4 file, check for >= ver 1.9.1 */ #if MP4V2_PROJECT_version_hex <= 0x00010901 - priv->mp4.handle = MP4Read(ip_data->filename, 0); + priv->mp4.handle = MP4Read(ip_data->filenameUtf8, 0); #else - priv->mp4.handle = MP4Read(ip_data->filename); + priv->mp4.handle = MP4Read(ip_data->filenameUtf8); #endif if (!priv->mp4.handle) { qDebug() << "MP4Read failed"; diff --git a/plugins/soundsourcem4a/soundsourcem4a.cpp b/plugins/soundsourcem4a/soundsourcem4a.cpp index 46533f47ee..f252d9139c 100644 --- a/plugins/soundsourcem4a/soundsourcem4a.cpp +++ b/plugins/soundsourcem4a/soundsourcem4a.cpp @@ -48,10 +48,8 @@ SoundSourceM4A::SoundSourceM4A(QString qFileName) } SoundSourceM4A::~SoundSourceM4A() { - if (ipd.filename) { - delete [] ipd.filename; - ipd.filename = NULL; - } + delete [] ipd.filenameUtf8; + ipd.filenameUtf8 = NULL; if (mp4file != MP4_INVALID_FILE_HANDLE) { mp4_close(&ipd); @@ -73,11 +71,16 @@ Result SoundSourceM4A::open() int SoundSourceM4A::initializeDecoder() { // Copy QString to char[] buffer for mp4_open to read from later - const QByteArray qbaFileName(getFilename().toLocal8Bit()); + // From mp4v2/file.h: + // * On Windows, this should be a UTF-8 encoded string. + // * On other platforms, it should be an 8-bit encoding that is + // * appropriate for the platform, locale, file system, etc. + // * (prefer to use UTF-8 when possible). + const QByteArray qbaFileName(getFilename().toUtf8()); int bytes = qbaFileName.length() + 1; - ipd.filename = new char[bytes]; - strncpy(ipd.filename, qbaFileName.constData(), bytes); - ipd.filename[bytes-1] = '\0'; + ipd.filenameUtf8 = new char[bytes]; + strncpy(ipd.filenameUtf8, qbaFileName.constData(), bytes); + ipd.filenameUtf8[bytes-1] = '\0'; ipd.remote = false; // File is not an stream // The file was loading and failing erratically because // ipd.remote was an in an uninitialized state, it needed to be |