Results 1 to 7 of 7

Thread: STB Video Playback

  1. #1
    Join Date
    Mar 2011
    Posts
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default STB Video Playback

    Environment
    1. We are using STB which uses dedicated hardware rendering video. It runs on top of Linux kernel 2.6.22

    2. Application is launched as standalone mode (-qws) option

    3. STB has primarily two planes Video Decoder plane and QT plane.


    Functionality to achieve
    We have to have a HTML page (rendered via QT Web View). On click of a button we need to play a video.


    Current Issue
    1. The Window (custom QWebView widget is used) is made transparent by setting the palette and overriding the paintEvent method.
    2. On click of the button (a JS extension is used to invoke our hardware video player). The video is played but we are not able to see it because the QDesktopWidget is blocking the view (we are able to see the blue screen of the desktop on the OSD).

    Help Needed
    The desktop widget should be made transparent along with the window (custom QWebView) so that the bottom video decoder plane is visible.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: STB Video Playback

    The desktop widget should be made transparent along with the window (custom QWebView) so that the bottom video decoder plane is visible.
    I don't think Qt can do this, because it has no knowledge of what is out side its scope (the desktop widget is the top most widget it knows about) so it can't render what ever is behind it.

    Why not hide the desktop widget instead for the duration of the video playing? or something along this line...
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Mar 2011
    Posts
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: STB Video Playback

    Thanks for the quick response.

    1. How can I hide and show the desktop without exiting QT
    2. Can I resize the Desktop widget to a smaller size so that I can simulate a menu as a popup in QT

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: STB Video Playback

    Heh... good questions :-)
    I don't know (maybe some more embedded oriented guys can help you more).
    But I would just try - try calling hide() and show() on the desktop widget and see if it does what you want. (please post back what the result was, it would be nice to know! )
    Same for second question - you can sure call resize() since it is a QWidget, but the rules for hiding, showing and resizing may differ for it, and be controller by qws.

    Another solution would be to access the video buffer directly and render it in a paintEvent() (if you can!), or similar, but I expect that to be not trivial.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Mar 2011
    Posts
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: STB Video Playback

    We have been trying to access the FrameBuffer pointer from the QDirectPainter object (http://doc.qt.nokia.com/4.7-snapshot...ml#frameBuffer) but no luck - it returns a Null Pointer. Tried getPrimaryScreen(), QScreen's base(), subScreen's base() - still no luck.

    We had some ray of light when we used QPixelMap and set it tranparent - will post the results after some more experiments.

    Thanks!

  6. #6
    Join Date
    Jul 2011
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: STB Video Playback

    I tried to achieve this using QLabel and re-implementing the resizeEvent:
    Qt Code:
    1. #include <QtGui>
    2.  
    3. class MaskedLabel : public QLabel
    4. {
    5. protected:
    6. void resizeEvent(QResizeEvent* event)
    7. {
    8. QLabel::resizeEvent(event);
    9.  
    10. QPixmap pixmap(size());
    11. pixmap.fill(Qt::transparent);
    12. QPainter::setRedirected(this, &pixmap);
    13. QPaintEvent pe(rect());
    14. paintEvent(&pe);
    15. QPainter::restoreRedirected(this);
    16. setMask(pixmap.mask());
    17. }
    18. };
    19.  
    20. int main(int argc, char* argv[])
    21. {
    22. QApplication a(argc, argv);
    23. QLabel* label = new MaskedLabel();
    24. label->setText("Qt Centre!");
    25. QFont font = label->font();
    26. font.setPointSize(72);
    27. label->setFont(font);
    28. label->show();
    29. return a.exec();
    30. }
    To copy to clipboard, switch view to plain text mode 

    We placed this MaskedLabel over the QWebView widget and tts showing us the video playing in the background but when I tried to resize the QLabel using setGeometry() method its not showing me video on full QLabel but to some parts.
    NOTE: when I just moved the QLabel (not changing width and height) using setGeometry(), I can still see the video in background. The video vanished only when I try to resize it.

    Why resizing remove the video and show transparent QLabel?
    Last edited by high_flyer; 19th July 2011 at 12:44. Reason: code tags

  7. #7
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: STB Video Playback

    Why resizing remove the video and show transparent QLabel?
    Because that is what your code is doing:
    1. you fill the pixmap to be transparent
    2. you then set this fully transparent pixmap as mask on the QLabel, so all the QLabel gets masked.
    There are no regions in your pixmap which are not transparent.

    The way you are misusing the resizeEvent() is not how things should be done in Qt, I am not even sure why it does work for you to the extent that it does, but I admit I didn't look deeper in to your code.
    This will only make more trouble ahead.
    Override paintEvent() for such operations.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. How to playback a IP cam?
    By rayner in forum General Programming
    Replies: 3
    Last Post: 6th December 2010, 22:52
  2. Playback video on QT Widget
    By Ratheendrans in forum Qt for Embedded and Mobile
    Replies: 7
    Last Post: 1st June 2010, 14:44
  3. 4.5 + video playback on windows
    By bunjee in forum Qt Programming
    Replies: 1
    Last Post: 24th March 2009, 10:58
  4. Video freezes during mpeg video playback using Phonon
    By davejames in forum Qt Programming
    Replies: 2
    Last Post: 12th January 2009, 09:45

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.