Results 1 to 4 of 4

Thread: QGraphicsEffect on a Phonon::VideoPlayer

  1. #1
    Join Date
    Jan 2011
    Posts
    2
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default QGraphicsEffect on a Phonon::VideoPlayer

    Hi

    I am trying to write my first Qt app. The point of the app is to try to demonstrate a video processing algorithm. I had a look around the documentation, and it seemed like I should apply a QGraphicsEffect to a Phonon::VideoPlayer, but I cannot get the graphicseffect to make any difference, with the video playing normally. To start with, my effect simply does nothing at all (empty function) - the idea being that the video will never be drawn. Maybe at this point I have already gone wrong in my approach to this, in which case please ignore the rest of the post .

    I tried altering my program so that the 'VideoPlayer' object is actually a QLabel with pixmap loaded into it. In this case, everything works as expected - no image is drawn, but if I add the single line: drawSource(painter); to my QGraphicsEffect's overloaded draw() function, the image is drawn correctly. This proves to me that my QGraphicsEffect and general program structure are both set up properly.

    Applying the effect to the parent window instead of the video widget makes no difference (except for the parent window being 'corrupt' as the whole window is never actually drawn; it seems to contain random garbage from some graphics memory somewhere). I also tried moving the setGraphicsEffect function to different points in the program (just after the videoPlayer is created, just after the media file is loaded), and this made no difference either.

    Any ideas or suggestions would be greatly appreciated.

    Here is the relevant section of the widget (derived from QWidget) containing the video. I haven't included my QGraphicsEffect, as it doesn't actually do anything at this point (bear in mind the app does appear to work if VIDEO is not defined):

    Qt Code:
    1. #ifdef VIDEO
    2. Phonon::VideoPlayer *videoPlayer = new Phonon::VideoPlayer(Phonon::VideoCategory, this);
    3. #else
    4. QPixmap *Pixmap = new QPixmap();
    5. Pixmap->load("/home/jeff/Examples/logos/logo-edubuntu.png");
    6. QLabel *videoPlayer = new QLabel();
    7. videoPlayer->setPixmap(*Pixmap);
    8. #endif //def VIDEO
    9.  
    10. grid->addWidget(videoPlayer, 1, 0, 3, 1);
    11.  
    12. cTestFilter *TestFilter = new cTestFilter(this, videoPlayer->size());
    13.  
    14. #ifdef VIDEO
    15. // load video file
    16. Phonon::MediaSource MediaFile("/home/jeff/Examples/Ubuntu_Free_Culture_Showcase/UbuntuIsHumanity.ogv");
    17. videoPlayer->load(MediaFile);
    18. videoPlayer->play(MediaFile);
    19. #endif //def VIDEO
    20.  
    21.  
    22. videoPlayer->setGraphicsEffect(TestFilter);
    23. //this->setGraphicsEffect(TestFilter);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QGraphicsEffect on a Phonon::VideoPlayer

    You can't apply any effects to Phonon. It's strictly for playing movies using whatever capabilities the backend offers. There is no way to modify particular frames of the movie. If you need that, use QtMultimedia framework.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    scary_jeff (19th January 2011)

  4. #3
    Join Date
    Jan 2011
    Posts
    2
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QGraphicsEffect on a Phonon::VideoPlayer

    Hi Wysota

    Thanks for the information. I'll try to find some examples of using this module.

    How would I have know that effects could not be applied to Phonon objects? I'm a bit confused that I can call setGraphicsEffect on an item that does not support graphics effects!

    Oh well, thanks.

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QGraphicsEffect on a Phonon::VideoPlayer

    The docs say:
    Phonon does not allow manipulation of media streams directly, i.e., one cannot alter a media stream's bytes programmatically after they have been given to a media object.
    The multimedia functionality is not implemented by Phonon itself, but by a back end - often also referred to as an engine. This includes connecting to, managing, and driving the underlying hardware or intermediate technology. For the programmer, this implies that the media nodes, e.g., media objects, processors, and sinks, are produced by the back end. Also, it is responsible for building the graph, i.e., connecting the nodes.
    We also hope in the future to be able to support direct manipulation of media streams. This will give the programmer more freedom to manipulate streams than just through processors.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Phonon::VideoPlayer
    By dano_labrosse in forum Newbie
    Replies: 6
    Last Post: 1st February 2012, 06:33
  2. How to set a background in a Phonon VideoPlayer ?
    By slimIT in forum Qt Programming
    Replies: 1
    Last Post: 24th October 2010, 21:54
  3. Phonon - videoPlayer Error
    By uGin in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2010, 10:09
  4. phonon VideoPlayer refresh
    By rbp in forum Qt Programming
    Replies: 6
    Last Post: 14th November 2008, 01:56
  5. phonon VideoPlayer seek
    By rbp in forum Qt Programming
    Replies: 4
    Last Post: 31st October 2008, 04:53

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.