tags:

views:

31

answers:

1

I have a gstreamer pipeline which ends with a xvimagesink element. To have the video displayed in a particular window, I can use the x_oerlay_interface :

gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(xvsink), winid);

So far, so good. However, it only works if winid is the idea of a top level window, which is not the case of child widget. Let's say I have :

  1. A dialog widget DialogWidget
  2. A video widget VideoWidget, which is a child of DialogWidget.

If I use DialogWidget->winId(), then the video displays correctly.
If I use 'VideoWidget->winId()', then I receive message from the Xv extension telling me things like

X Error: BadWindow (invalid Window parameter) 3
  Major opcode: 3 (X_GetWindowAttributes)
  Resource id:  0x40000d5
X Error: BadWindow (invalid Window parameter) 3
  Major opcode: 2 (X_ChangeWindowAttributes)
  Resource id:  0x40000d5
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
  Major opcode: 55 (X_CreateGC)
  Resource id:  0x40000d5
X Error: BadGC (invalid GC parameter) 13
  Extension:    132 (Uknown extension)
  Minor opcode: 19 (Unknown request)
  Resource id:  0x40000d5
X Error: BadGC (invalid GC parameter) 13
  Extension:    132 (Uknown extension)
  Minor opcode: 19 (Unknown request)
  Resource id:  0x40000d5

I would like to have a resizable window with controls buttons etc.., and within this window, a video display window or widget or whatever that is a suitable target for

gst_x_overlay_set_xwindow_id

How can I do that ?

A: 

It is in fact working with QWidget. However, a call to QApplication::syncX is needed AFTER the call to WinId :

/* Wrong order */
QApplication::syncX();
gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(xvsink), someWidget->winId());

/* Right order */
unsigned long win_id = someWidget->winId();
QApplication::syncX();
gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(xvsink), win_id);
shodanex