Ubuntu video playback

Source: Internet
Author: User
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.

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.