diff options
Diffstat (limited to 'gst-libs/gst/interfaces/xoverlay.c')
-rw-r--r-- | gst-libs/gst/interfaces/xoverlay.c | 64 |
1 files changed, 59 insertions, 5 deletions
diff --git a/gst-libs/gst/interfaces/xoverlay.c b/gst-libs/gst/interfaces/xoverlay.c index 26e19efc..224505a5 100644 --- a/gst-libs/gst/interfaces/xoverlay.c +++ b/gst-libs/gst/interfaces/xoverlay.c @@ -59,7 +59,7 @@ * from the video sink element. To solve this issue a #GstMessage is posted on * the bus to inform the application that it should set the Window identifier * immediately. Here is an example on how to do that correctly: - * <programlisting> + * |[ * static GstBusSyncReply * create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline) * { @@ -94,7 +94,7 @@ * gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, pipeline); * ... * } - * </programlisting> + * ]| * </para> * </refsect2> * <refsect2> @@ -142,7 +142,7 @@ * <refsect2> * <title>GstXOverlay and Gtk+</title> * <para> - * <programlisting> + * |[ * #include <gtk/gtk.h> * #ifdef GDK_WINDOWING_X11 * #include <gdk/gdkx.h> // for GDK_WINDOW_XID @@ -225,13 +225,67 @@ * gst_element_set_state (pipeline, GST_STATE_PLAYING); * ... * } - * </programlisting> + * ]| * </para> * </refsect2> * <refsect2> * <title>GstXOverlay and Qt</title> * <para> - * FIXME: write me + * |[ + * #include <glib.h> + * #include <gst/gst.h> + * #include <gst/interfaces/xoverlay.h> + * + * #include <QApplication> + * #include <QTimer> + * #include <QWidget> + * + * int main(int argc, char *argv[]) + * { + * if (!g_thread_supported ()) + * g_thread_init (NULL); + * + * gst_init (&argc, &argv); + * QApplication app(argc, argv); + * app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit ())); + * + * // prepare the pipeline + * + * GstElement *pipeline = gst_pipeline_new ("xvoverlay"); + * GstElement *src = gst_element_factory_make ("videotestsrc", NULL); + * GstElement *sink = gst_element_factory_make ("xvimagesink", NULL); + * gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); + * gst_element_link (src, sink); + * + * // prepare the ui + * + * QWidget window; + * window.resize(320, 240); + * window.show(); + * + * WId xwinid = window.winId(); + * gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), xwinid); + * + * // run the pipeline + * + * GstStateChangeReturn sret = gst_element_set_state (pipeline, + * GST_STATE_PLAYING); + * if (sret == GST_STATE_CHANGE_FAILURE) { + * gst_element_set_state (pipeline, GST_STATE_NULL); + * gst_object_unref (pipeline); + * // Exit application + * QTimer::singleShot(0, QApplication::activeWindow(), SLOT(quit())); + * } + * + * int ret = app.exec(); + * + * window.hide(); + * gst_element_set_state (pipeline, GST_STATE_NULL); + * gst_object_unref (pipeline); + * + * return ret; + * } + * ]| * </para> * </refsect2> */ |