m1lhaus
m1lhaus

Reputation: 879

Qt - Overlay QGraphicsView over vlc video

I have some troubles to implement VLC player to my project. I need overlay video with QgraphicsView (basicaly canvas) so I be able to draw things. I've tried to do it this way:

  1. Point winId pointer to QgraphicsView. Video renders just fine, but it renders on top of the object, so my graphics items are under video layer. => fail
  2. Create new QGraphics object as child of my main QGraphics object and then render video to this child. Result is the same as above. => fail
  3. Overlay QWidget with rendered video with my QGraphicsView (same pos and size). I've set transparent background so I can see overlayed widgets but video under this layer just won't render. I stays white but I can hear its playing. => fail

I've read on this forum, that somebody extracts every frame, and sets it as pixmap to an object. I saw the code, but furtunatelly, I don't get it, because I not C++ professional :( I am using Python bindings for Qt (PySide) and for VLC. Please help, it really bothers me :(

http://forum.videolan.org/viewtopic.php?f=32&t=68816&p=228645

Upvotes: 1

Views: 2589

Answers (2)

chocolossus
chocolossus

Reputation: 1

i know this question was a while back but i just ran across this while trying to figure it out today and figure i'd put up my solution.

pretty much your 3rd attempt was correct but you have to also make the QGraphicsView you're using transparent because that's the white you're seeing. you just have to make sure the view tracks with your window manually with setGeometry and you're set.

#assuming you're inside a main window that is self
scene = QGraphicsScene()
scene.setBackgroundBrush(QBrush(QColor(255, 0,0,90))) #creates a semitransparent red over VLC

view = QGraphicsView(self)
view.setScene(self.scene)
view.setGeometry(0,0,self.width(),self.height())

self.view.setStyleSheet("background: transparent");

Upvotes: 0

m1lhaus
m1lhaus

Reputation: 879

Lately, I've used integrated Phonon player. It's posible to add Phonon video widget as GraphicsItem thru QGraphicsProxyWidget. Works like a charm with K-Lite codec pack on Windows background.

Upvotes: 1

Related Questions