Results 1 to 3 of 3

Thread: Phonon in QGraphicsScene - no video, Linux/X11.

  1. #1
    Join Date
    Oct 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Phonon in QGraphicsScene - no video, Linux/X11.

    Hello

    I would like to place widgets with transparent backgrounds on top of Phonon VideoPlayer in my application.
    I think the perfect solution for me is to use QGraphicsScene and embed a VideoPlayer widget into it. Unfortunately doing so doesn't show any video. The window is whole white, I can only hear the sound of the playback.

    Here is my code:
    Qt Code:
    1. #include <QtGui>
    2. #include <Phonon/VideoPlayer>
    3.  
    4. int main(int argc, char **argv)
    5. {
    6. QApplication app(argc, argv);
    7.  
    8. Phonon::VideoPlayer player;
    9. player.play(QString("//home/kamil/snowball.mp4"));
    10. player.setMinimumSize(300, 200);
    11.  
    12. scene->addWidget(&player);
    13.  
    14. QGraphicsView view(scene);
    15. player.show();
    16. view.show();
    17. view.setWindowTitle(QLatin1String("Graphicsview embedded phonon"));
    18. view.setGeometry(50, 50, 600, 400);
    19.  
    20. return app.exec();
    21. }
    To copy to clipboard, switch view to plain text mode 
    Adding "view.setViewport(new QGLWidget);" to the code doesn't make any difference. When I comment line 13 //scene->addWidget(&player); VideoPlayer shows as separate window and everything works just fine, there is audio and video. Media Player example, from qtdemo, works fine as well. Judging by that, I think the problem may be some system settings/xorg settings/graphics driver or even video card.

    My video card is Mobilny Radeon HD 5165, but seen by the system as "Mobility Radeon HD 4650". I've tried diffrent software configurations: Gnome with free drivers, Kubuntu 2.6.32-25 with free/ati drivers, Qt 4.6.2/4.7.0 - none works. On ati drivers (OpenGL v. 3.2.9756) I've even managed to run all OpenGL examples from qtdemo. I also tried to run my code on Intel GM965/GL960, Linux-2.6.36, xorg-server-1.9.1, xf86-video-intel-2.13.0, mesa-7.8.2, qt-4.6.3, no result. The only configuration that worked fine was Kubuntu on VirtualBox on NVidia, but the performance was poor, and colors of video playback were some kind of broken.

    Are you aware of any specyfic requirements, that system must meet in order to render video via QGraphicsScene properly? Can you tell what might be the problem in my case? I can provide any additional info about my configuration if this can help tracing the problem.

    And finally, can you enumerate some Linux configurations (excluding virtual machines), that you tested, or that are known to work fine with phonon embedded into QGraphicsScene?

    Best regards,
    Kamil

  2. #2
    Join Date
    Jul 2011
    Posts
    2
    Qt products
    Qt3 Qt4

    Post Re: Phonon in QGraphicsScene - no video, Linux/X11.

    Hi, dont know if its a really late answer but here it goes.....

    QGraphicsView *view = new QGraphicsView(this);

    Phonon::MediaSource source(QFileDialog::getOpenFileName(this,"VIDEOS", "C:\\","Videos (*.wmv *.mpg *.mp4)"));
    Phonon::MediaObject *mediaObject = new Phonon::MediaObject(this);

    mediaObject->setCurrentSource(source);

    Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::VideoCategory, this);
    Phonon::VideoWidget *videoWidget = new Phonon::VideoWidget(view);
    Phonon::createPath(mediaObject, audioOutput);
    Phonon::createPath(mediaObject, videoWidget);

    QGraphicsScene *scene = new QGraphicsScene;
    view->setScene(scene);
    QGraphicsProxyWidget *pVdoWidget = scene->addWidget(videoWidget);
    mediaObject->play();


    hope it works for you, and if you already know a better way for using phonon inside qgraphicsview, plzzz post it.
    cya

  3. #3
    Join Date
    Oct 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Post Re: Phonon in QGraphicsScene - no video, Linux/X11.

    After a week of trying it turned out, that this works only on nvidia cards (no matter if on vm, or not). I still have completely no idea why. This only confirmed my belief, that it was some kind of "system settings/xorg settings/graphics driver or even video card" issue. I think it might have been fixed by now with some system package upgrade, but I can't confirm this.

    Broken colors on nvidia was a result of a bug in phonon-gstreamer backend. The patch is somewhere around.

    I didn't run your code, but I don't think it would work at the time I was struggling with the problem.

    What I finally did was to use QGLWidget as a parent of QGraphicsView and draw everything with openGl instructions. I hacked phonon-gstreamer backend and Qt's source to get frame data instead of letting phonon draw the frame itself. This resulted in noticable cpu usage drop when playing heavy videos.

    This works, but to be honest with you, still sucks. I need a hardware acceleration. I need it bad. And get rid of phonon by the way.

Similar Threads

  1. Phonon video streaming
    By frknml in forum Qt Tools
    Replies: 1
    Last Post: 3rd November 2010, 06:24
  2. Playing video using Phonon video widget
    By Leolander in forum Newbie
    Replies: 0
    Last Post: 26th February 2010, 06:15
  3. Replies: 3
    Last Post: 5th July 2009, 17:22
  4. Video freezes during mpeg video playback using Phonon
    By davejames in forum Qt Programming
    Replies: 2
    Last Post: 12th January 2009, 08:45
  5. Phonon video not playing
    By SidGBF in forum Qt Programming
    Replies: 2
    Last Post: 11th July 2008, 15:30

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.