I didn't find the UbuntuLinux video screen api, so call the phonon class in QT to achieve video screen playback, first set up the environment: sudoapt-getinstallqt4-dev-toolsqt4-designerqt4-docqt4-qtconfigqt4-demosqt4-qmakelibqt4-sql-mysqlqdevelopsudoapt-getinstallqtcreato
I didn't find the Ubuntu Linux video screen api, so I called the phonon class in QT to implement video screen playback. First, I set up the environment:
Sudo apt-get install qt4-dev-tools qt4-designer qt4-doc qt4-qtconfig qt4-demos qt4-qmake qdevelop
Sudo apt-get install qtcreator
Sudo apt-get install libphonon-dev libphonon4 phonon-backend-gstreamer
Once the environment is set up, create a project and test a small example.
The path for storing my video files is/home/leaf/1.mpg.
# Include
# Include
# Include
Int main (int argc, char * argv [])
{
QApplication app (argc, argv );
App. setApplicationName ("VideoPlayer ");
QWidget * widget = new QWidget;
Widget-> resize (600,400 );
Phonon: VideoPlayer * player = new Phonon: VideoPlayer (Phonon: VideoCategory, widget );
Player-> load (Phonon: MediaSource ("/home/leaf/1.mpg "));
Player-> play ();
Widget-> show ();
Return app.exe c ();
}
Add QT + = phonon to the. pro file during final compilation.