Results 1 to 4 of 4

Thread: What Qt GUI Containers to use? Also Related Video Display issue - Windows 7

  1. #1
    Join Date
    Jun 2012
    Posts
    58
    Thanks
    13
    Qt products
    Qt4

    Default What Qt GUI Containers to use? Also Related Video Display issue - Windows 7

    I am trying to design an application to play multiple video (media) files and allow user modification capability on each one (eg, scaling, rotating, inverting etc of videos). I started by studying Phonon, but after going into it for a while read that it is no longer supported (or its support is doubtful) in >= Qt5. So then i went back and now i'm looking at qtmultimedia - QMediaPlayer. I'm stuck and confused on what widgets i must use. QMediaPlayer can show its output (video) on QVideoWidget, QGraphicsVideoItem and QAbstractVideoSurface. Since I need the capabilities of rotation etc, i believe i must incorporate QGraphicsScene/View.

    <1> So what should the approach be? I did this: used QVideoWidget -> added this to QGraphicsProxyWidget via its setWidget() (though setWidget() takes QWidget* and QVideoWidget is not derived from QWidget as i see in Qt Assistant -- why is this allowed btw?) -> Added this QGraphicProxyWidget to QGraphicsScene via addItem() -> added this QGraphicsScene to QGraphicsView while constructing it -> added QGraphicsView to QMainWindow via setCentralWidget(). Is this fine? When to use QGraphicsVideoItem and QAbstractVideoSurface?

    <2> When adding multiple QVideoWidget in the following manner i don't see any video or the QVideoWidget itself (i've painted to distinguish it). What am i doing wrong? (there is audio output though):

    Qt Code:
    1. QVideoWidget *pVideoWidget1 = new QVideoWidget(0);
    2. pVideoWidget1->setPalette(QPalette(QColor(255,0,0),QColor(0,255,0)));
    3. QVideoWidget *pVideoWidget2 = new QVideoWidget(0);
    4. pVideoWidget2->setPalette(QPalette(QColor(255,0,0),QColor(0,0,255)));
    5.  
    6. m_pMediaPlayer1 = new QMediaPlayer(this);
    7. m_pMediaPlayer2 = new QMediaPlayer(this);
    8. m_pMediaPlayer1->setVideoOutput(pVideoWidget1);
    9. m_pMediaPlayer2->setVideoOutput(pVideoWidget2);
    10.  
    11. m_pCustomGraphicsProxy1 = new CustomGraphicsProxy(0); //this is just a class derived from QGraphicsProxyWidget to implement drag and drop of videos
    12. m_pCustomGraphicsProxy2 = new CustomGraphicsProxy(0);
    13. m_pCustomGraphicsProxy1->setWidget(pVideoWidget1);
    14. m_pCustomGraphicsProxy2->setWidget(pVideoWidget2);
    15.  
    16. QGraphicsScene *pGraphicsScene = new QGraphicsScene(this);
    17. QGraphicsLinearLayout *pGraphicsLinearLayout = new QGraphicsLinearLayout;
    18.  
    19. CustomGraphicsProxy* button = new CustomGraphicsProxy(0);
    20. button->setWidget(new QPushButton); //this i can see
    21. CustomGraphicsProxy* button1 = new CustomGraphicsProxy(0);
    22. button1->setWidget(new QPushButton); //this i can see too
    23.  
    24. pGraphicsLinearLayout->addItem(button);
    25. pGraphicsLinearLayout->addItem(m_pCustomGraphicsProxy1); //can't see
    26. pGraphicsLinearLayout->addItem(m_pCustomGraphicsProxy2); //can't see
    27. pGraphicsLinearLayout->addItem(button1);
    28.  
    29.  
    30. CustomGraphicsProxy *temp = new CustomGraphicsProxy(0);
    31. temp->setLayout(pGraphicsLinearLayout);
    32. pGraphicsScene->addItem(temp);
    33. temp->show();
    34.  
    35. m_pGraphicsView = new QGraphicsView(pGraphicsScene, this);
    36.  
    37. setCentralWidget(m_pGraphicsView);
    38.  
    39. QObject::connect(m_pCustomGraphicsProxy1, SIGNAL(sigNewFileDragDropped()), this, SLOT(sloPlayOnWindow1()));
    40. QObject::connect(m_pCustomGraphicsProxy2, SIGNAL(sigNewFileDragDropped()), this, SLOT(sloPlayOnWindow2()));
    41.  
    42. //just for testing - this gives only audio no video can be seen
    43. m_pMediaPlayer1->setMedia(QUrl::fromLocalFile("d:/z.avi"));
    44. m_pMediaPlayer1->play();
    To copy to clipboard, switch view to plain text mode 

    <3> Before i study this further, am i choosing the right tools in Qt to manipulate videos as i mentioned before or something else needs to be done?

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

    Default Re: What Qt GUI Containers to use? Also Related Video Display issue - Windows 7

    If you want to use GraphicsView then the only viable option I see is to use QGraphicsVideoItem. However if you want to use Qt5, I suggest you take a look at what QML/QtQuick has to offer.
    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. #3
    Join Date
    Jun 2012
    Posts
    58
    Thanks
    13
    Qt products
    Qt4

    Default Re: What Qt GUI Containers to use? Also Related Video Display issue - Windows 7

    thank you. I'll look into QtQuick (frankly, i do not know what that is). In the mean time could you tell me if QtMultimedia is as powerful as Phonon (though i could not go much deeper into phonon too because of the reasons i mentioned)? i mean if manipulations of audio, video (alpha blending of frames from two videos etc) etc are required? Also you said
    If you want to use GraphicsView..
    what else would you suggest if i want the capabilities of individual video rotating, scaling etc.

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

    Default Re: What Qt GUI Containers to use? Also Related Video Display issue - Windows 7

    Quote Originally Posted by ustulation View Post
    I'll look into QtQuick (frankly, i do not know what that is).
    Do that as soon as possible.

    In the mean time could you tell me if QtMultimedia is as powerful as Phonon
    Yes. However it operates on a lower level than Phonon.
    i mean if manipulations of audio, video (alpha blending of frames from two videos etc) etc are required?
    Nothing is required. You can just tell it to play and it will play. If you want to do some advanced stuff, QtMultimediaKit (Qt4) and QtMultimedia (Qt5) will allow you to access individual frames. You can also do a lot of things easily in QtQuick2.

    Also you said what else would you suggest if i want the capabilities of individual video rotating, scaling etc.
    Scaling and rotating is easy.
    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. qt 4.8 demo browser related issue
    By abhinav.phukan in forum Newbie
    Replies: 0
    Last Post: 20th December 2011, 06:45
  2. how to display video at a certain time?
    By cic in forum Qt Programming
    Replies: 1
    Last Post: 17th November 2011, 12:01
  3. Replies: 2
    Last Post: 8th November 2011, 13:30
  4. Video play issue
    By baluk in forum Newbie
    Replies: 3
    Last Post: 4th December 2010, 13:43
  5. In which component can I display video?
    By punkypogo in forum Qt Programming
    Replies: 4
    Last Post: 16th July 2010, 16:40

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
  •  
Qt is a trademark of The Qt Company.