I'm trying to write a very simple video player using QT and Phonon, on Windows. My backend is phonon_ds94. First of all, here is the code when I click on "Play" :
if (!this->_files.empty()) {
QString file = this->_files.front();
this->_files.pop();
Phonon::MediaSource _src(file);
this->ui.videoPlayer->play(_src);
}
(Here, file is a std::queue of files to read)
If I want to play a .avi ou .wmv, everything works fine. My video play, it's perfect.
But when I want to play a .mp4 file, nothing happen. The videoPlayer stay black.
I've search on the web and see that there is a BackendCapabilities::availableMimeTypes, so I've try it to be sure that my backend is compatible with mp4 - it's in the list. Here is the list of available mime types:
application/vnd.ms-wpl application/x-mplayer2 application/x-ms-wmd application/x-ms-wmz audio/3gpp audio/3gpp2 audio/aiff audio/basic audio/mid audio/midi audio/mp3 audio/mp4 audio/mpeg audio/mpegurl audio/mpg audio/vnd.dlna.adts audio/wav audio/x-aiff audio/x-mid audio/x-midi audio/x-mp3 audio/x-mpeg audio/x-mpegurl audio/x-mpg audio/x-ms-wax audio/x-ms-wma audio/x-wav midi/mid unknown video/3gpp video/3gpp2 video/avi video/mp4 video/mpeg video/mpg video/msvideo video/quicktime video/vnd.dlna.mpeg-tts video/x-mpeg video/x-mpeg2a video/x-ms-asf video/x-ms-asf-plugin video/x-ms-wm video/x-ms-wmv video/x-ms-wmx video/x-ms-wvx video/x-msvideo vnd.ms.wmhtml
I've also connected the stateChanged
signal of the mediaObject
to a slot, and when I try to read my video, there is an error saying that file format is not supported.
How can I have Phonon to support it? Should I install a codec pack, even if mp4 is in my list?