如何在qwidget上嵌入gstreamer waylandsink?

时间:2019-06-19 07:19:17

标签: qt5 gstreamer wayland

在我们的嵌入式imx6平台(linux 5.0,etnaviv,wayland)上,我在将Waylandsink嵌入qtwidget上时遇到了问题。 (glimagesink如果运作良好,也有可能,但是从gst-launch开始,它似乎对waylandink的CPU占用较少)。 作为一种演示,我创建了一个小应用程序:

https://github.com/woutervanh/qt-waylandsink-demo

在创建窗口句柄时会卡住:

  

准备窗口句柄0:00:00.113075333 494 0x213f3b0警告
  waylandsink wlvideoformat.c:137:gst_video_format_to_wl_dmabuf_format:   找不到Wayland dmabuf视频格式

我猜我在处理表面和显示时一定做错了...

但是,如果我直接通过以下方式运行“相同”管道,则该管道可以工作: gst-launch1.0 videotestsrc! Waylandsink

如果有人将我指向正确的方向,那真是太棒了

顺便说一句,.pro文件看起来很凌乱,但这是因为在Yocto中使用正确的依赖项构建时,我也遇到了一些问题。

Widget* widget = static_cast<Widget*>(user_data);

if (gst_is_wayland_display_handle_need_context_message (message)) {
  GstContext *context;
  qDebug() << "Need Context";

  QPlatformNativeInterface *native =
          QGuiApplication::platformNativeInterface();
  struct wl_display *display_handle = (struct wl_display *)
          native->nativeResourceForWindow("display", NULL);

  context = gst_wayland_display_handle_context_new (display_handle);
  gst_element_set_context (GST_ELEMENT (GST_MESSAGE_SRC (message)), context);

  goto drop;
} else if (gst_is_video_overlay_prepare_window_handle_message (message)) {
    qDebug() << "Prepare window handle";

  QPlatformNativeInterface *native =
          QGuiApplication::platformNativeInterface();
  struct wl_surface *surface = static_cast<struct wl_surface *>(
              native->nativeResourceForWindow("surface", widget->windowHandle()));

  gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), (guintptr) surface);
  gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), widget->x(), widget->y(), widget->width(), widget->height());

  goto drop;
}

return GST_BUS_PASS;

0 个答案:

没有答案