static GstBusSyncReply create_window (GstBus* bus, GstMessage* message, GtkWidget* widget)
{
    GtkAllocation allocation;

    if (gst_gtk_handle_need_context (bus, message, NULL))
        return GST_BUS_DROP;

    // ignore anything but 'prepare-window-handle' element messages
    if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
        return GST_BUS_PASS;

    if (!gst_is_video_overlay_prepare_window_handle_message (message))
        return GST_BUS_PASS;

    g_print ("setting window handle %p\n", widget);

    gst_video_overlay_set_gtk_window (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), widget);

    gtk_widget_get_allocation (widget, &allocation);
    gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), allocation.x, allocation.y, allocation.width, allocation.height);

    gst_message_unref (message);

    return GST_BUS_DROP;
}
示例#2
0
/* TODO: use video overlay in the proper way (like suggested in docs, see gtkvideooverlay example) */
static gboolean
expose_cb (GtkWidget * widget, gpointer data)
{
  GstVideoOverlay *overlay =
      GST_VIDEO_OVERLAY (gst_bin_get_by_interface (GST_BIN (data),
          GST_TYPE_VIDEO_OVERLAY));

  gst_video_overlay_set_gtk_window (overlay, widget);

  return FALSE;
}
示例#3
0
static gboolean on_click_drawing_area(GtkWidget* widget, GdkEventButton* event, GstElement* videosink)
{
    GtkAllocation allocation;

    g_print ("switch the drawing area %p\n", widget);
    gst_video_overlay_set_gtk_window (GST_VIDEO_OVERLAY (videosink), widget);

    gtk_widget_get_allocation (widget, &allocation);
    gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (videosink), allocation.x, allocation.y, allocation.width, allocation.height);

    return FALSE;
}
static gboolean on_click_drawing_area(GtkWidget* widget, GdkEventButton* event, GstElement* videosink)
{
    GtkAllocation allocation;
    GtkWidget *parent = gtk_widget_get_parent (widget);

    g_print ("switch the drawing area %p\n", widget);
    gst_video_overlay_set_gtk_window (GST_VIDEO_OVERLAY (videosink), widget);

    gtk_widget_get_allocation (widget, &allocation);
    gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (videosink), allocation.x, allocation.y, allocation.width, allocation.height);

    /* XXX: required on wayland as changing the window handle (subsurface)
     * requires a wl_surface::commit from the parent */
    if (parent)
      gtk_widget_queue_draw (parent);

    return FALSE;
}
示例#5
0
static GstBusSyncReply create_window (GstBus* bus, GstMessage* message, GtkWidget* widget)
{
    // ignore anything but 'prepare-window-handle' element messages
    if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
        return GST_BUS_PASS;

    if (!gst_is_video_overlay_prepare_window_handle_message (message))
        return GST_BUS_PASS;

    g_print ("setting window handle\n");

    //do not call gdk_window_ensure_native for the first time here because
    //we are in a different thread than the main thread
    //(and the main thread the onne)
    gst_video_overlay_set_gtk_window (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), widget);

    gst_message_unref (message);

    return GST_BUS_DROP;
}
static GstBusSyncReply
create_window (GstBus * bus, GstMessage * message, GtkWidget * widget)
{
  if (gst_gtk_handle_need_context (bus, message, NULL))
    return GST_BUS_DROP;

  /* ignore anything but 'prepare-window-handle' element messages */
  if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
    return GST_BUS_PASS;

  if (!gst_is_video_overlay_prepare_window_handle_message (message))
    return GST_BUS_PASS;

  /* do not call gdk_window_ensure_native for the first time here because
   * we are in a different thread than the main thread */
  gst_video_overlay_set_gtk_window (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC
          (message)), widget);

  gst_message_unref (message);

  return GST_BUS_DROP;
}