Depuis la version 4.4, Qt permet d'introduire de la vidéo dans ses interfaces par le biais du framework multimédia Phonon. Phonon permet simplement de créer des applications telles que des lecteurs audio, vidéo...
Nous allons ainsi apprendre à utiliser Phonon sous Windows.
Phonon est le nom du framework multimédia de KDE4. C'est également un module de Qt qui a été introduit dans la version 4.4 afin de pouvoir utiliser de la vidéo dans ses applications.
Phonon est ainsi capable de lire à peu près tous les formats, puisqu'il utilise DirectX pour afficher la vidéo. Ce sont donc les codecs installés sur votre PC qui permettent d'améliorer la compatibilité de Phonon.
Cependant Phonon n'est pas directement utilisable sous Windows, car celui-ci ne permet pas d'être compilé sous Windows avec mingw. (Pas de problème pour Linux)
Mais comment faire alors ?
Jusqu'à présent, il n'existe pas de méthode officielle directement venue des développeurs de Nokia.
Mais des petits malins (que je remercie au passage) ont réussis à utiliser Phonon sous Windows.
Afin de pouvoir utiliser Phonon sous Windows nous allons devoir compiler Phonon de manière à ce qu'il supporte Qt avec mingw.
Une fois réceptionné, dé-zippez-le sur votre bureau par exemple.
Rendez-vous dans le dossier "phonon4qtmingw" puis lancez le fichier "install.cmd".
Voila la fenêtre CMD qui apparaît :
this package will build for you a phonon support qt with mingw automatically
you must have the complete Qt SDK installed for this to work
it works on the qt sdk which has its own mingw installed too
it is tested on the "qt-sdk-win-opensource-2009.03"
and in a Windows XP SP2 environment with a Pentium III 800MHz CPU (32 bit)
now preparation is done and you can close this window (but read below before)
next, for starting the real operation, open your qt command prompt
type the "phonon4qt" there, press ENTER and follow the instructions
phonon4qt program will build qt in release mode only,
so build your applications using the "mingw32-make release" command line
don't remove this package from this place until compilation is completed
please tell me about your automatic builds with this package
say about your Qt verion, OS type and version, results, problems etc.
especially don't forget to test the phonon video and tell me about the result
since I have problem with phonon video on my own system
but on other systems the phonon video works perfectly
send information for me at: hamidreza_mz -=@=- yahoo -=dot=- com
Vous pouvez la fermer.
Ouvrez ensuite "Qt Command Prompt". Écrivez : phonon4qt
Setting up a MinGW/Qt only environment...
-- QTDIR set to C:\Qt\2009.03\qt
-- PATH set to C:\Qt\2009.03\qt\bin
-- Adding C:\Qt\2009.03\bin to PATH
-- Adding C:\WINDOWS\System32 to PATH
-- QMAKESPEC set to win32-g++
C:\Qt\2009.03\qt>phonon4qt
Appuyez sur "Entrée".
Une première question apparaît :
this will build qt (mingw version) with phonon support
overal operation typically takes hours (e.g. 5 hours on a 800MHz CPU)
do you want to automatically shutdown your system after completion of the build
proccess?
(y/n): n
Si vous désirez que l'ordinateur s'éteigne automatiquement à la fin de la compilation, écrivez "y" pour yes puis validez par la touche "Entrée". Sinon faites de même avec "n" pour non.
Une deuxième question apparaît :
do you want all messages printed by the build tools
to be redirected to the log file instead of displaying on the console?
(y/n): y
Répondez "y" afin de garder une trace de la compilation, puis validez par "Entrée".
La compilation débute ...
getting user options is done
now the rest of operations for building qt are automatic (no user intervention)
configure and mingw32-make commands will be run consecutively
with command line options needed for building qt's phonon with mingw
note that this program doesn't try to manage or
even recognize any errors in the build process
but if you have the prerequisites there should be no problems
please report the result of your build to me if you can
email me at: hamidreza_mz -=at=- yahoo -=dot=- com
building takes a long time
you can leave your machine alone if you want, after pressing one more any key!
press any key to begin the rest of operations that are fully automatic...
====================================================================
current directory: C:\Qt\2009.03\mingw\include
====================================================================
step 1: adding new files to and patching some mingw's header files...
patching file amvideo.h
patching file bdatypes.h
patching file control.h
patching file dshow.h
patching file strmif.h
patching file vmr9.h
====================================================================
step 2: setting Microsoft DirectX SDK 2008 paths...
Dx x86 target enviroment is now enabled.
lib=C:\Users\Goooo\Desktop\phonon4qtmingw\phonon4qtmingw\dxsdklib2008\Lib\x86;
include=C:\Users\Goooo\Desktop\phonon4qtmingw\phonon4qtmingw\dxsdklib2008\Includ
e;
====================================================================
current directory: C:\Qt\2009.03\qt\bin
====================================================================
step 3: backing up old QtCore4.dll and QtNetwork4.dll files...
they are copied under their original names with .old appended
1 fichier(s) copié(s).
1 fichier(s) copié(s).
====================================================================
current directory: C:\Qt\2009.03\qt
====================================================================
step 4: executing configure...
this typically takes many minutes.
messages are redirected to the log file
...
Une fois fini, voici le message qui apparaît :
building phonon support qt is finished
log file is stored in "C:\Qt\2009.03\qt\phonon4qt.log"
C'est bon Phonon est compilé et prêt à être utilisé :) .
Lors de la compilation de Phonon, les DLLs de Qt sont également modifiées.
Cela implique qu'il faut absolument remplacer vos anciennes DLLs que vous avez placer dans le system32 ou directement dans le dossier de l'.exe par les nouvelles.
Les nouvelles DLLs se trouvent dans le dossier "C:\Qt\2009.03\qt\bin".
En réalité seulement deux DLLs ont été modifiées, à savoir :
- QtCore4.dll - QtNetwork4
Il faut donc les chercher dans le dossier "C:\Qt\2009.03\qt\bin", puis remplacer vos anciennes DLLs par celle-ci.