docs: add win32 code snippets to GstXOverlay Gtk+ example
authorPhilip Flarsheim <philip.flarsheim@gmail.com>
Thu, 5 Jan 2012 01:51:35 +0000 (01:51 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 5 Jan 2012 01:54:29 +0000 (01:54 +0000)
gst-libs/gst/interfaces/xoverlay.c

index 77c9e75..a5d9d60 100644 (file)
  * #ifdef GDK_WINDOWING_X11
  * #include &lt;gdk/gdkx.h&gt;  // for GDK_WINDOW_XID
  * #endif
+ * #ifdef GDK_WINDOWING_WIN32
+ * #include &lt;gdk/gdkwin32.h&gt;  // 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)
  *  if (!gst_structure_has_name (message-&gt;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);
  * 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))
  * #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
  * }
  * ...
  *   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));