首页 > 解决方案 > gst_bus_sync_handler 不发送准备窗口句柄消息

问题描述

我已经构建了一个使用 xvoverlay、udpsrc 和 xvimagesink 的 Gstreamer 管道。

我正在运行 4 个具有不同来源的并行管道,我试图让这些管道显示在 GTK 窗口中。我创建了 4 个 GtkWidgets 并用 gtk_drawing_area_new();

我已遵循指南并实现了 implement_cb 和总线同步处理程序。

问题是它在大多数情况下都有效。总线同步处理程序不时地为 1 个或 2 个接收器发送准备窗口句柄消息。设置同步处理程序的代码显然在那里,窗口已初始化以及所有内容,但我从未收到消息。

static GstBusSyncReply bus_sync_handler (GstBus * bus, GstMessage * message, gpointer ptr)
{
    uint8_t index = *((uint8_t *) ptr);

    if (!gst_is_video_overlay_prepare_window_handle_message (message))
        return GST_BUS_PASS;

    if (window_handles[index] != 0) {
        GstVideoOverlay *overlay;

        overlay = GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message));
        gst_video_overlay_set_window_handle (overlay, window_handles[index]);
    }
    gst_message_unref (message);
    (void)bus;

    return GST_BUS_DROP;
}
stream->queue_display = gst_element_factory_make("queue", NULL);
stream->videoscale = gst_element_factory_make ("videoscale", NULL);
stream->videosink = gst_element_factory_make("xvimagesink", NULL);


GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE (stream->pipeline));
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bus_sync_handler, (gpointer) stream->window_index, NULL);
gst_bin_add_many(GST_BIN(stream->pipeline), gst_object_ref(stream->queue_display), stream->videoscale, stream->videosink, NULL);

if (!gst_element_link_many(stream->queue_display, stream->videoscale, stream->videosink, NULL)) {
//Error handling
}

在此之后,管道将在稍后阶段播放。

有任何想法吗?

标签: cudpgtkgstreamer

解决方案


推荐阅读