diff --git a/src/player/mpvadapter.cpp b/src/player/mpvadapter.cpp index a9ef130..78deb51 100644 --- a/src/player/mpvadapter.cpp +++ b/src/player/mpvadapter.cpp @@ -591,12 +591,18 @@ void MpvAdapter::open(const QString &file, QByteArray filename = file.toUtf8(); QByteArray opts = options.join(',').toUtf8(); + char *argOpts = opts.isEmpty() ? NULL : opts.data(); - const char *args[5] = { + /* Since mpv client API 2.3 (mpv 0.38.0) "loadfile" places an extra argument before the options, + so we need to conditionally re-arrange the arguments array */ + bool isApi23 = mpv_client_api_version() >= MPV_MAKE_VERSION(2, 3); + + const char *args[] = { "loadfile", filename, append ? "append-play" : "replace", - opts.isEmpty() ? NULL : opts.data(), + isApi23 ? "0" : argOpts, + isApi23 ? argOpts : NULL, NULL }; @@ -918,11 +924,15 @@ QString MpvAdapter::tempAudioClip( optionCmd += QString("start=%1").arg(start, 0, 'f', 3).toUtf8(); optionCmd += QString(",end=%1").arg(end, 0, 'f', 3).toUtf8(); optionCmd += QString(",aid=%1").arg(aid).toUtf8(); + char *argOpts = optionCmd.isEmpty() ? NULL : optionCmd.data(); + + bool isApi23 = mpv_client_api_version() >= MPV_MAKE_VERSION(2, 3); const char *args[] = { "loadfile", input, "replace", - optionCmd.isEmpty() ? NULL : optionCmd.data(), + isApi23 ? "0" : argOpts, + isApi23 ? argOpts : NULL, NULL };