Switch QMultiMedia backend without recompiling whole Qt
-
To expand my question I'd like to add that the reason I just want to compile QMultiMedia is that building the whole Qt library fails. Here are the steps I did:
- Download the Qt sources into the directory
C:/Qt/5.10.1/Src
. - Install ActivePerl.
- Python 3 is already installed (or does it have to be Python 2?).
- Add
qtbase/bin
andgnuwin32/bin
to path. - Open CMD with admin privileges and call
vsdevcmd.bat
to setup Visual Studio environment. - Configure with
configure -platform win32-msvc -debug-and-release -mediaplayer-backend wmf
- Let it run, it performs checks and every seems to be ok.
- Call
jom
to build. - Now
qmake.exe
crashes for some reason and it end with the following error:
jom: C:\Qt\5.10.1\Src\qtbase\src\Makefile [sub-corelib-make_first] Error 2
jom: C:\Qt\5.10.1\Src\qtbase\Makefile [sub-src-make_first] Error 2
jom: C:\Qt\5.10.1\Src\Makefile [module-qtbase-make_first] Error 2@jsmolka said in Switch QMultiMedia backend without recompiling whole Qt:
Python 3 is already installed (or does it have to be Python 2?).
The docs are a bit unclear here, but they recommend Python 2.7 for Windows. May be worth a try.
I have done some developer builds on Windows (with Python 2.7.14) and encountered all kinds of problems, but never saw a crashing qmake.
Regards
- Download the Qt sources into the directory
-
Hi,
IIRC, the MSVC edition comes with both backends. What you can do is temporarily move the DirectX backend in another folder to see if that does what you want.
Otherwise, you don't need to build all of Qt, just the qtmultmedia module.
-
Hi,
IIRC, the MSVC edition comes with both backends. What you can do is temporarily move the DirectX backend in another folder to see if that does what you want.
Otherwise, you don't need to build all of Qt, just the qtmultmedia module.
@SGaist I have read something simular and compared to the MinGW version the MSVC version comes with precompiled binaries in the form of
wmfengine.dll
underplugins/mediaservice
. But if I remove thedsengine.dll
files I get the following console output when starting my application:defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
.Am I removing the wrong files?
Apart from that I have successfully compiled the previous Qt version (5.10.0) with the
-mediaplayer-backend wmf
option. This does not seem to have any effect though because I am still getting DirectShow errors for mp3s with large cover files. -
No, you removed the correct file, however that confirms that the WMF plugin wasn't built with media player capabilities.
Then do the same you just did with your 5.10.0 custom version to see if it behaves better.
-
No, you removed the correct file, however that confirms that the WMF plugin wasn't built with media player capabilities.
Then do the same you just did with your 5.10.0 custom version to see if it behaves better.
@SGaist My custom version behaves completely odd. I can literally remove the whole
plugins/mediaservice
folder and my application is still running and throwing DirectShow errors. I double checked the path for the DLLs and it definitely uses my compiled version.I probably made some mistake somewhere along the line but I can't figure out where. I'd really like to use QMultiMedia but the DirectShow backend is destroying it for me. If you have any suggestion for a different configuration and something else I would really appreciate it.
-
Then some maybe silly questions:
- Did you deploy the plugins along your application ?
- Are you sure that you are using the right kit ?
- In the Kit, are you sure you are using your custom version of Qt ?
-
Then some maybe silly questions:
- Did you deploy the plugins along your application ?
- Are you sure that you are using the right kit ?
- In the Kit, are you sure you are using your custom version of Qt ?
-
Just download the QtMM sources and compile/install it. And then just remove the 'ds' backend if you do not need in (and keep only the 'wmf' backend).
-
Just download the QtMM sources and compile/install it. And then just remove the 'ds' backend if you do not need in (and keep only the 'wmf' backend).
@SGaist I have read something simular and compared to the MinGW version the MSVC version comes with precompiled binaries in the form of wmfengine.dll under plugins/mediaservice. But if I remove the dsengine.dll files I get the following console output when starting my application: defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer".
Isn't this what you mean?
-
Yes, that.
It is strange that this error:
no service found for - "org.qt-project.qt.mediaplayer"
occurred.
As I can see from QtMM sources:
MFPlayerService::MFPlayerService(QObject *parent) : QMediaService(parent) , m_session(0) , m_videoWindowControl(0) , m_videoRendererControl(0) { m_audioEndpointControl = new MFAudioEndpointControl(this); m_session = new MFPlayerSession(this); m_player = new MFPlayerControl(m_session); m_metaDataControl = new MFMetaDataControl(this); } QMediaControl* MFPlayerService::requestControl(const char *name) { if (qstrcmp(name, QMediaPlayerControl_iid) == 0) { return m_player;
}
And the wmf.json contains:
{ "Keys": ["windowsmediafoundation"], "Services": ["org.qt-project.qt.mediaplayer", "org.qt-project.qt.audiodecode"] }
so, all should be fine.
-
Yes, that.
It is strange that this error:
no service found for - "org.qt-project.qt.mediaplayer"
occurred.
As I can see from QtMM sources:
MFPlayerService::MFPlayerService(QObject *parent) : QMediaService(parent) , m_session(0) , m_videoWindowControl(0) , m_videoRendererControl(0) { m_audioEndpointControl = new MFAudioEndpointControl(this); m_session = new MFPlayerSession(this); m_player = new MFPlayerControl(m_session); m_metaDataControl = new MFMetaDataControl(this); } QMediaControl* MFPlayerService::requestControl(const char *name) { if (qstrcmp(name, QMediaPlayerControl_iid) == 0) { return m_player;
}
And the wmf.json contains:
{ "Keys": ["windowsmediafoundation"], "Services": ["org.qt-project.qt.mediaplayer", "org.qt-project.qt.audiodecode"] }
so, all should be fine.
However, the service(org.qt-project.qt.mediaplayer) is missing in Qt5.9.* / Qt5.10.* dll. Please check with the following command and let us know the results.
like this:
QtPluginInfo.exe wnfengine.dll
The solution I know must fix the Qt5.10 source. But this is not the official way. I guess it is a bug. The Qt5.7 version has no problem.
-
Yes, you can try to report it as a bug.
-
So after some time I got it to work. The solution is just using
-mediaplayer-backend wmf
as an configure option and then compiling Qt. The reason why I got no error for removing the all files within the plugin folder was that Qt Creator was still using the precompiled binaries even though there was no path set to them. In the end @SGaist was right and asked the right question regarding using the wrong kit.The only thing that still confuses me is qmake crashing while compiling Qt 5.10.1. If I try to compile Qt 5.10.0 everything works just fine. Here are the step I did for compiling (if anybody stumbles across the same problem):
- Download the lastest Qt sources
- Install jom, Python and Perl
- Open cmd and setup your VS environment (with vcvars32.bat, vcvars64 or vsdevenv.bat)
- Configure Qt using
configure -debug-and-release -platform win32-msvc -nomake examples -opensource -prefix <insert your install dir> -mediaplayer-backend wmf
- Run
jom
and laterjom install
Using the WMF backend seems to be much better for playing mp3s because DirectShow is unable to play files with covers above 100kb and gets the song duration wrong by around 2sec everytime (but it also plays those extra seconds and seems to "expand" the mp3).
Thank you guys.