I tried to use phonon to play the video, but could not. Off-late, it became known on the Qt forums that even the latest version of Qt does not support phonons. This is when I started using Gstreamer. Any suggestions on how to link a Gstreamer window to a Qt widget? My goal is to play the video using Gstreamer in a Qt widget. So how do I link the Gstreamer window and the Qt widget?
I successfully got the widget Id through winid() . Next, with the help of Gregory Pakosh, I added the following 2 lines of code to my application -
QApplication::syncX(); gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(sink), widget->winId());
However, I cannot associate the Qt widget with the gstreamer video window.
Here is what my sample code will look like:
int main(int argc, char *argv[]) { printf("winid=%d\n", w.winId()); gst_init (NULL,NULL); bin = gst_pipeline_new ("pipeline"); filesrc = gst_element_factory_make ("filesrc", "disk_source"); g_assert (filesrc); g_object_set (G_OBJECT (filesrc), "location", "PATH_TO_THE_EXECUTABLE", NULL); demux = gst_element_factory_make ("mpegtsdemux", "demuxer"); if (!demux) { g_print ("could not find plugin \"mpegtsmux\""); return -1; } vdecoder = gst_element_factory_make ("mpeg2dec", "decode"); if (!vdecoder) { g_print ("could not find plugin \"mpeg2dec\""); return -1; } videosink = gst_element_factory_make ("xvimagesink", "play_video"); g_assert (videosink); gst_bin_add_many (GST_BIN (bin), filesrc, demux, vdecoder, videosink, NULL); gst_element_link_many (filesrc, demux, vdecoder, videosink, NULL); gst_element_set_state(videosink, GST_STATE_READY); QApplication::syncX(); gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(videosink), w.winId()); gst_element_set_state (bin, GST_STATE_PLAYING); }
Could you tell us more about using gst_x_overlay_set_xwindow_id () in my context?
Can I get any advice on how I can integrate gstreamer into Qt? Please help me solve this problem.