本文介绍了使用gstreamer定位Qt子窗口小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个以xvimagesink元素结尾的gstreamer管道.要在特定的窗口中显示视频,我可以使用x_oerlay_interface:

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);

到目前为止,太好了.但是,仅当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. 对话框小部件DialogWidget
  2. 视频小部件VideoWidget,它是DialogWidget的子级.

如果我使用 DialogWidget-> winId(),那么视频将正确显示.
如果我使用"VideoWidget-> winId()",那么我会从Xv扩展收到消息,告诉我类似

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

我该怎么做?

推荐答案

它实际上与QWidget一起使用.但是,之后需要调用 QApplication :: syncX 调用 WinId :

It is in fact working with QWidget. However, a call to QApplication::syncX is needed AFTERthe 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);

这篇关于使用gstreamer定位Qt子窗口小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 19:44