Phonon mingw Compilation Guide

Source: Internet
Author: User

How to compile phonon with mingw

I can find some articles about mingw + phonon on the internet, almost speaking of mingw. However, from the analysis above, we can know that phonon is only an interface and there is no platform relevance at all. Even the QT document simply says:

Warning: The mingw version of QT does not support building the QT backend.

That is to say, mingw can compile phonon! Only backend plug-ins cannot be compiled. The reason is probably because the compatibility between DirectX SDK and mingw is not very good. There is another solution to the backend problem!

Therefore, it is very easy to compile phonon with mingw. You can add the phonon Option When configuring configure in QT. It is best to remove the option for compiling phonon-backend, if this parameter is added, it will only cause trouble for subsequent compilation. You can use configure -- help to query specific parameters.

After configure is complete, if you only modify the phonon library, you do not have to compile other parts of QT one by one. You only need to go to src/phonon/and compile phonon. In this process, no problem occurs. After compilation, you will get the phonon library file in lib/(dynamic library by default)

Now, your phonon program can be compiled. You can compile mediaplayer and musicplayer in QT demo, both of which can produce and execute executable files. HoweverPhonon backend plugin cocould not be loaded. This is the absence of backend plug-ins. At this time, the program cannot do anything except display the interface.

Next, we need to find a backend that can control audio/video decoding and playback, and write a plug-in so that phonon can call this backend. Basically, this is quite troublesome. Fortunately, some people have already done all the annoying things for us.

Phonon-VLC-mplayerIs a phonon backend project using VLC or mplayer. It provides the back-end plug-in source code of VLC/mplayer. The released version only supports mplayer, because someone has written the version that supports VLC, And the link can be found above. Details can be found on the project homepage.

However, this project cannot be used directly, because it uses a phonon library with a newer version than QT, which does not match the built-in QT library. Either replace qt's phonon library with the latest version, or change the plug-in. In fact, subtitles and channels are switched to the latest version. To ensure maximum compatibility, let's change the plug-in.

Here the improved plug-in source code: phonon-mplayer.zip

I have changed project management to qmake. First, compile the libmplayer sub-directory and compile the mplaye control end into a static library.

Qmake

Make

Libmplayer. A generated in the release folder is a static library. Copy the file to the libmplayer subdirectory.

Then go back to the phonon-mplayer directory to compile the plug-in.

Copy the compiled plug-in (DLL file) to the plugins/phonon_backend In the QT main directory. Then you can find phonon in your program.

However, you still cannot use it because you have not used it as the backend mplayer.

Find a useful mplayerfile and copy mplayer.exe and related files to the main directory of the Program/mplayer/. Then, your plug-in can call mplayer. Now, your program can play audio and video normally.

Other considerations:

  1. Capabilities in the routine I have been unable to compile, and every time it is a GCC outbound error, this is a problem with mingw. You can change the mingw version to 4.0 +.
  2. Mplayer does not provide sound effects
  3. The QT plug-in mechanism is very strict. The Library version and compiler version will be checked during loading, but different versions will not be loaded. Therefore, if you replace the compiler, it may be a small version change, your program may also appearPhonon backend plugin cocould not be loaded. Ensure that your phonon library, your program, and your backend plug-ins are compiled by the same compiler. Otherwise, unknown errors may occur.
  4. Phonon-mplayer Will Generate debug and release2 versions after compilation. As mentioned above, the plugin check mechanism is very strict, so these two versions correspond to the compilation form of your own program respectively. Fortunately, the phonon plug-in check does not follow the file name, so you copy the two DLL files to the plug-in directory without duplicate names, and the program will automatically identify the corresponding plug-in.
  5. When releasing a program, place the plug-in under the main directory/phonon_backend/of the program. Note that you only need to release the release version. If you have not been able to release the debug version

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.