tizen 2.0 init
[framework/multimedia/gst-plugins-base0.10.git] / docs / libs / html / gst-plugins-base-libs-gstxoverlay.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
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">
13 </head>
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">
16 <tr valign="middle">
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>
22 </tr>
23 <tr><td colspan="5" class="shortcuts">
24 <a href="#gst-plugins-base-libs-gstxoverlay.synopsis" class="shortcut">Top</a>
25                    | 
26                   <a href="#gst-plugins-base-libs-gstxoverlay.description" class="shortcut">Description</a>
27                    | 
28                   <a href="#gst-plugins-base-libs-gstxoverlay.object-hierarchy" class="shortcut">Object Hierarchy</a>
29                    | 
30                   <a href="#gst-plugins-base-libs-gstxoverlay.prerequisites" class="shortcut">Prerequisites</a>
31 </td></tr>
32 </table>
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>
36 <td valign="top">
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
39 supporting it</p>
40 </td>
41 <td valign="top" align="right"></td>
42 </tr></table></div>
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 &lt;gst/interfaces/xoverlay.h&gt;
47
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>);
67 </pre>
68 </div>
69 <div class="refsect1">
70 <a name="gst-plugins-base-libs-gstxoverlay.object-hierarchy"></a><h2>Object Hierarchy</h2>
71 <pre class="synopsis">
72   GInterface
73    +----GstXOverlay
74 </pre>
75 </div>
76 <div class="refsect1">
77 <a name="gst-plugins-base-libs-gstxoverlay.prerequisites"></a><h2>Prerequisites</h2>
78 <p>
79 GstXOverlay requires
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>
81 </div>
82 <div class="refsect1">
83 <a name="gst-plugins-base-libs-gstxoverlay.description"></a><h2>Description</h2>
84 <p>
85 </p>
86 <div class="refsect2">
87 <a name="idp17754944"></a><p>
88 The XOverlay interface is used for 2 main purposes :
89 </p>
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.
96 </p></li>
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.
103 </p></li>
104 </ul></div>
105 <p>
106 </p>
107 <p>
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
111 clicks.
112 </p>
113 <p>
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:
120 </p>
121 <div class="informalexample">
122   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
123     <tbody>
124       <tr>
125         <td class="listing_lines" align="right"><pre>1
126 2
127 3
128 4
129 5
130 6
131 7
132 8
133 9
134 10
135 11
136 12
137 13
138 14
139 15
140 16
141 17
142 18
143 19
144 20
145 21
146 22
147 23
148 24
149 25
150 26
151 27
152 28
153 29
154 30
155 31
156 32
157 33
158 34</pre></td>
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>
165
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">-&gt;</span>structure<span class="gtkdoc opt">,</span> <span class="string">&quot;prepare-xwindow-id&quot;</span><span class="gtkdoc opt">))</span>
167    <span class="keyword">return</span> GST_BUS_PASS<span class="gtkdoc opt">;</span>
168
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>
170
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>
172
173  <span class="function">XMapRaised</span> <span class="gtkdoc opt">(</span>disp<span class="gtkdoc opt">,</span> win<span class="gtkdoc opt">);</span>
174
175  <span class="function">XSync</span> <span class="gtkdoc opt">(</span>disp<span class="gtkdoc opt">,</span> FALSE<span class="gtkdoc opt">);</span>
176
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>
179
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>
181
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>
193       </tr>
194     </tbody>
195   </table>
196 </div>
197
198 <p>
199 </p>
200 </div>
201 <p>
202 </p>
203 <hr>
204 <div class="refsect2">
205 <a name="idp17764272"></a><h3>Two basic usage scenarios</h3>
206 <p>
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.
214 </p>
215 <p>
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).
227 </p>
228 <p>
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).
244 </p>
245 </div>
246 <p>
247 </p>
248 <hr>
249 <div class="refsect2">
250 <a name="idp17776432"></a><h3>GstXOverlay and Gtk+</h3>
251 <p>
252 </p>
253 <div class="informalexample">
254   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
255     <tbody>
256       <tr>
257         <td class="listing_lines" align="right"><pre>1
258 2
259 3
260 4
261 5
262 6
263 7
264 8
265 9
266 10
267 11
268 12
269 13
270 14
271 15
272 16
273 17
274 18
275 19
276 20
277 21
278 22
279 23
280 24
281 25
282 26
283 27
284 28
285 29
286 30
287 31
288 32
289 33
290 34
291 35
292 36
293 37
294 38
295 39
296 40
297 41
298 42
299 43
300 44
301 45
302 46
303 47
304 48
305 49
306 50
307 51
308 52
309 53
310 54
311 55
312 56
313 57
314 58
315 59
316 60
317 61
318 62
319 63
320 64
321 65
322 66
323 67
324 68
325 69
326 70
327 71
328 72
329 73
330 74
331 75
332 76
333 77
334 78
335 79
336 80
337 81
338 82
339 83</pre></td>
340         <td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc">#include &lt;gst/interfaces/xoverlay.h&gt;</span>
341 <span class="gtkdoc ppc">#include &lt;gtk/gtk.h&gt;</span>
342 <span class="gtkdoc ppc">#ifdef GDK_WINDOWING_X11</span>
343 <span class="gtkdoc ppc">#include &lt;gdk/gdkx.h&gt;</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">-&gt;</span>structure<span class="gtkdoc opt">,</span> <span class="string">&quot;prepare-xwindow-id&quot;</span><span class="gtkdoc opt">))</span>
355    <span class="keyword">return</span> GST_BUS_PASS<span class="gtkdoc opt">;</span>
356
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>
359
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">&quot;Should have obtained video_window_xid by now!&quot;</span><span class="gtkdoc opt">);</span>
365  <span class="gtkdoc opt">}</span>
366
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">-&gt;</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">&quot;Couldn't create native window needed for GstXOverlay!&quot;</span><span class="gtkdoc opt">);</span>
379 <span class="gtkdoc ppc">#endif</span>
380
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">&quot;realize&quot;</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>
406
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>
411
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>
423       </tr>
424     </tbody>
425   </table>
426 </div>
427
428 <p>
429 </p>
430 </div>
431 <p>
432 </p>
433 <hr>
434 <div class="refsect2">
435 <a name="idp17781264"></a><h3>GstXOverlay and Qt</h3>
436 <p>
437 </p>
438 <div class="informalexample">
439   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
440     <tbody>
441       <tr>
442         <td class="listing_lines" align="right"><pre>1
443 2
444 3
445 4
446 5
447 6
448 7
449 8
450 9
451 10
452 11
453 12
454 13
455 14
456 15
457 16
458 17
459 18
460 19
461 20
462 21
463 22
464 23
465 24
466 25
467 26
468 27
469 28
470 29
471 30
472 31
473 32
474 33
475 34
476 35
477 36
478 37
479 38
480 39
481 40
482 41
483 42
484 43
485 44
486 45
487 46
488 47
489 48
490 49
491 50
492 51
493 52
494 53</pre></td>
495         <td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc">#include &lt;glib.h&gt;</span>
496 <span class="gtkdoc ppc">#include &lt;gst/gst.h&gt;</span>
497 <span class="gtkdoc ppc">#include &lt;gst/interfaces/xoverlay.h&gt;</span>
498
499 <span class="gtkdoc ppc">#include &lt;QApplication&gt;</span>
500 <span class="gtkdoc ppc">#include &lt;QTimer&gt;</span>
501 <span class="gtkdoc ppc">#include &lt;QWidget&gt;</span>
502
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>
507
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">(&amp;</span>argc<span class="gtkdoc opt">, &amp;</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">(&amp;</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">()), &amp;</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>
511
512   <span class="gtkdoc slc">// prepare the pipeline</span>
513
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">&quot;xvoverlay&quot;</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">&quot;videotestsrc&quot;</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">&quot;xvimagesink&quot;</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>
519
520   <span class="gtkdoc slc">// prepare the ui</span>
521
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>
525
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>
528
529   <span class="gtkdoc slc">// run the pipeline</span>
530
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>
539
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>
541
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>
545
546   <span class="keyword">return</span> ret<span class="gtkdoc opt">;</span>
547 <span class="gtkdoc opt">}</span></pre></td>
548       </tr>
549     </tbody>
550   </table>
551 </div>
552
553 <p>
554 </p>
555 </div>
556 <p>
557 </p>
558 </div>
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>
564 <p>
565 Opaque <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> data structure.
566 </p>
567 </div>
568 <hr>
569 <div class="refsect2">
570 <a name="GstXOverlayClass"></a><h3>struct GstXOverlayClass</h3>
571 <pre class="programlisting">struct GstXOverlayClass {
572   GTypeInterface klass;
573
574   /* virtual functions */
575 #ifndef GST_DISABLE_DEPRECATED
576   void (* set_xwindow_id)      (GstXOverlay *overlay,
577                                 gulong       xwindow_id);
578 #else
579 #endif
580 #endif /* not GST_DISABLE_DEPRECATED */
581
582   void (* expose)              (GstXOverlay *overlay);
583
584   void (* handle_events)       (GstXOverlay *overlay,
585                                 gboolean     handle_events);
586
587   void (* set_render_rectangle) (GstXOverlay *overlay,
588                                  gint x, gint y,
589                                  gint width, gint height);
590
591   void (* set_window_handle)   (GstXOverlay *overlay,
592                                 guintptr    handle);
593 };
594 </pre>
595 <p>
596 <a class="link" href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> interface
597 </p>
598 <div class="variablelist"><table border="0">
599 <col align="left" valign="top">
600 <tbody>
601 <tr>
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>
604 </tr>
605 <tr>
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>
608 </tr>
609 <tr>
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>
612 </tr>
613 <tr>
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>
616 </tr>
617 <tr>
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>
620 </tr>
621 <tr>
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>
624 </tr>
625 </tbody>
626 </table></div>
627 </div>
628 <hr>
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>
636 </div>
637 <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.
642 </p>
643 <div class="variablelist"><table border="0">
644 <col align="left" valign="top">
645 <tbody>
646 <tr>
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>
649 </tr>
650 <tr>
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>
653 </tr>
654 </tbody>
655 </table></div>
656 </div>
657 <hr>
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>
665 </div>
666 <p>
667 This will post a "have-xwindow-id" element message on the bus.
668 </p>
669 <p>
670 This function should only be used by video overlay plugin developers.
671 </p>
672 <div class="variablelist"><table border="0">
673 <col align="left" valign="top">
674 <tbody>
675 <tr>
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>
678 </tr>
679 <tr>
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>
682 </tr>
683 </tbody>
684 </table></div>
685 </div>
686 <hr>
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>
691 <p>
692 This will post a "have-xwindow-id" element message on the bus.
693 </p>
694 <p>
695 This function should only be used by video overlay plugin developers.
696 </p>
697 <div class="variablelist"><table border="0">
698 <col align="left" valign="top">
699 <tbody>
700 <tr>
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>
703 </tr>
704 <tr>
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>
707 </tr>
708 </tbody>
709 </table></div>
710 </div>
711 <hr>
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>
716 <p>
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.
721 </p>
722 <div class="variablelist"><table border="0">
723 <col align="left" valign="top">
724 <tbody>
725 <tr>
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>
728 </tr>
729 <tr>
730 <td><p><span class="term"><em class="parameter"><code>handle</code></em> :</span></p></td>
731 <td>a handle referencing the window.</td>
732 </tr>
733 </tbody>
734 </table></div>
735 <p class="since">Since 0.10.31</p>
736 </div>
737 <hr>
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>
741 <p>
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
745 window.
746 </p>
747 <p>
748 This function should only be used by video overlay plugin developers.
749 </p>
750 <div class="variablelist"><table border="0">
751 <col align="left" valign="top">
752 <tbody><tr>
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>
755 </tr></tbody>
756 </table></div>
757 </div>
758 <hr>
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>
762 <p>
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.
765 </p>
766 <div class="variablelist"><table border="0">
767 <col align="left" valign="top">
768 <tbody><tr>
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>
771 </tr></tbody>
772 </table></div>
773 </div>
774 <hr>
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>
779 <p>
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
784 from the XOverlay.
785 </p>
786 <div class="variablelist"><table border="0">
787 <col align="left" valign="top">
788 <tbody>
789 <tr>
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>
792 </tr>
793 <tr>
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>
796 </tr>
797 </tbody>
798 </table></div>
799 <p class="since">Since 0.10.12</p>
800 </div>
801 <hr>
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>
809 <p>
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.
817 </p>
818 <p>
819 This method is needed for non fullscreen video overlay in UI toolkits that
820 do not support subwindows.
821 </p>
822 <div class="variablelist"><table border="0">
823 <col align="left" valign="top">
824 <tbody>
825 <tr>
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>
828 </td>
829 </tr>
830 <tr>
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>
833 </tr>
834 <tr>
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>
837 </tr>
838 <tr>
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>
841 </tr>
842 <tr>
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>
845 </tr>
846 <tr>
847 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
848 <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>
850 </tr>
851 </tbody>
852 </table></div>
853 <p class="since">Since 0.10.29</p>
854 </div>
855 </div>
856 </div>
857 <div class="footer">
858 <hr>
859           Generated by GTK-Doc V1.18</div>
860 </body>
861 </html>