1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>gstxoverlay</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7 <link rel="home" href="index.html" title="GStreamer Base Plugins 0.10 Library Reference Manual">
8 <link rel="up" href="gstreamer-interfaces.html" title="Interfaces Library">
9 <link rel="prev" href="gst-plugins-base-libs-gstvideoorientation.html" title="gstvideoorientation">
10 <link rel="next" href="gstreamer-netbuffer.html" title="Network Buffer Library">
11 <meta name="generator" content="GTK-Doc V1.17 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
17 <td><a accesskey="p" href="gst-plugins-base-libs-gstvideoorientation.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18 <td><a accesskey="u" href="gstreamer-interfaces.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20 <th width="100%" align="center">GStreamer Base Plugins 0.10 Library Reference Manual</th>
21 <td><a accesskey="n" href="gstreamer-netbuffer.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
23 <tr><td colspan="5" class="shortcuts">
24 <a href="#gst-plugins-base-libs-gstxoverlay.synopsis" class="shortcut">Top</a>
26 <a href="#gst-plugins-base-libs-gstxoverlay.description" class="shortcut">Description</a>
28 <a href="#gst-plugins-base-libs-gstxoverlay.object-hierarchy" class="shortcut">Object Hierarchy</a>
30 <a href="#gst-plugins-base-libs-gstxoverlay.prerequisites" class="shortcut">Prerequisites</a>
33 <div class="refentry">
34 <a name="gst-plugins-base-libs-gstxoverlay"></a><div class="titlepage"></div>
35 <div class="refnamediv"><table width="100%"><tr>
37 <h2><span class="refentrytitle"><a name="gst-plugins-base-libs-gstxoverlay.top_of_page"></a>gstxoverlay</span></h2>
38 <p>gstxoverlay — Interface for setting/getting a Window on elements
41 <td valign="top" align="right"></td>
43 <div class="refsynopsisdiv">
44 <a name="gst-plugins-base-libs-gstxoverlay.synopsis"></a><h2>Synopsis</h2>
45 <a name="GstXOverlay"></a><pre class="synopsis">
46 #include <gst/interfaces/xoverlay.h>
48 <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay-struct" title="GstXOverlay">GstXOverlay</a>;
49 struct <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlayClass" title="struct GstXOverlayClass">GstXOverlayClass</a>;
50 <span class="returnvalue">void</span> <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-set-xwindow-id" title="gst_x_overlay_set_xwindow_id ()">gst_x_overlay_set_xwindow_id</a> (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> *overlay</code></em>,
51 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> xwindow_id</code></em>);
52 <span class="returnvalue">void</span> <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-got-xwindow-id" title="gst_x_overlay_got_xwindow_id ()">gst_x_overlay_got_xwindow_id</a> (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> *overlay</code></em>,
53 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> xwindow_id</code></em>);
54 <span class="returnvalue">void</span> <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-got-window-handle" title="gst_x_overlay_got_window_handle ()">gst_x_overlay_got_window_handle</a> (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> *overlay</code></em>,
55 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guintptr"><span class="type">guintptr</span></a> handle</code></em>);
56 <span class="returnvalue">void</span> <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-set-window-handle" title="gst_x_overlay_set_window_handle ()">gst_x_overlay_set_window_handle</a> (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> *overlay</code></em>,
57 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guintptr"><span class="type">guintptr</span></a> handle</code></em>);
58 <span class="returnvalue">void</span> <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-prepare-xwindow-id" title="gst_x_overlay_prepare_xwindow_id ()">gst_x_overlay_prepare_xwindow_id</a> (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> *overlay</code></em>);
59 <span class="returnvalue">void</span> <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-expose" title="gst_x_overlay_expose ()">gst_x_overlay_expose</a> (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> *overlay</code></em>);
60 <span class="returnvalue">void</span> <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-handle-events" title="gst_x_overlay_handle_events ()">gst_x_overlay_handle_events</a> (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> *overlay</code></em>,
61 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> handle_events</code></em>);
62 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-set-render-rectangle" title="gst_x_overlay_set_render_rectangle ()">gst_x_overlay_set_render_rectangle</a> (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> *overlay</code></em>,
63 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> x</code></em>,
64 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> y</code></em>,
65 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>,
66 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>);
69 <div class="refsect1">
70 <a name="gst-plugins-base-libs-gstxoverlay.object-hierarchy"></a><h2>Object Hierarchy</h2>
71 <pre class="synopsis">
76 <div class="refsect1">
77 <a name="gst-plugins-base-libs-gstxoverlay.prerequisites"></a><h2>Prerequisites</h2>
80 <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstImplementsInterface.html">GstImplementsInterface</a> and <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>.</p>
82 <div class="refsect1">
83 <a name="gst-plugins-base-libs-gstxoverlay.description"></a><h2>Description</h2>
86 <div class="refsect2">
87 <a name="idp15827040"></a><p>
88 The XOverlay interface is used for 2 main purposes :
90 <div class="itemizedlist"><ul class="itemizedlist" type="disc">
91 <li class="listitem"><p>
92 To get a grab on the Window where the video sink element is going to render.
93 This is achieved by either being informed about the Window identifier that
94 the video sink element generated, or by forcing the video sink element to use
95 a specific Window identifier for rendering.
97 <li class="listitem"><p>
98 To force a redrawing of the latest video frame the video sink element
99 displayed on the Window. Indeed if the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPipeline.html"><span class="type">GstPipeline</span></a> is in <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#GST-STATE-PAUSED:CAPS"><span class="type">GST_STATE_PAUSED</span></a>
100 state, moving the Window around will damage its content. Application
101 developers will want to handle the Expose events themselves and force the
102 video sink element to refresh the Window's content.
108 Using the Window created by the video sink is probably the simplest scenario,
109 in some cases, though, it might not be flexible enough for application
110 developers if they need to catch events such as mouse moves and button
114 Setting a specific Window identifier on the video sink element is the most
115 flexible solution but it has some issues. Indeed the application needs to set
116 its Window identifier at the right time to avoid internal Window creation
117 from the video sink element. To solve this issue a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstMessage.html#GstMessage"><span class="type">GstMessage</span></a> is posted on
118 the bus to inform the application that it should set the Window identifier
119 immediately. Here is an example on how to do that correctly:
121 <div class="informalexample">
122 <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
125 <td class="listing_lines" align="right"><pre>1
159 <td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">static</span> GstBusSyncReply
160 <span class="function">create_window</span> <span class="gtkdoc opt">(</span>GstBus <span class="gtkdoc opt">*</span> bus<span class="gtkdoc opt">,</span> GstMessage <span class="gtkdoc opt">*</span> message<span class="gtkdoc opt">,</span> GstPipeline <span class="gtkdoc opt">*</span> pipeline<span class="gtkdoc opt">)</span>
161 <span class="gtkdoc opt">{</span>
162 <span class="gtkdoc slc">// ignore anything but 'prepare-xwindow-id' element messages</span>
163 <span class="keyword">if</span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstMessage.html#GST-MESSAGE-TYPE:CAPS">GST_MESSAGE_TYPE</a></span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">) !=</span> GST_MESSAGE_ELEMENT<span class="gtkdoc opt">)</span>
164 <span class="keyword">return</span> GST_BUS_PASS<span class="gtkdoc opt">;</span>
166 <span class="keyword">if</span> <span class="gtkdoc opt">(!</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstStructure.html#gst-structure-has-name">gst_structure_has_name</a></span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">-></span>structure<span class="gtkdoc opt">,</span> <span class="string">"prepare-xwindow-id"</span><span class="gtkdoc opt">))</span>
167 <span class="keyword">return</span> GST_BUS_PASS<span class="gtkdoc opt">;</span>
169 win <span class="gtkdoc opt">=</span> <span class="function">XCreateSimpleWindow</span> <span class="gtkdoc opt">(</span>disp<span class="gtkdoc opt">,</span> root<span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> <span class="number">320</span><span class="gtkdoc opt">,</span> <span class="number">240</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">);</span>
171 <span class="function">XSetWindowBackgroundPixmap</span> <span class="gtkdoc opt">(</span>disp<span class="gtkdoc opt">,</span> win<span class="gtkdoc opt">,</span> None<span class="gtkdoc opt">);</span>
173 <span class="function">XMapRaised</span> <span class="gtkdoc opt">(</span>disp<span class="gtkdoc opt">,</span> win<span class="gtkdoc opt">);</span>
175 <span class="function">XSync</span> <span class="gtkdoc opt">(</span>disp<span class="gtkdoc opt">,</span> FALSE<span class="gtkdoc opt">);</span>
177 <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-set-window-handle">gst_x_overlay_set_window_handle</a></span> <span class="gtkdoc opt">(</span><span class="function">GST_X_OVERLAY</span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstMessage.html#GST-MESSAGE-SRC:CAPS">GST_MESSAGE_SRC</a></span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">)),</span>
178 win<span class="gtkdoc opt">);</span>
180 <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstMessage.html#gst-message-unref">gst_message_unref</a></span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">);</span>
182 <span class="keyword">return</span> GST_BUS_DROP<span class="gtkdoc opt">;</span>
183 <span class="gtkdoc opt">}</span>
184 <span class="gtkdoc opt">...</span>
185 <span class="gtkdoc kwb">int</span>
186 <span class="function">main</span> <span class="gtkdoc opt">(</span><span class="gtkdoc kwb">int</span> argc<span class="gtkdoc opt">,</span> <span class="gtkdoc kwb">char</span> <span class="gtkdoc opt">**</span>argv<span class="gtkdoc opt">)</span>
187 <span class="gtkdoc opt">{</span>
188 <span class="gtkdoc opt">...</span>
189 bus <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPipeline.html#gst-pipeline-get-bus">gst_pipeline_get_bus</a></span> <span class="gtkdoc opt">(</span><span class="function">GST_PIPELINE</span> <span class="gtkdoc opt">(</span>pipeline<span class="gtkdoc opt">));</span>
190 <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html#gst-bus-set-sync-handler">gst_bus_set_sync_handler</a></span> <span class="gtkdoc opt">(</span>bus<span class="gtkdoc opt">, (</span>GstBusSyncHandler<span class="gtkdoc opt">)</span> create_window<span class="gtkdoc opt">,</span> pipeline<span class="gtkdoc opt">);</span>
191 <span class="gtkdoc opt">...</span>
192 <span class="gtkdoc opt">}</span></pre></td>
204 <div class="refsect2">
205 <a name="idp15836384"></a><h3>Two basic usage scenarios</h3>
207 There are two basic usage scenarios: in the simplest case, the application
208 knows exactly what particular element is used for video output, which is
209 usually the case when the application creates the videosink to use
210 (e.g. <span class="type">xvimagesink</span>, <span class="type">ximagesink</span>, etc.) itself; in this case, the application
211 can just create the videosink element, create and realize the window to
212 render the video on and then call <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-set-window-handle" title="gst_x_overlay_set_window_handle ()"><code class="function">gst_x_overlay_set_window_handle()</code></a> directly
213 with the XID or native window handle, before starting up the pipeline.
216 In the other and more common case, the application does not know in advance
217 what GStreamer video sink element will be used for video output. This is
218 usually the case when an element such as <span class="type">autovideosink</span> or <span class="type">gconfvideosink</span>
219 is used. In this case, the video sink element itself is created
220 asynchronously from a GStreamer streaming thread some time after the
221 pipeline has been started up. When that happens, however, the video sink
222 will need to know right then whether to render onto an already existing
223 application window or whether to create its own window. This is when it
224 posts a prepare-xwindow-id message, and that is also why this message needs
225 to be handled in a sync bus handler which will be called from the streaming
226 thread directly (because the video sink will need an answer right then).
229 As response to the prepare-xwindow-id element message in the bus sync
230 handler, the application may use <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-set-window-handle" title="gst_x_overlay_set_window_handle ()"><code class="function">gst_x_overlay_set_window_handle()</code></a> to tell
231 the video sink to render onto an existing window surface. At this point the
232 application should already have obtained the window handle / XID, so it
233 just needs to set it. It is generally not advisable to call any GUI toolkit
234 functions or window system functions from the streaming thread in which the
235 prepare-xwindow-id message is handled, because most GUI toolkits and
236 windowing systems are not thread-safe at all and a lot of care would be
237 required to co-ordinate the toolkit and window system calls of the
238 different threads (Gtk+ users please note: prior to Gtk+ 2.18
239 <a href="http://library.gnome.org/devel/gdk3/gdk-X-Window-System-Interaction.html#GDK-WINDOW-XID:CAPS"><code class="function">GDK_WINDOW_XID()</code></a> was just a simple structure access, so generally fine to do
240 within the bus sync handler; this macro was changed to a function call in
241 Gtk+ 2.18 and later, which is likely to cause problems when called from a
242 sync handler; see below for a better approach without <a href="http://library.gnome.org/devel/gdk3/gdk-X-Window-System-Interaction.html#GDK-WINDOW-XID:CAPS"><code class="function">GDK_WINDOW_XID()</code></a>
243 used in the callback).
249 <div class="refsect2">
250 <a name="idp15848544"></a><h3>GstXOverlay and Gtk+</h3>
253 <div class="informalexample">
254 <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
257 <td class="listing_lines" align="right"><pre>1
339 <td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc">#include <gtk/gtk.h></span>
340 <span class="gtkdoc ppc">#ifdef GDK_WINDOWING_X11</span>
341 <span class="gtkdoc ppc">#include <gdk/gdkx.h></span> <span class="gtkdoc slc">// for GDK_WINDOW_XID</span>
342 <span class="gtkdoc ppc"></span><span class="gtkdoc ppc">#endif</span>
343 <span class="gtkdoc opt">...</span>
344 <span class="gtkdoc kwb">static</span> gulong video_window_xid <span class="gtkdoc opt">=</span> <span class="number">0</span><span class="gtkdoc opt">;</span>
345 <span class="gtkdoc opt">...</span>
346 <span class="gtkdoc kwb">static</span> GstBusSyncReply
347 <span class="function">bus_sync_handler</span> <span class="gtkdoc opt">(</span>GstBus <span class="gtkdoc opt">*</span> bus<span class="gtkdoc opt">,</span> GstMessage <span class="gtkdoc opt">*</span> message<span class="gtkdoc opt">,</span> gpointer user_data<span class="gtkdoc opt">)</span>
348 <span class="gtkdoc opt">{</span>
349 <span class="gtkdoc slc">// ignore anything but 'prepare-xwindow-id' element messages</span>
350 <span class="keyword">if</span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstMessage.html#GST-MESSAGE-TYPE:CAPS">GST_MESSAGE_TYPE</a></span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">) !=</span> GST_MESSAGE_ELEMENT<span class="gtkdoc opt">)</span>
351 <span class="keyword">return</span> GST_BUS_PASS<span class="gtkdoc opt">;</span>
352 <span class="keyword">if</span> <span class="gtkdoc opt">(!</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstStructure.html#gst-structure-has-name">gst_structure_has_name</a></span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">-></span>structure<span class="gtkdoc opt">,</span> <span class="string">"prepare-xwindow-id"</span><span class="gtkdoc opt">))</span>
353 <span class="keyword">return</span> GST_BUS_PASS<span class="gtkdoc opt">;</span>
355 <span class="keyword">if</span> <span class="gtkdoc opt">(</span>video_window_xid <span class="gtkdoc opt">!=</span> <span class="number">0</span><span class="gtkdoc opt">) {</span>
356 GstXOverlay <span class="gtkdoc opt">*</span>xoverlay<span class="gtkdoc opt">;</span>
358 <span class="gtkdoc slc">// GST_MESSAGE_SRC (message) will be the video sink element</span>
359 xoverlay <span class="gtkdoc opt">=</span> <span class="function">GST_X_OVERLAY</span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstMessage.html#GST-MESSAGE-SRC:CAPS">GST_MESSAGE_SRC</a></span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">));</span>
360 <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-set-window-handle">gst_x_overlay_set_window_handle</a></span> <span class="gtkdoc opt">(</span>xoverlay<span class="gtkdoc opt">,</span> video_window_xid<span class="gtkdoc opt">);</span>
361 <span class="gtkdoc opt">}</span> <span class="keyword">else</span> <span class="gtkdoc opt">{</span>
362 <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Message-Logging.html#g-warning">g_warning</a></span> <span class="gtkdoc opt">(</span><span class="string">"Should have obtained video_window_xid by now!"</span><span class="gtkdoc opt">);</span>
363 <span class="gtkdoc opt">}</span>
365 <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstMessage.html#gst-message-unref">gst_message_unref</a></span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">);</span>
366 <span class="keyword">return</span> GST_BUS_DROP<span class="gtkdoc opt">;</span>
367 <span class="gtkdoc opt">}</span>
368 <span class="gtkdoc opt">...</span>
369 <span class="gtkdoc kwb">static void</span>
370 <span class="function">video_widget_realize_cb</span> <span class="gtkdoc opt">(</span>GtkWidget <span class="gtkdoc opt">*</span> widget<span class="gtkdoc opt">,</span> gpointer data<span class="gtkdoc opt">)</span>
371 <span class="gtkdoc opt">{</span>
372 <span class="gtkdoc ppc">#if GTK_CHECK_VERSION(2,18,0)</span>
373 <span class="gtkdoc slc">// This is here just for pedagogical purposes, GDK_WINDOW_XID will call</span>
374 <span class="gtkdoc slc">// it as well in newer Gtk versions</span>
375 <span class="keyword">if</span> <span class="gtkdoc opt">(!</span><span class="function"><a href="http://library.gnome.org/devel/gdk3/gdk-Windows.html#gdk-window-ensure-native">gdk_window_ensure_native</a></span> <span class="gtkdoc opt">(</span>widget<span class="gtkdoc opt">-></span>window<span class="gtkdoc opt">))</span>
376 <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Message-Logging.html#g-error">g_error</a></span> <span class="gtkdoc opt">(</span><span class="string">"Couldn't create native window needed for GstXOverlay!"</span><span class="gtkdoc opt">);</span>
377 <span class="gtkdoc ppc">#endif</span>
379 <span class="gtkdoc ppc">#ifdef GDK_WINDOWING_X11</span>
380 video_window_xid <span class="gtkdoc opt">=</span> <span class="function"><a href="http://library.gnome.org/devel/gdk3/gdk-X-Window-System-Interaction.html#GDK-WINDOW-XID:CAPS">GDK_WINDOW_XID</a></span> <span class="gtkdoc opt">(</span>video_window<span class="gtkdoc opt">-></span>window<span class="gtkdoc opt">);</span>
381 <span class="gtkdoc ppc">#endif</span>
382 <span class="gtkdoc opt">}</span>
383 <span class="gtkdoc opt">...</span>
384 <span class="gtkdoc kwb">int</span>
385 <span class="function">main</span> <span class="gtkdoc opt">(</span><span class="gtkdoc kwb">int</span> argc<span class="gtkdoc opt">,</span> <span class="gtkdoc kwb">char</span> <span class="gtkdoc opt">**</span>argv<span class="gtkdoc opt">)</span>
386 <span class="gtkdoc opt">{</span>
387 GtkWidget <span class="gtkdoc opt">*</span>video_window<span class="gtkdoc opt">;</span>
388 GtkWidget <span class="gtkdoc opt">*</span>app_window<span class="gtkdoc opt">;</span>
389 <span class="gtkdoc opt">...</span>
390 app_window <span class="gtkdoc opt">=</span> <span class="function"><a href="http://library.gnome.org/devel/gtk3/GtkWindow.html#gtk-window-new">gtk_window_new</a></span> <span class="gtkdoc opt">(</span>GTK_WINDOW_TOPLEVEL<span class="gtkdoc opt">);</span>
391 <span class="gtkdoc opt">...</span>
392 video_window <span class="gtkdoc opt">=</span> <span class="function"><a href="http://library.gnome.org/devel/gtk3/GtkDrawingArea.html#gtk-drawing-area-new">gtk_drawing_area_new</a></span> <span class="gtkdoc opt">();</span>
393 <span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#g-signal-connect">g_signal_connect</a></span> <span class="gtkdoc opt">(</span>video_window<span class="gtkdoc opt">,</span> <span class="string">"realize"</span><span class="gtkdoc opt">,</span>
394 <span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Closures.html#G-CALLBACK:CAPS">G_CALLBACK</a></span> <span class="gtkdoc opt">(</span>video_widget_realize_cb<span class="gtkdoc opt">),</span> NULL<span class="gtkdoc opt">);</span>
395 <span class="function"><a href="http://library.gnome.org/devel/gtk3/GtkWidget.html#gtk-widget-set-double-buffered">gtk_widget_set_double_buffered</a></span> <span class="gtkdoc opt">(</span>video_window<span class="gtkdoc opt">,</span> FALSE<span class="gtkdoc opt">);</span>
396 <span class="gtkdoc opt">...</span>
397 <span class="gtkdoc slc">// usually the video_window will not be directly embedded into the</span>
398 <span class="gtkdoc slc">// application window like this, but there will be many other widgets</span>
399 <span class="gtkdoc slc">// and the video window will be embedded in one of them instead</span>
400 <span class="function"><a href="http://library.gnome.org/devel/gtk3/GtkContainer.html#gtk-container-add">gtk_container_add</a></span> <span class="gtkdoc opt">(</span><span class="function">GTK_CONTAINER</span> <span class="gtkdoc opt">(</span>ap_window<span class="gtkdoc opt">),</span> video_window<span class="gtkdoc opt">);</span>
401 <span class="gtkdoc opt">...</span>
402 <span class="gtkdoc slc">// show the GUI</span>
403 <span class="function"><a href="http://library.gnome.org/devel/gtk3/GtkWidget.html#gtk-widget-show-all">gtk_widget_show_all</a></span> <span class="gtkdoc opt">(</span>app_window<span class="gtkdoc opt">);</span>
405 <span class="gtkdoc slc">// realize window now so that the video window gets created and we can</span>
406 <span class="gtkdoc slc">// obtain its XID before the pipeline is started up and the videosink</span>
407 <span class="gtkdoc slc">// asks for the XID of the window to render onto</span>
408 <span class="function"><a href="http://library.gnome.org/devel/gtk3/GtkWidget.html#gtk-widget-realize">gtk_widget_realize</a></span> <span class="gtkdoc opt">(</span>window<span class="gtkdoc opt">);</span>
410 <span class="gtkdoc slc">// we should have the XID now</span>
411 <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span> <span class="gtkdoc opt">(</span>video_window_xid <span class="gtkdoc opt">!=</span> <span class="number">0</span><span class="gtkdoc opt">);</span>
412 <span class="gtkdoc opt">...</span>
413 <span class="gtkdoc slc">// set up sync handler for setting the xid once the pipeline is started</span>
414 bus <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPipeline.html#gst-pipeline-get-bus">gst_pipeline_get_bus</a></span> <span class="gtkdoc opt">(</span><span class="function">GST_PIPELINE</span> <span class="gtkdoc opt">(</span>pipeline<span class="gtkdoc opt">));</span>
415 <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html#gst-bus-set-sync-handler">gst_bus_set_sync_handler</a></span> <span class="gtkdoc opt">(</span>bus<span class="gtkdoc opt">, (</span>GstBusSyncHandler<span class="gtkdoc opt">)</span> bus_sync_handler<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
416 <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html#gst-object-unref">gst_object_unref</a></span> <span class="gtkdoc opt">(</span>bus<span class="gtkdoc opt">);</span>
417 <span class="gtkdoc opt">...</span>
418 <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-set-state">gst_element_set_state</a></span> <span class="gtkdoc opt">(</span>pipeline<span class="gtkdoc opt">,</span> GST_STATE_PLAYING<span class="gtkdoc opt">);</span>
419 <span class="gtkdoc opt">...</span>
420 <span class="gtkdoc opt">}</span></pre></td>
432 <div class="refsect2">
433 <a name="idp15853312"></a><h3>GstXOverlay and Qt</h3>
436 <div class="informalexample">
437 <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
440 <td class="listing_lines" align="right"><pre>1
493 <td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc">#include <glib.h></span>
494 <span class="gtkdoc ppc">#include <gst/gst.h></span>
495 <span class="gtkdoc ppc">#include <gst/interfaces/xoverlay.h></span>
497 <span class="gtkdoc ppc">#include <QApplication></span>
498 <span class="gtkdoc ppc">#include <QTimer></span>
499 <span class="gtkdoc ppc">#include <QWidget></span>
501 <span class="gtkdoc kwb">int</span> <span class="function">main</span><span class="gtkdoc opt">(</span><span class="gtkdoc kwb">int</span> argc<span class="gtkdoc opt">,</span> <span class="gtkdoc kwb">char</span> <span class="gtkdoc opt">*</span>argv<span class="gtkdoc opt">[])</span>
502 <span class="gtkdoc opt">{</span>
503 <span class="keyword">if</span> <span class="gtkdoc opt">(!</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Threads.html#g-thread-supported">g_thread_supported</a></span> <span class="gtkdoc opt">())</span>
504 <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Threads.html#g-thread-init">g_thread_init</a></span> <span class="gtkdoc opt">(</span>NULL<span class="gtkdoc opt">);</span>
506 <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-Gst.html#gst-init">gst_init</a></span> <span class="gtkdoc opt">(&</span>argc<span class="gtkdoc opt">, &</span>argv<span class="gtkdoc opt">);</span>
507 QApplication <span class="function">app</span><span class="gtkdoc opt">(</span>argc<span class="gtkdoc opt">,</span> argv<span class="gtkdoc opt">);</span>
508 app<span class="gtkdoc opt">.</span><span class="function">connect</span><span class="gtkdoc opt">(&</span>app<span class="gtkdoc opt">,</span> <span class="function">SIGNAL</span><span class="gtkdoc opt">(</span><span class="function">lastWindowClosed</span><span class="gtkdoc opt">()), &</span>app<span class="gtkdoc opt">,</span> <span class="function">SLOT</span><span class="gtkdoc opt">(</span><span class="function">quit</span> <span class="gtkdoc opt">()));</span>
510 <span class="gtkdoc slc">// prepare the pipeline</span>
512 GstElement <span class="gtkdoc opt">*</span>pipeline <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPipeline.html#gst-pipeline-new">gst_pipeline_new</a></span> <span class="gtkdoc opt">(</span><span class="string">"xvoverlay"</span><span class="gtkdoc opt">);</span>
513 GstElement <span class="gtkdoc opt">*</span>src <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElementFactory.html#gst-element-factory-make">gst_element_factory_make</a></span> <span class="gtkdoc opt">(</span><span class="string">"videotestsrc"</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
514 GstElement <span class="gtkdoc opt">*</span>sink <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElementFactory.html#gst-element-factory-make">gst_element_factory_make</a></span> <span class="gtkdoc opt">(</span><span class="string">"xvimagesink"</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
515 <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBin.html#gst-bin-add-many">gst_bin_add_many</a></span> <span class="gtkdoc opt">(</span><span class="function">GST_BIN</span> <span class="gtkdoc opt">(</span>pipeline<span class="gtkdoc opt">),</span> src<span class="gtkdoc opt">,</span> sink<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
516 <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-link">gst_element_link</a></span> <span class="gtkdoc opt">(</span>src<span class="gtkdoc opt">,</span> sink<span class="gtkdoc opt">);</span>
518 <span class="gtkdoc slc">// prepare the ui</span>
520 QWidget window<span class="gtkdoc opt">;</span>
521 window<span class="gtkdoc opt">.</span><span class="function">resize</span><span class="gtkdoc opt">(</span><span class="number">320</span><span class="gtkdoc opt">,</span> <span class="number">240</span><span class="gtkdoc opt">);</span>
522 window<span class="gtkdoc opt">.</span><span class="function">show</span><span class="gtkdoc opt">();</span>
524 WId xwinid <span class="gtkdoc opt">=</span> window<span class="gtkdoc opt">.</span><span class="function">winId</span><span class="gtkdoc opt">();</span>
525 <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-set-window-handle">gst_x_overlay_set_window_handle</a></span> <span class="gtkdoc opt">(</span><span class="function">GST_X_OVERLAY</span> <span class="gtkdoc opt">(</span>sink<span class="gtkdoc opt">),</span> xwinid<span class="gtkdoc opt">);</span>
527 <span class="gtkdoc slc">// run the pipeline</span>
529 GstStateChangeReturn sret <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-set-state">gst_element_set_state</a></span> <span class="gtkdoc opt">(</span>pipeline<span class="gtkdoc opt">,</span>
530 GST_STATE_PLAYING<span class="gtkdoc opt">);</span>
531 <span class="keyword">if</span> <span class="gtkdoc opt">(</span>sret <span class="gtkdoc opt">==</span> GST_STATE_CHANGE_FAILURE<span class="gtkdoc opt">) {</span>
532 <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-set-state">gst_element_set_state</a></span> <span class="gtkdoc opt">(</span>pipeline<span class="gtkdoc opt">,</span> GST_STATE_NULL<span class="gtkdoc opt">);</span>
533 <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html#gst-object-unref">gst_object_unref</a></span> <span class="gtkdoc opt">(</span>pipeline<span class="gtkdoc opt">);</span>
534 <span class="gtkdoc slc">// Exit application</span>
535 QTimer<span class="gtkdoc opt">::</span><span class="function">singleShot</span><span class="gtkdoc opt">(</span><span class="number">0</span><span class="gtkdoc opt">,</span> QApplication<span class="gtkdoc opt">::</span><span class="function">activeWindow</span><span class="gtkdoc opt">(),</span> <span class="function">SLOT</span><span class="gtkdoc opt">(</span><span class="function">quit</span><span class="gtkdoc opt">()));</span>
536 <span class="gtkdoc opt">}</span>
538 <span class="gtkdoc kwb">int</span> ret <span class="gtkdoc opt">=</span> app<span class="gtkdoc opt">.</span><span class="function">exec</span><span class="gtkdoc opt">();</span>
540 window<span class="gtkdoc opt">.</span><span class="function">hide</span><span class="gtkdoc opt">();</span>
541 <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-set-state">gst_element_set_state</a></span> <span class="gtkdoc opt">(</span>pipeline<span class="gtkdoc opt">,</span> GST_STATE_NULL<span class="gtkdoc opt">);</span>
542 <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html#gst-object-unref">gst_object_unref</a></span> <span class="gtkdoc opt">(</span>pipeline<span class="gtkdoc opt">);</span>
544 <span class="keyword">return</span> ret<span class="gtkdoc opt">;</span>
545 <span class="gtkdoc opt">}</span></pre></td>
557 <div class="refsect1">
558 <a name="gst-plugins-base-libs-gstxoverlay.details"></a><h2>Details</h2>
559 <div class="refsect2">
560 <a name="GstXOverlay-struct"></a><h3>GstXOverlay</h3>
561 <pre class="programlisting">typedef struct _GstXOverlay GstXOverlay;</pre>
563 Opaque <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> data structure.
567 <div class="refsect2">
568 <a name="GstXOverlayClass"></a><h3>struct GstXOverlayClass</h3>
569 <pre class="programlisting">struct GstXOverlayClass {
570 GTypeInterface klass;
572 /* virtual functions */
573 #ifndef GST_DISABLE_DEPRECATED
574 void (* set_xwindow_id) (GstXOverlay *overlay,
577 void (* set_xwindow_id_disabled) (GstXOverlay *overlay,
579 #endif /* not GST_DISABLE_DEPRECATED */
581 void (* expose) (GstXOverlay *overlay);
583 void (* handle_events) (GstXOverlay *overlay,
584 gboolean handle_events);
586 void (* set_render_rectangle) (GstXOverlay *overlay,
588 gint width, gint height);
590 void (* set_window_handle) (GstXOverlay *overlay,
595 <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> interface
597 <div class="variablelist"><table border="0">
598 <col align="left" valign="top">
601 <td><p><span class="term"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Type-Information.html#GTypeInterface"><span class="type">GTypeInterface</span></a> <em class="structfield"><code><a name="GstXOverlayClass.klass"></a>klass</code></em>;</span></p></td>
602 <td>parent interface type.</td>
605 <td><p><span class="term"><em class="structfield"><code><a name="GstXOverlayClass.set-xwindow-id"></a>set_xwindow_id</code></em> ()</span></p></td>
606 <td>virtual method to configure the XWindow id</td>
609 <td><p><span class="term"><em class="structfield"><code><a name="GstXOverlayClass.set-xwindow-id-disabled"></a>set_xwindow_id_disabled</code></em> ()</span></p></td>
613 <td><p><span class="term"><em class="structfield"><code><a name="GstXOverlayClass.expose"></a>expose</code></em> ()</span></p></td>
614 <td>virtual method to handle expose events</td>
617 <td><p><span class="term"><em class="structfield"><code><a name="GstXOverlayClass.handle-events"></a>handle_events</code></em> ()</span></p></td>
618 <td>virtual method to handle events</td>
621 <td><p><span class="term"><em class="structfield"><code><a name="GstXOverlayClass.set-render-rectangle"></a>set_render_rectangle</code></em> ()</span></p></td>
622 <td>virtual method to set the render rectangle (since 0.10.29)</td>
625 <td><p><span class="term"><em class="structfield"><code><a name="GstXOverlayClass.set-window-handle"></a>set_window_handle</code></em> ()</span></p></td>
632 <div class="refsect2">
633 <a name="gst-x-overlay-set-xwindow-id"></a><h3>gst_x_overlay_set_xwindow_id ()</h3>
634 <pre class="programlisting"><span class="returnvalue">void</span> gst_x_overlay_set_xwindow_id (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> *overlay</code></em>,
635 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> xwindow_id</code></em>);</pre>
636 <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
637 <h3 class="title">Warning</h3>
638 <p><code class="literal">gst_x_overlay_set_xwindow_id</code> is deprecated and should not be used in newly-written code. Use <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-set-window-handle" title="gst_x_overlay_set_window_handle ()"><code class="function">gst_x_overlay_set_window_handle()</code></a> instead.</p>
641 This will call the video overlay's set_xwindow_id method. You should
642 use this method to tell to a XOverlay to display video output to a
643 specific XWindow. Passing 0 as the xwindow_id will tell the overlay to
644 stop using that window and create an internal one.
646 <div class="variablelist"><table border="0">
647 <col align="left" valign="top">
650 <td><p><span class="term"><em class="parameter"><code>overlay</code></em> :</span></p></td>
651 <td>a <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> to set the XWindow on.</td>
654 <td><p><span class="term"><em class="parameter"><code>xwindow_id</code></em> :</span></p></td>
655 <td>a <span class="type">XID</span> referencing the XWindow.</td>
661 <div class="refsect2">
662 <a name="gst-x-overlay-got-xwindow-id"></a><h3>gst_x_overlay_got_xwindow_id ()</h3>
663 <pre class="programlisting"><span class="returnvalue">void</span> gst_x_overlay_got_xwindow_id (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> *overlay</code></em>,
664 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> xwindow_id</code></em>);</pre>
665 <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
666 <h3 class="title">Warning</h3>
667 <p><code class="literal">gst_x_overlay_got_xwindow_id</code> is deprecated and should not be used in newly-written code. Use <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-got-window-handle" title="gst_x_overlay_got_window_handle ()"><code class="function">gst_x_overlay_got_window_handle()</code></a> instead.</p>
670 This will post a "have-xwindow-id" element message on the bus.
673 This function should only be used by video overlay plugin developers.
675 <div class="variablelist"><table border="0">
676 <col align="left" valign="top">
679 <td><p><span class="term"><em class="parameter"><code>overlay</code></em> :</span></p></td>
680 <td>a <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> which got a XWindow.</td>
683 <td><p><span class="term"><em class="parameter"><code>xwindow_id</code></em> :</span></p></td>
684 <td>a <span class="type">XID</span> referencing the XWindow.</td>
690 <div class="refsect2">
691 <a name="gst-x-overlay-got-window-handle"></a><h3>gst_x_overlay_got_window_handle ()</h3>
692 <pre class="programlisting"><span class="returnvalue">void</span> gst_x_overlay_got_window_handle (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> *overlay</code></em>,
693 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guintptr"><span class="type">guintptr</span></a> handle</code></em>);</pre>
695 This will post a "have-xwindow-id" element message on the bus.
698 This function should only be used by video overlay plugin developers.
700 <div class="variablelist"><table border="0">
701 <col align="left" valign="top">
704 <td><p><span class="term"><em class="parameter"><code>overlay</code></em> :</span></p></td>
705 <td>a <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> which got a window</td>
708 <td><p><span class="term"><em class="parameter"><code>handle</code></em> :</span></p></td>
709 <td>a platform-specific handle referencing the window</td>
715 <div class="refsect2">
716 <a name="gst-x-overlay-set-window-handle"></a><h3>gst_x_overlay_set_window_handle ()</h3>
717 <pre class="programlisting"><span class="returnvalue">void</span> gst_x_overlay_set_window_handle (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> *overlay</code></em>,
718 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guintptr"><span class="type">guintptr</span></a> handle</code></em>);</pre>
720 This will call the video overlay's set_window_handle method. You
721 should use this method to tell to a XOverlay to display video output to a
722 specific XWindow. Passing 0 as the xwindow_id will tell the overlay to
723 stop using that window and create an internal one.
725 <div class="variablelist"><table border="0">
726 <col align="left" valign="top">
729 <td><p><span class="term"><em class="parameter"><code>overlay</code></em> :</span></p></td>
730 <td>a <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> to set the XWindow on.</td>
733 <td><p><span class="term"><em class="parameter"><code>xwindow_id</code></em> :</span></p></td>
734 <td>a <span class="type">XID</span> referencing the XWindow.</td>
738 <p class="since">Since 0.10.31</p>
741 <div class="refsect2">
742 <a name="gst-x-overlay-prepare-xwindow-id"></a><h3>gst_x_overlay_prepare_xwindow_id ()</h3>
743 <pre class="programlisting"><span class="returnvalue">void</span> gst_x_overlay_prepare_xwindow_id (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> *overlay</code></em>);</pre>
745 This will post a "prepare-xwindow-id" element message on the bus
746 to give applications an opportunity to call
747 <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-set-xwindow-id" title="gst_x_overlay_set_xwindow_id ()"><code class="function">gst_x_overlay_set_xwindow_id()</code></a> before a plugin creates its own
751 This function should only be used by video overlay plugin developers.
753 <div class="variablelist"><table border="0">
754 <col align="left" valign="top">
756 <td><p><span class="term"><em class="parameter"><code>overlay</code></em> :</span></p></td>
757 <td>a <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> which does not yet have an XWindow.</td>
762 <div class="refsect2">
763 <a name="gst-x-overlay-expose"></a><h3>gst_x_overlay_expose ()</h3>
764 <pre class="programlisting"><span class="returnvalue">void</span> gst_x_overlay_expose (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> *overlay</code></em>);</pre>
766 Tell an overlay that it has been exposed. This will redraw the current frame
767 in the drawable even if the pipeline is PAUSED.
769 <div class="variablelist"><table border="0">
770 <col align="left" valign="top">
772 <td><p><span class="term"><em class="parameter"><code>overlay</code></em> :</span></p></td>
773 <td>a <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> to expose.</td>
778 <div class="refsect2">
779 <a name="gst-x-overlay-handle-events"></a><h3>gst_x_overlay_handle_events ()</h3>
780 <pre class="programlisting"><span class="returnvalue">void</span> gst_x_overlay_handle_events (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> *overlay</code></em>,
781 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> handle_events</code></em>);</pre>
783 Tell an overlay that it should handle events from the window system. These
784 events are forwared upstream as navigation events. In some window system,
785 events are not propagated in the window hierarchy if a client is listening
786 for them. This method allows you to disable events handling completely
789 <div class="variablelist"><table border="0">
790 <col align="left" valign="top">
793 <td><p><span class="term"><em class="parameter"><code>overlay</code></em> :</span></p></td>
794 <td>a <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> to expose.</td>
797 <td><p><span class="term"><em class="parameter"><code>handle_events</code></em> :</span></p></td>
798 <td>a <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> indicating if events should be handled or not.</td>
802 <p class="since">Since 0.10.12</p>
805 <div class="refsect2">
806 <a name="gst-x-overlay-set-render-rectangle"></a><h3>gst_x_overlay_set_render_rectangle ()</h3>
807 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gst_x_overlay_set_render_rectangle (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> *overlay</code></em>,
808 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> x</code></em>,
809 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> y</code></em>,
810 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>,
811 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>);</pre>
813 Configure a subregion as a video target within the window set by
814 <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-set-window-handle" title="gst_x_overlay_set_window_handle ()"><code class="function">gst_x_overlay_set_window_handle()</code></a>. If this is not used or not supported
815 the video will fill the area of the window set as the overlay to 100%.
816 By specifying the rectangle, the video can be overlayed to a specific region
817 of that window only. After setting the new rectangle one should call
818 <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-expose" title="gst_x_overlay_expose ()"><code class="function">gst_x_overlay_expose()</code></a> to force a redraw. To unset the region pass -1 for
819 the <em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em> parameters.
822 This method is needed for non fullscreen video overlay in UI toolkits that
823 do not support subwindows.
825 <div class="variablelist"><table border="0">
826 <col align="left" valign="top">
829 <td><p><span class="term"><em class="parameter"><code>overlay</code></em> :</span></p></td>
830 <td>a <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a>
834 <td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
835 <td>the horizontal offset of the render area inside the window</td>
838 <td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
839 <td>the vertical offset of the render area inside the window</td>
842 <td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
843 <td>the width of the render area inside the window</td>
846 <td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
847 <td>the height of the render area inside the window</td>
850 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
852 <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if not supported by the sink.</td>
856 <p class="since">Since 0.10.29</p>
862 Generated by GTK-Doc V1.17</div>