From 08af765ea2778ea48c3c56af3f567d2fc003fb80 Mon Sep 17 00:00:00 2001 From: Philip Flarsheim Date: Thu, 5 Jan 2012 01:51:35 +0000 Subject: [PATCH] docs: add win32 code snippets to GstXOverlay Gtk+ example --- gst-libs/gst/interfaces/xoverlay.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/gst-libs/gst/interfaces/xoverlay.c b/gst-libs/gst/interfaces/xoverlay.c index 77c9e75..a5d9d60 100644 --- a/gst-libs/gst/interfaces/xoverlay.c +++ b/gst-libs/gst/interfaces/xoverlay.c @@ -148,8 +148,11 @@ * #ifdef GDK_WINDOWING_X11 * #include <gdk/gdkx.h> // for GDK_WINDOW_XID * #endif + * #ifdef GDK_WINDOWING_WIN32 + * #include <gdk/gdkwin32.h> // for GDK_WINDOW_HWND + * #endif * ... - * static gulong video_window_xid = 0; + * static guintptr video_window_handle = 0; * ... * static GstBusSyncReply * bus_sync_handler (GstBus * bus, GstMessage * message, gpointer user_data) @@ -160,14 +163,14 @@ * if (!gst_structure_has_name (message->structure, "prepare-xwindow-id")) * return GST_BUS_PASS; * - * if (video_window_xid != 0) { + * if (video_window_handle != 0) { * GstXOverlay *xoverlay; * * // GST_MESSAGE_SRC (message) will be the video sink element * xoverlay = GST_X_OVERLAY (GST_MESSAGE_SRC (message)); - * gst_x_overlay_set_window_handle (xoverlay, video_window_xid); + * gst_x_overlay_set_window_handle (xoverlay, video_window_handle); * } else { - * g_warning ("Should have obtained video_window_xid by now!"); + * g_warning ("Should have obtained video_window_handle by now!"); * } * * gst_message_unref (message); @@ -178,6 +181,8 @@ * video_widget_realize_cb (GtkWidget * widget, gpointer data) * { * #if GTK_CHECK_VERSION(2,18,0) + * // Tell Gtk+/Gdk to create a native window for this widget instead of + * // drawing onto the parent widget. * // This is here just for pedagogical purposes, GDK_WINDOW_XID will call * // it as well in newer Gtk versions * if (!gdk_window_ensure_native (widget->window)) @@ -185,7 +190,16 @@ * #endif * * #ifdef GDK_WINDOWING_X11 - * video_window_xid = GDK_WINDOW_XID (gtk_widget_get_window (video_window)); + * { + * gulong xid = GDK_WINDOW_XID (gtk_widget_get_window (video_window)); + * video_window_handle = xid; + * } + * #endif + * #ifdef GDK_WINDOWING_WIN32 + * { + * HWND wnd = GDK_WINDOW_HWND (gtk_widget_get_window (video_window)); + * video_window_handle = (guintptr) wnd; + * } * #endif * } * ... @@ -211,12 +225,12 @@ * gtk_widget_show_all (app_window); * * // realize window now so that the video window gets created and we can - * // obtain its XID before the pipeline is started up and the videosink - * // asks for the XID of the window to render onto + * // obtain its XID/HWND before the pipeline is started up and the videosink + * // asks for the XID/HWND of the window to render onto * gtk_widget_realize (video_window); * - * // we should have the XID now - * g_assert (video_window_xid != 0); + * // we should have the XID/HWND now + * g_assert (video_window_handle != 0); * ... * // set up sync handler for setting the xid once the pipeline is started * bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); -- 2.7.4