docs: update xoverlay docs for api addition and deprecation

This commit is contained in:
Stefan Kost 2011-05-23 23:41:56 +03:00
parent 269205b1ad
commit deeae48a03
2 changed files with 43 additions and 40 deletions

View file

@ -66,23 +66,23 @@
* // ignore anything but 'prepare-xwindow-id' element messages * // ignore anything but 'prepare-xwindow-id' element messages
* if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT) * if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
* return GST_BUS_PASS; * return GST_BUS_PASS;
* *
* if (!gst_structure_has_name (message->structure, "prepare-xwindow-id")) * if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))
* return GST_BUS_PASS; * return GST_BUS_PASS;
* *
* win = XCreateSimpleWindow (disp, root, 0, 0, 320, 240, 0, 0, 0); * win = XCreateSimpleWindow (disp, root, 0, 0, 320, 240, 0, 0, 0);
* *
* XSetWindowBackgroundPixmap (disp, win, None); * XSetWindowBackgroundPixmap (disp, win, None);
* *
* XMapRaised (disp, win); * XMapRaised (disp, win);
* *
* XSync (disp, FALSE); * XSync (disp, FALSE);
* *
* gst_x_overlay_set_window_handle (GST_X_OVERLAY (GST_MESSAGE_SRC (message)), * gst_x_overlay_set_window_handle (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
* win); * win);
* *
* gst_message_unref (message); * gst_message_unref (message);
* *
* return GST_BUS_DROP; * return GST_BUS_DROP;
* } * }
* ... * ...
@ -158,17 +158,17 @@
* return GST_BUS_PASS; * return GST_BUS_PASS;
* if (!gst_structure_has_name (message->structure, "prepare-xwindow-id")) * if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))
* return GST_BUS_PASS; * return GST_BUS_PASS;
* *
* if (video_window_xid != 0) { * if (video_window_xid != 0) {
* GstXOverlay *xoverlay; * GstXOverlay *xoverlay;
* *
* // GST_MESSAGE_SRC (message) will be the video sink element * // GST_MESSAGE_SRC (message) will be the video sink element
* xoverlay = GST_X_OVERLAY (GST_MESSAGE_SRC (message)); * 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_xid);
* } else { * } else {
* g_warning ("Should have obtained video_window_xid by now!"); * g_warning ("Should have obtained video_window_xid by now!");
* } * }
* *
* gst_message_unref (message); * gst_message_unref (message);
* return GST_BUS_DROP; * return GST_BUS_DROP;
* } * }
@ -182,7 +182,7 @@
* if (!gdk_window_ensure_native (widget->window)) * if (!gdk_window_ensure_native (widget->window))
* g_error ("Couldn't create native window needed for GstXOverlay!"); * g_error ("Couldn't create native window needed for GstXOverlay!");
* #endif * #endif
* *
* #ifdef GDK_WINDOWING_X11 * #ifdef GDK_WINDOWING_X11
* video_window_xid = GDK_WINDOW_XID (video_window->window); * video_window_xid = GDK_WINDOW_XID (video_window->window);
* #endif * #endif
@ -208,12 +208,12 @@
* ... * ...
* // show the GUI * // show the GUI
* gtk_widget_show_all (app_window); * gtk_widget_show_all (app_window);
* *
* // realize window now so that the video window gets created and we can * // 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 * // obtain its XID before the pipeline is started up and the videosink
* // asks for the XID of the window to render onto * // asks for the XID of the window to render onto
* gtk_widget_realize (window); * gtk_widget_realize (window);
* *
* // we should have the XID now * // we should have the XID now
* g_assert (video_window_xid != 0); * g_assert (video_window_xid != 0);
* ... * ...
@ -235,39 +235,39 @@
* #include <glib.h> * #include <glib.h>
* #include <gst/gst.h> * #include <gst/gst.h>
* #include <gst/interfaces/xoverlay.h> * #include <gst/interfaces/xoverlay.h>
* *
* #include <QApplication> * #include <QApplication>
* #include <QTimer> * #include <QTimer>
* #include <QWidget> * #include <QWidget>
* *
* int main(int argc, char *argv[]) * int main(int argc, char *argv[])
* { * {
* if (!g_thread_supported ()) * if (!g_thread_supported ())
* g_thread_init (NULL); * g_thread_init (NULL);
* *
* gst_init (&argc, &argv); * gst_init (&argc, &argv);
* QApplication app(argc, argv); * QApplication app(argc, argv);
* app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit ())); * app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit ()));
* *
* // prepare the pipeline * // prepare the pipeline
* *
* GstElement *pipeline = gst_pipeline_new ("xvoverlay"); * GstElement *pipeline = gst_pipeline_new ("xvoverlay");
* GstElement *src = gst_element_factory_make ("videotestsrc", NULL); * GstElement *src = gst_element_factory_make ("videotestsrc", NULL);
* GstElement *sink = gst_element_factory_make ("xvimagesink", NULL); * GstElement *sink = gst_element_factory_make ("xvimagesink", NULL);
* gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); * gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
* gst_element_link (src, sink); * gst_element_link (src, sink);
* *
* // prepare the ui * // prepare the ui
* *
* QWidget window; * QWidget window;
* window.resize(320, 240); * window.resize(320, 240);
* window.show(); * window.show();
* *
* WId xwinid = window.winId(); * WId xwinid = window.winId();
* gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), xwinid); * gst_x_overlay_set_window_handle (GST_X_OVERLAY (sink), xwinid);
* *
* // run the pipeline * // run the pipeline
* *
* GstStateChangeReturn sret = gst_element_set_state (pipeline, * GstStateChangeReturn sret = gst_element_set_state (pipeline,
* GST_STATE_PLAYING); * GST_STATE_PLAYING);
* if (sret == GST_STATE_CHANGE_FAILURE) { * if (sret == GST_STATE_CHANGE_FAILURE) {
@ -276,13 +276,13 @@
* // Exit application * // Exit application
* QTimer::singleShot(0, QApplication::activeWindow(), SLOT(quit())); * QTimer::singleShot(0, QApplication::activeWindow(), SLOT(quit()));
* } * }
* *
* int ret = app.exec(); * int ret = app.exec();
* *
* window.hide(); * window.hide();
* gst_element_set_state (pipeline, GST_STATE_NULL); * gst_element_set_state (pipeline, GST_STATE_NULL);
* gst_object_unref (pipeline); * gst_object_unref (pipeline);
* *
* return ret; * return ret;
* } * }
* ]| * ]|
@ -333,12 +333,12 @@ gst_x_overlay_base_init (gpointer g_class)
/** /**
* gst_x_overlay_set_xwindow_id: * gst_x_overlay_set_xwindow_id:
* @overlay: a #GstXOverlay to set the XWindow on. * @overlay: a #GstXOverlay to set the window on.
* @xwindow_id: a #XID referencing the XWindow. * @xwindow_id: a XID referencing the XWindow.
* *
* This will call the video overlay's set_xwindow_id method. You should * This will call the video overlay's set_xwindow_id method. You should
* use this method to tell to a XOverlay to display video output to a * use this method to tell to a XOverlay to display video output to a
* specific XWindow. Passing 0 as the xwindow_id will tell the overlay to * specific XWindow. Passing 0 as the @xwindow_id will tell the overlay to
* stop using that window and create an internal one. * stop using that window and create an internal one.
* *
* Deprecated: Use gst_x_overlay_set_window_handle() instead. * Deprecated: Use gst_x_overlay_set_window_handle() instead.
@ -358,13 +358,13 @@ gst_x_overlay_set_xwindow_id (GstXOverlay * overlay, gulong xwindow_id)
/** /**
* gst_x_overlay_set_window_handle: * gst_x_overlay_set_window_handle:
* @overlay: a #GstXOverlay to set the XWindow on. * @overlay: a #GstXOverlay to set the window on.
* @xwindow_id: a #XID referencing the XWindow. * @handle: a handle referencing the window.
* *
* This will call the video overlay's set_window_handle method. You * This will call the video overlay's set_window_handle method. You
* should use this method to tell to a XOverlay to display video output to a * should use this method to tell to a XOverlay to display video output to a
* specific XWindow. Passing 0 as the xwindow_id will tell the overlay to * specific window (e.g. an XWindow on X11). Passing 0 as the @handle will
* stop using that window and create an internal one. * tell the overlay to stop using that window and create an internal one.
* *
* Since: 0.10.31 * Since: 0.10.31
*/ */
@ -452,7 +452,7 @@ gst_x_overlay_got_window_handle (GstXOverlay * overlay, guintptr handle)
* @overlay: a #GstXOverlay which does not yet have an XWindow. * @overlay: a #GstXOverlay which does not yet have an XWindow.
* *
* This will post a "prepare-xwindow-id" element message on the bus * This will post a "prepare-xwindow-id" element message on the bus
* to give applications an opportunity to call * to give applications an opportunity to call
* gst_x_overlay_set_xwindow_id() before a plugin creates its own * gst_x_overlay_set_xwindow_id() before a plugin creates its own
* window. * window.
* *

