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.76.1">
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.18 (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><span class="type">guintptr</span> 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><span class="type">guintptr</span> 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="idp17754944"></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="idp17764272"></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/gdk/gdk3-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/gdk/gdk3-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="idp17776432"></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
340 <td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc">#include <gst/interfaces/xoverlay.h></span>
341 <span class="gtkdoc ppc">#include <gtk/gtk.h></span>
342 <span class="gtkdoc ppc">#ifdef GDK_WINDOWING_X11</span>
343 <span class="gtkdoc ppc">#include <gdk/gdkx.h></span> <span class="gtkdoc slc">// for GDK_WINDOW_XID</span>
344 <span class="gtkdoc ppc"></span><span class="gtkdoc ppc">#endif</span>
345 <span class="gtkdoc opt">...</span>
346 <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>
347 <span class="gtkdoc opt">...</span>
348 <span class="gtkdoc kwb">static</span> GstBusSyncReply
349 <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>
350 <span class="gtkdoc opt">{</span>
351 <span class="gtkdoc slc">// ignore anything but 'prepare-xwindow-id' element messages</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-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>
353 <span class="keyword">return</span> GST_BUS_PASS<span class="gtkdoc opt">;</span>
354 <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>
355 <span class="keyword">return</span> GST_BUS_PASS<span class="gtkdoc opt">;</span>
357 <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>
358 GstXOverlay <span class="gtkdoc opt">*</span>xoverlay<span class="gtkdoc opt">;</span>
360 <span class="gtkdoc slc">// GST_MESSAGE_SRC (message) will be the video sink element</span>
361 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>
362 <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>
363 <span class="gtkdoc opt">}</span> <span class="keyword">else</span> <span class="gtkdoc opt">{</span>
364 <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>
365 <span class="gtkdoc opt">}</span>
367 <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>
368 <span class="keyword">return</span> GST_BUS_DROP<span class="gtkdoc opt">;</span>
369 <span class="gtkdoc opt">}</span>
370 <span class="gtkdoc opt">...</span>
371 <span class="gtkdoc kwb">static void</span>
372 <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>
373 <span class="gtkdoc opt">{</span>
374 <span class="gtkdoc ppc">#if GTK_CHECK_VERSION(2,18,0)</span>
375 <span class="gtkdoc slc">// This is here just for pedagogical purposes, GDK_WINDOW_XID will call</span>
376 <span class="gtkdoc slc">// it as well in newer Gtk versions</span>
377 <span class="keyword">if</span> <span class="gtkdoc opt">(!</span><span class="function"><a href="http://library.gnome.org/devel/gdk/gdk3-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>
378 <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>
379 <span class="gtkdoc ppc">#endif</span>
381 <span class="gtkdoc ppc">#ifdef GDK_WINDOWING_X11</span>
382 video_window_xid <span class="gtkdoc opt">=</span> <span class="function"><a href="http://library.gnome.org/devel/gdk/gdk3-X-Window-System-Interaction.html#GDK-WINDOW-XID:CAPS">GDK_WINDOW_XID</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://library.gnome.org/devel/gtk/GtkWidget.html#gtk-widget-get-window">gtk_widget_get_window</a></span> <span class="gtkdoc opt">(</span>video_window<span class="gtkdoc opt">));</span>
383 <span class="gtkdoc ppc">#endif</span>
384 <span class="gtkdoc opt">}</span>
385 <span class="gtkdoc opt">...</span>
386 <span class="gtkdoc kwb">int</span>
387 <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>
388 <span class="gtkdoc opt">{</span>
389 GtkWidget <span class="gtkdoc opt">*</span>video_window<span class="gtkdoc opt">;</span>
390 GtkWidget <span class="gtkdoc opt">*</span>app_window<span class="gtkdoc opt">;</span>
391 <span class="gtkdoc opt">...</span>
392 app_window <span class="gtkdoc opt">=</span> <span class="function"><a href="http://library.gnome.org/devel/gtk/GtkWindow.html#gtk-window-new">gtk_window_new</a></span> <span class="gtkdoc opt">(</span>GTK_WINDOW_TOPLEVEL<span class="gtkdoc opt">);</span>
393 <span class="gtkdoc opt">...</span>
394 video_window <span class="gtkdoc opt">=</span> <span class="function"><a href="http://library.gnome.org/devel/gtk/GtkDrawingArea.html#gtk-drawing-area-new">gtk_drawing_area_new</a></span> <span class="gtkdoc opt">();</span>
395 <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>
396 <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>
397 <span class="function"><a href="http://library.gnome.org/devel/gtk/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>
398 <span class="gtkdoc opt">...</span>
399 <span class="gtkdoc slc">// usually the video_window will not be directly embedded into the</span>
400 <span class="gtkdoc slc">// application window like this, but there will be many other widgets</span>
401 <span class="gtkdoc slc">// and the video window will be embedded in one of them instead</span>
402 <span class="function"><a href="http://library.gnome.org/devel/gtk/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>
403 <span class="gtkdoc opt">...</span>
404 <span class="gtkdoc slc">// show the GUI</span>
405 <span class="function"><a href="http://library.gnome.org/devel/gtk/GtkWidget.html#gtk-widget-show-all">gtk_widget_show_all</a></span> <span class="gtkdoc opt">(</span>app_window<span class="gtkdoc opt">);</span>
407 <span class="gtkdoc slc">// realize window now so that the video window gets created and we can</span>
408 <span class="gtkdoc slc">// obtain its XID before the pipeline is started up and the videosink</span>
409 <span class="gtkdoc slc">// asks for the XID of the window to render onto</span>
410 <span class="function"><a href="http://library.gnome.org/devel/gtk/GtkWidget.html#gtk-widget-realize">gtk_widget_realize</a></span> <span class="gtkdoc opt">(</span>video_window<span class="gtkdoc opt">);</span>
412 <span class="gtkdoc slc">// we should have the XID now</span>
413 <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>
414 <span class="gtkdoc opt">...</span>
415 <span class="gtkdoc slc">// set up sync handler for setting the xid once the pipeline is started</span>
416 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>
417 <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>
418 <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>
419 <span class="gtkdoc opt">...</span>
420 <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>
421 <span class="gtkdoc opt">...</span>
422 <span class="gtkdoc opt">}</span></pre></td>
434 <div class="refsect2">
435 <a name="idp17781264"></a><h3>GstXOverlay and Qt</h3>
438 <div class="informalexample">
439 <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
442 <td class="listing_lines" align="right"><pre>1
495 <td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc">#include <glib.h></span>
496 <span class="gtkdoc ppc">#include <gst/gst.h></span>
497 <span class="gtkdoc ppc">#include <gst/interfaces/xoverlay.h></span>
499 <span class="gtkdoc ppc">#include <QApplication></span>
500 <span class="gtkdoc ppc">#include <QTimer></span>
501 <span class="gtkdoc ppc">#include <QWidget></span>
503 <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>
504 <span class="gtkdoc opt">{</span>
505 <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>
506 <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>
508 <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>
509 QApplication <span class="function">app</span><span class="gtkdoc opt">(</span>argc<span class="gtkdoc opt">,</span> argv<span class="gtkdoc opt">);</span>
510 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>
512 <span class="gtkdoc slc">// prepare the pipeline</span>
514 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>
515 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>
516 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>
517 <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>
518 <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>
520 <span class="gtkdoc slc">// prepare the ui</span>
522 QWidget window<span class="gtkdoc opt">;</span>
523 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>
524 window<span class="gtkdoc opt">.</span><span class="function">show</span><span class="gtkdoc opt">();</span>
526 WId xwinid <span class="gtkdoc opt">=</span> window<span class="gtkdoc opt">.</span><span class="function">winId</span><span class="gtkdoc opt">();</span>
527 <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>
529 <span class="gtkdoc slc">// run the pipeline</span>
531 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>
532 GST_STATE_PLAYING<span class="gtkdoc opt">);</span>
533 <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>
534 <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>
535 <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>
536 <span class="gtkdoc slc">// Exit application</span>
537 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>
538 <span class="gtkdoc opt">}</span>
540 <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>
542 window<span class="gtkdoc opt">.</span><span class="function">hide</span><span class="gtkdoc opt">();</span>
543 <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>
544 <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>
546 <span class="keyword">return</span> ret<span class="gtkdoc opt">;</span>
547 <span class="gtkdoc opt">}</span></pre></td>
559 <div class="refsect1">
560 <a name="gst-plugins-base-libs-gstxoverlay.details"></a><h2>Details</h2>
561 <div class="refsect2">
562 <a name="GstXOverlay-struct"></a><h3>GstXOverlay</h3>
563 <pre class="programlisting">typedef struct _GstXOverlay GstXOverlay;</pre>
565 Opaque <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> data structure.
569 <div class="refsect2">
570 <a name="GstXOverlayClass"></a><h3>struct GstXOverlayClass</h3>
571 <pre class="programlisting">struct GstXOverlayClass {
572 GTypeInterface klass;
574 /* virtual functions */
575 #ifndef GST_DISABLE_DEPRECATED
576 void (* set_xwindow_id) (GstXOverlay *overlay,
580 #endif /* not GST_DISABLE_DEPRECATED */
582 void (* expose) (GstXOverlay *overlay);
584 void (* handle_events) (GstXOverlay *overlay,
585 gboolean handle_events);
587 void (* set_render_rectangle) (GstXOverlay *overlay,
589 gint width, gint height);
591 void (* set_window_handle) (GstXOverlay *overlay,
596 <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> interface
598 <div class="variablelist"><table border="0">
599 <col align="left" valign="top">
602 <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>
603 <td>parent interface type.</td>
606 <td><p><span class="term"><em class="structfield"><code><a name="GstXOverlayClass.set-xwindow-id"></a>set_xwindow_id</code></em> ()</span></p></td>
607 <td>(deprecated) virtual method to configure the XWindow handle</td>
610 <td><p><span class="term"><em class="structfield"><code><a name="GstXOverlayClass.expose"></a>expose</code></em> ()</span></p></td>
611 <td>virtual method to handle expose events</td>
614 <td><p><span class="term"><em class="structfield"><code><a name="GstXOverlayClass.handle-events"></a>handle_events</code></em> ()</span></p></td>
615 <td>virtual method to handle events</td>
618 <td><p><span class="term"><em class="structfield"><code><a name="GstXOverlayClass.set-render-rectangle"></a>set_render_rectangle</code></em> ()</span></p></td>
619 <td>virtual method to set the render rectangle (since 0.10.29)</td>
622 <td><p><span class="term"><em class="structfield"><code><a name="GstXOverlayClass.set-window-handle"></a>set_window_handle</code></em> ()</span></p></td>
623 <td>virtual method to configure the window handle</td>
629 <div class="refsect2">
630 <a name="gst-x-overlay-set-xwindow-id"></a><h3>gst_x_overlay_set_xwindow_id ()</h3>
631 <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>,
632 <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>
633 <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
634 <h3 class="title">Warning</h3>
635 <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>
638 This will call the video overlay's set_xwindow_id method. You should
639 use this method to tell to a XOverlay to display video output to a
640 specific XWindow. Passing 0 as the <em class="parameter"><code>xwindow_id</code></em> will tell the overlay to
641 stop using that window and create an internal one.
643 <div class="variablelist"><table border="0">
644 <col align="left" valign="top">
647 <td><p><span class="term"><em class="parameter"><code>overlay</code></em> :</span></p></td>
648 <td>a <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> to set the window on.</td>
651 <td><p><span class="term"><em class="parameter"><code>xwindow_id</code></em> :</span></p></td>
652 <td>a XID referencing the XWindow.</td>
658 <div class="refsect2">
659 <a name="gst-x-overlay-got-xwindow-id"></a><h3>gst_x_overlay_got_xwindow_id ()</h3>
660 <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>,
661 <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>
662 <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
663 <h3 class="title">Warning</h3>
664 <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>
667 This will post a "have-xwindow-id" element message on the bus.
670 This function should only be used by video overlay plugin developers.
672 <div class="variablelist"><table border="0">
673 <col align="left" valign="top">
676 <td><p><span class="term"><em class="parameter"><code>overlay</code></em> :</span></p></td>
677 <td>a <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> which got a XWindow.</td>
680 <td><p><span class="term"><em class="parameter"><code>xwindow_id</code></em> :</span></p></td>
681 <td>a XID referencing the XWindow.</td>
687 <div class="refsect2">
688 <a name="gst-x-overlay-got-window-handle"></a><h3>gst_x_overlay_got_window_handle ()</h3>
689 <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>,
690 <em class="parameter"><code><span class="type">guintptr</span> handle</code></em>);</pre>
692 This will post a "have-xwindow-id" element message on the bus.
695 This function should only be used by video overlay plugin developers.
697 <div class="variablelist"><table border="0">
698 <col align="left" valign="top">
701 <td><p><span class="term"><em class="parameter"><code>overlay</code></em> :</span></p></td>
702 <td>a <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> which got a window</td>
705 <td><p><span class="term"><em class="parameter"><code>handle</code></em> :</span></p></td>
706 <td>a platform-specific handle referencing the window</td>
712 <div class="refsect2">
713 <a name="gst-x-overlay-set-window-handle"></a><h3>gst_x_overlay_set_window_handle ()</h3>
714 <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>,
715 <em class="parameter"><code><span class="type">guintptr</span> handle</code></em>);</pre>
717 This will call the video overlay's set_window_handle method. You
718 should use this method to tell to a XOverlay to display video output to a
719 specific window (e.g. an XWindow on X11). Passing 0 as the <em class="parameter"><code>handle</code></em> will
720 tell the overlay to stop using that window and create an internal one.
722 <div class="variablelist"><table border="0">
723 <col align="left" valign="top">
726 <td><p><span class="term"><em class="parameter"><code>overlay</code></em> :</span></p></td>
727 <td>a <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> to set the window on.</td>
730 <td><p><span class="term"><em class="parameter"><code>handle</code></em> :</span></p></td>
731 <td>a handle referencing the window.</td>
735 <p class="since">Since 0.10.31</p>
738 <div class="refsect2">
739 <a name="gst-x-overlay-prepare-xwindow-id"></a><h3>gst_x_overlay_prepare_xwindow_id ()</h3>
740 <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>
742 This will post a "prepare-xwindow-id" element message on the bus
743 to give applications an opportunity to call
744 <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
748 This function should only be used by video overlay plugin developers.
750 <div class="variablelist"><table border="0">
751 <col align="left" valign="top">
753 <td><p><span class="term"><em class="parameter"><code>overlay</code></em> :</span></p></td>
754 <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>
759 <div class="refsect2">
760 <a name="gst-x-overlay-expose"></a><h3>gst_x_overlay_expose ()</h3>
761 <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>
763 Tell an overlay that it has been exposed. This will redraw the current frame
764 in the drawable even if the pipeline is PAUSED.
766 <div class="variablelist"><table border="0">
767 <col align="left" valign="top">
769 <td><p><span class="term"><em class="parameter"><code>overlay</code></em> :</span></p></td>
770 <td>a <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> to expose.</td>
775 <div class="refsect2">
776 <a name="gst-x-overlay-handle-events"></a><h3>gst_x_overlay_handle_events ()</h3>
777 <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>,
778 <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>
780 Tell an overlay that it should handle events from the window system. These
781 events are forwarded upstream as navigation events. In some window system,
782 events are not propagated in the window hierarchy if a client is listening
783 for them. This method allows you to disable events handling completely
786 <div class="variablelist"><table border="0">
787 <col align="left" valign="top">
790 <td><p><span class="term"><em class="parameter"><code>overlay</code></em> :</span></p></td>
791 <td>a <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> to expose.</td>
794 <td><p><span class="term"><em class="parameter"><code>handle_events</code></em> :</span></p></td>
795 <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>
799 <p class="since">Since 0.10.12</p>
802 <div class="refsect2">
803 <a name="gst-x-overlay-set-render-rectangle"></a><h3>gst_x_overlay_set_render_rectangle ()</h3>
804 <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>,
805 <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>,
806 <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>,
807 <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>,
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> height</code></em>);</pre>
810 Configure a subregion as a video target within the window set by
811 <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
812 the video will fill the area of the window set as the overlay to 100%.
813 By specifying the rectangle, the video can be overlayed to a specific region
814 of that window only. After setting the new rectangle one should call
815 <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
816 the <em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em> parameters.
819 This method is needed for non fullscreen video overlay in UI toolkits that
820 do not support subwindows.
822 <div class="variablelist"><table border="0">
823 <col align="left" valign="top">
826 <td><p><span class="term"><em class="parameter"><code>overlay</code></em> :</span></p></td>
827 <td>a <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a>
831 <td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
832 <td>the horizontal offset of the render area inside the window</td>
835 <td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
836 <td>the vertical offset of the render area inside the window</td>
839 <td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
840 <td>the width of the render area inside the window</td>
843 <td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
844 <td>the height of the render area inside the window</td>
847 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
849 <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>
853 <p class="since">Since 0.10.29</p>
859 Generated by GTK-Doc V1.18</div>