IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Media Player Example

Playing audio and video.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

Media Player Example▲

Image non disponible

Media Player demonstrates a simple multimedia player that can play audio and or video files using various codecs.

Running the Example▲

To run the example from http://, open the Welcome mode and select the example from Examples. For more information, visit http://.

The example uses a https:// object passed into a https:// to control the video output. To give the application playlist capability we also use a QPlayList object.

To activate the various functions such as play and stop on the dialog, the button clicked events emit the play() and stop() signals, which are connected to the play() and stop() slots of https://.

 
Sélectionnez
connect(controls, SIGNAL(play()), player, SLOT(play()));
connect(controls, SIGNAL(pause()), player, SLOT(pause()));
connect(controls, SIGNAL(stop()), player, SLOT(stop()));

We can get the volume (and set our user interface representation)

 
Sélectionnez
controls->setVolume(player->volume());

and we can make widget 'volume' changes change the volume

 
Sélectionnez
connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int)));

The example also allows us to change various video properties by means of the https:// object. We can go to Full Screen mode with a single button click, and back again. Or if we press the "Color Options" dialog button we can have access to more subtle influences. The dialog has a set of sliders so that we can change the brightness, contrast, hue and saturation of the video being watched. The connect() statements are in pairs so that changes to either the user interface widget (the relevant slider) or the https:// object will update the other object.

 
Sélectionnez
connect(brightnessSlider, SIGNAL(sliderMoved(int)), videoWidget,
    SLOT(setBrightness(int)));
connect(videoWidget, SIGNAL(brightnessChanged(int)),
    brightnessSlider, SLOT(setValue(int)));

connect(contrastSlider, SIGNAL(sliderMoved(int)), videoWidget,
    SLOT(setContrast(int)));
connect(videoWidget, SIGNAL(contrastChanged(int)), contrastSlider,
    SLOT(setValue(int)));

connect(hueSlider, SIGNAL(sliderMoved(int)), videoWidget,
    SLOT(setHue(int)));
connect(videoWidget, SIGNAL(hueChanged(int)), hueSlider,
    SLOT(setValue(int)));

connect(saturationSlider, SIGNAL(sliderMoved(int)), videoWidget,
    SLOT(setSaturation(int)));
connect(videoWidget, SIGNAL(saturationChanged(int)),
    saturationSlider, SLOT(setValue(int)));

List of Files▲

Files:

List of Files▲

  • multimediawidgets/player/histogramwidget.cpp

  • multimediawidgets/player/histogramwidget.h

  • multimediawidgets/player/main.cpp

  • multimediawidgets/player/player.cpp

  • multimediawidgets/player/player.h

  • multimediawidgets/player/player.pro

  • multimediawidgets/player/playercontrols.cpp

  • multimediawidgets/player/playercontrols.h

  • multimediawidgets/player/playlistmodel.cpp

  • multimediawidgets/player/playlistmodel.h

  • multimediawidgets/player/videowidget.cpp

  • multimediawidgets/player/videowidget.h

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+   

Ce document est disponible sous la licence https:// telle que publiée par la Free Software Foundation.