View file

@ -52,10 +52,11 @@ typedef struct _GstXOverlayClass GstXOverlayClass;
/** /**
* GstXOverlayClass: * GstXOverlayClass:
* @klass: parent interface type. * @klass: parent interface type.
* @set_xwindow_id: virtual method to configure the XWindow id * @set_xwindow_id: (deprecated) virtual method to configure the XWindow handle
* @expose: virtual method to handle expose events * @expose: virtual method to handle expose events
* @handle_events: virtual method to handle events * @handle_events: virtual method to handle events
* @set_render_rectangle: virtual method to set the render rectangle (since 0.10.29) * @set_render_rectangle: virtual method to set the render rectangle (since 0.10.29)
* @set_window_handle: virtual method to configure the window handle
* *
* #GstXOverlay interface * #GstXOverlay interface
*/ */
@ -67,14 +68,16 @@ struct _GstXOverlayClass {
void (* set_xwindow_id) (GstXOverlay *overlay, void (* set_xwindow_id) (GstXOverlay *overlay,
gulong xwindow_id); gulong xwindow_id);
#else #else
#ifndef __GTK_DOC_IGNORE__
void (* set_xwindow_id_disabled) (GstXOverlay *overlay, void (* set_xwindow_id_disabled) (GstXOverlay *overlay,
gulong xwindow_id); gulong xwindow_id);
#endif
#endif /* not GST_DISABLE_DEPRECATED */ #endif /* not GST_DISABLE_DEPRECATED */
void (* expose) (GstXOverlay *overlay); void (* expose) (GstXOverlay *overlay);
void (* handle_events) (GstXOverlay *overlay, void (* handle_events) (GstXOverlay *overlay,
gboolean handle_events); gboolean handle_events);
void (* set_render_rectangle) (GstXOverlay *overlay, void (* set_render_rectangle) (GstXOverlay *overlay,
gint x, gint y, gint x, gint y,
@ -90,7 +93,7 @@ GType gst_x_overlay_get_type (void);
/* virtual class function wrappers */ /* virtual class function wrappers */
#ifndef GST_DISABLE_DEPRECATED #ifndef GST_DISABLE_DEPRECATED
void gst_x_overlay_set_xwindow_id (GstXOverlay *overlay, void gst_x_overlay_set_xwindow_id (GstXOverlay *overlay,
gulong xwindow_id); gulong xwindow_id);
#endif #endif
@ -103,7 +106,7 @@ void gst_x_overlay_expose (GstXOverlay *overlay);
void gst_x_overlay_handle_events (GstXOverlay *overlay, void gst_x_overlay_handle_events (GstXOverlay *overlay,
gboolean handle_events); gboolean handle_events);
void gst_x_overlay_set_window_handle (GstXOverlay *overlay, void gst_x_overlay_set_window_handle (GstXOverlay *overlay,
guintptr handle); guintptr handle);
/* public methods to dispatch bus messages */ /* public methods to dispatch bus messages */