Query on video rendering with gstreamer and UI repaint
-
Hello,
I am using Qt 4.8 on Embedded Linux and trying to do a video/audio player with Qt for GUI and gstreamer for media playback in backend.
I have a main window with six push buttons at bottom and a QGraphicsView widget in the centre above the push buttons. I run the gstreamer pipeline and render the video to this QGraphicsScene using code as below. I had two queries.
@
QApplication::syncX();
setCentralWidget(ui->graphicsView);
gst_x_overlay_set_window_handle (GST_X_OVERLAY(video_sink), ui->graphicsView->winId());
@-
I can render the video if i set the window handle to centralWidget's winId. If i set the window handle to graphicsview's window Id without doing setCentralWidget(ui->graphicsView); i can't display the video and i get a "EGL couldn't create window" error. Can someone just clarify this?
-
Once the video starts playing, the push buttons disappear. Something to do with the video playback but i can't figure out. I thought i will do a repaint() and update(), but it doesn't help. Can someone point me in the right direction.
I am a newbie to Qt.
I am using a Toradex Colibri T20 module and running a pipeline utilising Nvidia gstreamer elements.
@
gst-launch filesrc location=file.mp4 ! qtdemux name=demux demux.video_00 ! nv_omx_h264dec ! nv_gl_eglimagesink demux.audio_00 ! nv_omx_aacdec ! alsasink device=hw:0,0
@This is the pipeline i am running.
-
-
Hi and welcome to devnet,
Not the answer you are waiting but since you are using a custom pipeline you might be interested by the "QtGstreamer":http://cgit.freedesktop.org/gstreamer/qt-gstreamer/ library, it might suite your need better.
Hope it helps
-
[quote author="Sanchayan Maity" date="1409142082"]
- I can render the video if i set the window handle to centralWidget's winId. If i set the window handle to graphicsview's window Id without doing setCentralWidget(ui->graphicsView); i can't display the video and i get a "EGL couldn't create window" error. Can someone just clarify this?[/quote]
Without adding your widget to MainWindow or without calling show() on a widget Qt does not know what to draw. That is why you getting the error.
[quote author="Sanchayan Maity" date="1409142082"]
2. Once the video starts playing, the push buttons disappear. Something to do with the video playback but i can't figure out. I thought i will do a repaint() and update(), but it doesn't help. Can someone point me in the right direction.[/quote]When you send winId to gstreamer it will paint the frames on a whole window. And since graphicsview is a central widget all buttons belong to the same window. So gstreamer over-paint them.
You need to create a central widget as QWidget, add buttons to the central widget and add graphicsview to the same widget lay them out using Qt layouts and then play video.
-
The graphicsview is already a part of the main window and is enabled. So calling show() is not required. Also, it's not Qt that's giving the error i believe, but, the video sink element in the gstreamer pipeline.
"When you send winId to gstreamer it will paint the frames on a whole window. And since graphicsview is a central widget all buttons belong to the same window. So gstreamer over-paint them."
I thought so, that's why i did setCentralWidget(ui->graphicsView) to only display it in garphicsview part of the mainwindow. The mainwindow has the central widget and everything is in the central widget.
With setCentralWidget(ui->graphicsView) the video is displayed only in the graphicsview window, but, still the buttons do not show once the video playback starts.