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>GstVideoOverlay: GStreamer Base Plugins 1.0 Library Reference Manual</title> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="index.html" title="GStreamer Base Plugins 1.0 Library Reference Manual"> 8<link rel="up" href="gstreamer-video.html" title="Video Library"> 9<link rel="prev" href="GstVideoOrientation.html" title="GstVideoOrientation"> 10<link rel="next" href="GstVideoDecoder.html" title="GstVideoDecoder"> 11<meta name="generator" content="GTK-Doc V1.28 (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="5"><tr valign="middle"> 16<td width="100%" align="left" class="shortcuts"> 17<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> 18 <a href="#GstVideoOverlay.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> 19 <a href="#GstVideoOverlay.object-hierarchy" class="shortcut">Object Hierarchy</a></span> 20</td> 21<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> 22<td><a accesskey="u" href="gstreamer-video.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> 23<td><a accesskey="p" href="GstVideoOrientation.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> 24<td><a accesskey="n" href="GstVideoDecoder.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> 25</tr></table> 26<div class="refentry"> 27<a name="GstVideoOverlay"></a><div class="titlepage"></div> 28<div class="refnamediv"><table width="100%"><tr> 29<td valign="top"> 30<h2><span class="refentrytitle"><a name="GstVideoOverlay.top_of_page"></a>GstVideoOverlay</span></h2> 31<p>GstVideoOverlay — Interface for setting/getting a window system resource 32 on elements supporting it to configure a window into which to render a 33 video.</p> 34</td> 35<td class="gallery_image" valign="top" align="right"></td> 36</tr></table></div> 37<div class="refsect1"> 38<a name="GstVideoOverlay.functions"></a><h2>Functions</h2> 39<div class="informaltable"><table class="informaltable" width="100%" border="0"> 40<colgroup> 41<col width="150px" class="functions_return"> 42<col class="functions_name"> 43</colgroup> 44<tbody> 45<tr> 46<td class="function_type"> 47<span class="returnvalue">void</span> 48</td> 49<td class="function_name"> 50<a class="link" href="GstVideoOverlay.html#gst-video-overlay-got-window-handle" title="gst_video_overlay_got_window_handle ()">gst_video_overlay_got_window_handle</a> <span class="c_punctuation">()</span> 51</td> 52</tr> 53<tr> 54<td class="function_type"> 55<span class="returnvalue">void</span> 56</td> 57<td class="function_name"> 58<a class="link" href="GstVideoOverlay.html#gst-video-overlay-set-window-handle" title="gst_video_overlay_set_window_handle ()">gst_video_overlay_set_window_handle</a> <span class="c_punctuation">()</span> 59</td> 60</tr> 61<tr> 62<td class="function_type"> 63<span class="returnvalue">void</span> 64</td> 65<td class="function_name"> 66<a class="link" href="GstVideoOverlay.html#gst-video-overlay-prepare-window-handle" title="gst_video_overlay_prepare_window_handle ()">gst_video_overlay_prepare_window_handle</a> <span class="c_punctuation">()</span> 67</td> 68</tr> 69<tr> 70<td class="function_type"> 71<span class="returnvalue">void</span> 72</td> 73<td class="function_name"> 74<a class="link" href="GstVideoOverlay.html#gst-video-overlay-expose" title="gst_video_overlay_expose ()">gst_video_overlay_expose</a> <span class="c_punctuation">()</span> 75</td> 76</tr> 77<tr> 78<td class="function_type"> 79<span class="returnvalue">void</span> 80</td> 81<td class="function_name"> 82<a class="link" href="GstVideoOverlay.html#gst-video-overlay-handle-events" title="gst_video_overlay_handle_events ()">gst_video_overlay_handle_events</a> <span class="c_punctuation">()</span> 83</td> 84</tr> 85<tr> 86<td class="function_type"> 87<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 88</td> 89<td class="function_name"> 90<a class="link" href="GstVideoOverlay.html#gst-video-overlay-set-render-rectangle" title="gst_video_overlay_set_render_rectangle ()">gst_video_overlay_set_render_rectangle</a> <span class="c_punctuation">()</span> 91</td> 92</tr> 93<tr> 94<td class="function_type"> 95<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 96</td> 97<td class="function_name"> 98<a class="link" href="GstVideoOverlay.html#gst-is-video-overlay-prepare-window-handle-message" title="gst_is_video_overlay_prepare_window_handle_message ()">gst_is_video_overlay_prepare_window_handle_message</a> <span class="c_punctuation">()</span> 99</td> 100</tr> 101<tr> 102<td class="function_type"> 103<span class="returnvalue">void</span> 104</td> 105<td class="function_name"> 106<a class="link" href="GstVideoOverlay.html#gst-video-overlay-install-properties" title="gst_video_overlay_install_properties ()">gst_video_overlay_install_properties</a> <span class="c_punctuation">()</span> 107</td> 108</tr> 109<tr> 110<td class="function_type"> 111<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 112</td> 113<td class="function_name"> 114<a class="link" href="GstVideoOverlay.html#gst-video-overlay-set-property" title="gst_video_overlay_set_property ()">gst_video_overlay_set_property</a> <span class="c_punctuation">()</span> 115</td> 116</tr> 117</tbody> 118</table></div> 119</div> 120<div class="refsect1"> 121<a name="GstVideoOverlay.other"></a><h2>Types and Values</h2> 122<div class="informaltable"><table class="informaltable" width="100%" border="0"> 123<colgroup> 124<col width="150px" class="name"> 125<col class="description"> 126</colgroup> 127<tbody> 128<tr> 129<td class="datatype_keyword"> </td> 130<td class="function_name"><a class="link" href="GstVideoOverlay.html#GstVideoOverlay-struct" title="GstVideoOverlay">GstVideoOverlay</a></td> 131</tr> 132<tr> 133<td class="datatype_keyword">struct</td> 134<td class="function_name"><a class="link" href="GstVideoOverlay.html#GstVideoOverlayInterface" title="struct GstVideoOverlayInterface">GstVideoOverlayInterface</a></td> 135</tr> 136</tbody> 137</table></div> 138</div> 139<div class="refsect1"> 140<a name="GstVideoOverlay.object-hierarchy"></a><h2>Object Hierarchy</h2> 141<pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/GTypeModule.html">GInterface</a> 142 <span class="lineart">╰──</span> GstVideoOverlay 143</pre> 144</div> 145<div class="refsect1"> 146<a name="GstVideoOverlay.includes"></a><h2>Includes</h2> 147<pre class="synopsis">#include <gst/video/video.h> 148</pre> 149</div> 150<div class="refsect1"> 151<a name="GstVideoOverlay.description"></a><h2>Description</h2> 152<p>The <a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a> interface is used for 2 main purposes :</p> 153<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 154<li class="listitem"><p>To get a grab on the Window where the video sink element is going to render. 155This is achieved by either being informed about the Window identifier that 156the video sink element generated, or by forcing the video sink element to use 157a specific Window identifier for rendering.</p></li> 158<li class="listitem"><p>To force a redrawing of the latest video frame the video sink element 159displayed on the Window. Indeed if the <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstPipeline.html#GstPipeline-struct"><span class="type">GstPipeline</span></a> is in <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstElement.html#GST-STATE-PAUSED:CAPS"><span class="type">GST_STATE_PAUSED</span></a> 160state, moving the Window around will damage its content. Application 161developers will want to handle the Expose events themselves and force the 162video sink element to refresh the Window's content.</p></li> 163</ul></div> 164<p>Using the Window created by the video sink is probably the simplest scenario, 165in some cases, though, it might not be flexible enough for application 166developers if they need to catch events such as mouse moves and button 167clicks.</p> 168<p>Setting a specific Window identifier on the video sink element is the most 169flexible solution but it has some issues. Indeed the application needs to set 170its Window identifier at the right time to avoid internal Window creation 171from the video sink element. To solve this issue a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstMessage.html#GstMessage-struct"><span class="type">GstMessage</span></a> is posted on 172the bus to inform the application that it should set the Window identifier 173immediately. Here is an example on how to do that correctly:</p> 174<div class="informalexample"> 175 <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> 176 <tbody> 177 <tr> 178 <td class="listing_lines" align="right"><pre>1 1792 1803 1814 1825 1836 1847 1858 1869 18710 18811 18912 19013 19114 19215 19316 19417 19518 19619 19720 19821 19922 20023 20124 20225 20326 20427 20528 20629 20730 20831 20932</pre></td> 210 <td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">static</span> GstBusSyncReply 211<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> 212<span class="gtkdoc opt">{</span> 213 <span class="gtkdoc slc">// ignore anything but 'prepare-window-handle' element messages</span> 214 <span class="keyword">if</span> <span class="gtkdoc opt">(!</span><span class="function"><a href="GstVideoOverlay.html#gst-is-video-overlay-prepare-window-handle-message">gst_is_video_overlay_prepare_window_handle_message</a></span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">))</span> 215 <span class="keyword">return</span> GST_BUS_PASS<span class="gtkdoc opt">;</span> 216 217 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> 218 219 <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> 220 221 <span class="function">XMapRaised</span> <span class="gtkdoc opt">(</span>disp<span class="gtkdoc opt">,</span> win<span class="gtkdoc opt">);</span> 222 223 <span class="function">XSync</span> <span class="gtkdoc opt">(</span>disp<span class="gtkdoc opt">,</span> FALSE<span class="gtkdoc opt">);</span> 224 225 <span class="function"><a href="GstVideoOverlay.html#gst-video-overlay-set-window-handle">gst_video_overlay_set_window_handle</a></span> <span class="gtkdoc opt">(</span><span class="function">GST_VIDEO_OVERLAY</span> <span class="gtkdoc opt">(</span><span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstMessage.html#GST-MESSAGE-SRC:CAPS">GST_MESSAGE_SRC</a></span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">)),</span> 226 win<span class="gtkdoc opt">);</span> 227 228 <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstMessage.html#gst-message-unref">gst_message_unref</a></span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">);</span> 229 230 <span class="keyword">return</span> GST_BUS_DROP<span class="gtkdoc opt">;</span> 231<span class="gtkdoc opt">}</span> 232<span class="gtkdoc opt">...</span> 233<span class="gtkdoc kwb">int</span> 234<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> 235<span class="gtkdoc opt">{</span> 236<span class="gtkdoc opt">...</span> 237 bus <span class="gtkdoc opt">=</span> <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/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> 238 <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/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> 239 NULL<span class="gtkdoc opt">);</span> 240<span class="gtkdoc opt">...</span> 241<span class="gtkdoc opt">}</span></pre></td> 242 </tr> 243 </tbody> 244 </table> 245</div> 246 247<p></p> 248<div class="refsect3"> 249<a name="id-1.2.15.19.7.8"></a><h4>Two basic usage scenarios</h4> 250<p>There are two basic usage scenarios: in the simplest case, the application 251uses <span class="type">playbin</span> or <span class="type">plasink</span> or knows exactly what particular element is used 252for video output, which is usually the case when the application creates 253the videosink to use (e.g. <span class="type">xvimagesink</span>, <span class="type">ximagesink</span>, etc.) itself; in this 254case, the application can just create the videosink element, create and 255realize the window to render the video on and then 256call <a class="link" href="GstVideoOverlay.html#gst-video-overlay-set-window-handle" title="gst_video_overlay_set_window_handle ()"><code class="function">gst_video_overlay_set_window_handle()</code></a> directly with the XID or native 257window handle, before starting up the pipeline. 258As <span class="type">playbin</span> and <span class="type">playsink</span> implement the video overlay interface and proxy 259it transparently to the actual video sink even if it is created later, this 260case also applies when using these elements.</p> 261<p>In the other and more common case, the application does not know in advance 262what GStreamer video sink element will be used for video output. This is 263usually the case when an element such as <span class="type">autovideosink</span> is used. 264In this case, the video sink element itself is created 265asynchronously from a GStreamer streaming thread some time after the 266pipeline has been started up. When that happens, however, the video sink 267will need to know right then whether to render onto an already existing 268application window or whether to create its own window. This is when it 269posts a prepare-window-handle message, and that is also why this message needs 270to be handled in a sync bus handler which will be called from the streaming 271thread directly (because the video sink will need an answer right then).</p> 272<p>As response to the prepare-window-handle element message in the bus sync 273handler, the application may use <a class="link" href="GstVideoOverlay.html#gst-video-overlay-set-window-handle" title="gst_video_overlay_set_window_handle ()"><code class="function">gst_video_overlay_set_window_handle()</code></a> to tell 274the video sink to render onto an existing window surface. At this point the 275application should already have obtained the window handle / XID, so it 276just needs to set it. It is generally not advisable to call any GUI toolkit 277functions or window system functions from the streaming thread in which the 278prepare-window-handle message is handled, because most GUI toolkits and 279windowing systems are not thread-safe at all and a lot of care would be 280required to co-ordinate the toolkit and window system calls of the 281different threads (Gtk+ users please note: prior to Gtk+ 2.18 282<a href="/usr/share/gtk-doc/html/gdk3/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 283within the bus sync handler; this macro was changed to a function call in 284Gtk+ 2.18 and later, which is likely to cause problems when called from a 285sync handler; see below for a better approach without <a href="/usr/share/gtk-doc/html/gdk3/gdk3-X-Window-System-Interaction.html#GDK-WINDOW-XID:CAPS"><code class="function">GDK_WINDOW_XID()</code></a> 286used in the callback).</p> 287</div> 288<div class="refsect3"> 289<a name="id-1.2.15.19.7.9"></a><h4>GstVideoOverlay and Gtk+</h4> 290<div class="informalexample"> 291 <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> 292 <tbody> 293 <tr> 294 <td class="listing_lines" align="right"><pre>1 2952 2963 2974 2985 2996 3007 3018 3029 30310 30411 30512 30613 30714 30815 30916 31017 31118 31219 31320 31421 31522 31623 31724 31825 31926 32027 32128 32229 32330 32431 32532 32633 32734 32835 32936 33037 33138 33239 33340 33441 33542 33643 33744 33845 33946 34047 34148 34249 34350 34451 34552 34653 34754 34855 34956 35057 35158 35259 35360 35461 35562 35663 35764 35865 35966 36067 36168 36269 36370 36471 36572 36673 36774 36875 36976 37077 37178 37279 37380 37481 37582 37683 37784 37885 37986 38087 38188 38289 38390 38491 38592 38693 38794 38895 38996</pre></td> 390 <td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc">#include <gst/video/videooverlay.h></span> 391<span class="gtkdoc ppc">#include <gtk/gtk.h></span> 392<span class="gtkdoc ppc">#ifdef GDK_WINDOWING_X11</span> 393<span class="gtkdoc ppc">#include <gdk/gdkx.h></span> <span class="gtkdoc slc">// for GDK_WINDOW_XID</span> 394<span class="gtkdoc ppc"></span><span class="gtkdoc ppc">#endif</span> 395<span class="gtkdoc ppc">#ifdef GDK_WINDOWING_WIN32</span> 396<span class="gtkdoc ppc">#include <gdk/gdkwin32.h></span> <span class="gtkdoc slc">// for GDK_WINDOW_HWND</span> 397<span class="gtkdoc ppc"></span><span class="gtkdoc ppc">#endif</span> 398<span class="gtkdoc opt">...</span> 399<span class="gtkdoc kwb">static</span> guintptr video_window_handle <span class="gtkdoc opt">=</span> <span class="number">0</span><span class="gtkdoc opt">;</span> 400<span class="gtkdoc opt">...</span> 401<span class="gtkdoc kwb">static</span> GstBusSyncReply 402<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> 403<span class="gtkdoc opt">{</span> 404 <span class="gtkdoc slc">// ignore anything but 'prepare-window-handle' element messages</span> 405 <span class="keyword">if</span> <span class="gtkdoc opt">(!</span><span class="function"><a href="GstVideoOverlay.html#gst-is-video-overlay-prepare-window-handle-message">gst_is_video_overlay_prepare_window_handle_message</a></span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">))</span> 406 <span class="keyword">return</span> GST_BUS_PASS<span class="gtkdoc opt">;</span> 407 408 <span class="keyword">if</span> <span class="gtkdoc opt">(</span>video_window_handle <span class="gtkdoc opt">!=</span> <span class="number">0</span><span class="gtkdoc opt">) {</span> 409 GstVideoOverlay <span class="gtkdoc opt">*</span>overlay<span class="gtkdoc opt">;</span> 410 411 <span class="gtkdoc slc">// GST_MESSAGE_SRC (message) will be the video sink element</span> 412 overlay <span class="gtkdoc opt">=</span> <span class="function">GST_VIDEO_OVERLAY</span> <span class="gtkdoc opt">(</span><span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstMessage.html#GST-MESSAGE-SRC:CAPS">GST_MESSAGE_SRC</a></span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">));</span> 413 <span class="function"><a href="GstVideoOverlay.html#gst-video-overlay-set-window-handle">gst_video_overlay_set_window_handle</a></span> <span class="gtkdoc opt">(</span>overlay<span class="gtkdoc opt">,</span> video_window_handle<span class="gtkdoc opt">);</span> 414 <span class="gtkdoc opt">}</span> <span class="keyword">else</span> <span class="gtkdoc opt">{</span> 415 <span class="function"><a href="/usr/share/gtk-doc/html/glib/glib-Message-Logging.html#g-warning">g_warning</a></span> <span class="gtkdoc opt">(</span><span class="string">"Should have obtained video_window_handle by now!"</span><span class="gtkdoc opt">);</span> 416 <span class="gtkdoc opt">}</span> 417 418 <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstMessage.html#gst-message-unref">gst_message_unref</a></span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">);</span> 419 <span class="keyword">return</span> GST_BUS_DROP<span class="gtkdoc opt">;</span> 420<span class="gtkdoc opt">}</span> 421<span class="gtkdoc opt">...</span> 422<span class="gtkdoc kwb">static void</span> 423<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> 424<span class="gtkdoc opt">{</span> 425<span class="gtkdoc ppc">#if GTK_CHECK_VERSION(2,18,0)</span> 426 <span class="gtkdoc slc">// Tell Gtk+/Gdk to create a native window for this widget instead of</span> 427 <span class="gtkdoc slc">// drawing onto the parent widget.</span> 428 <span class="gtkdoc slc">// This is here just for pedagogical purposes, GDK_WINDOW_XID will call</span> 429 <span class="gtkdoc slc">// it as well in newer Gtk versions</span> 430 <span class="keyword">if</span> <span class="gtkdoc opt">(!</span><span class="function"><a href="/usr/share/gtk-doc/html/gdk3/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> 431 <span class="function"><a href="/usr/share/gtk-doc/html/glib/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 GstVideoOverlay!"</span><span class="gtkdoc opt">);</span> 432<span class="gtkdoc ppc">#endif</span> 433 434<span class="gtkdoc ppc">#ifdef GDK_WINDOWING_X11</span> 435 <span class="gtkdoc opt">{</span> 436 gulong xid <span class="gtkdoc opt">=</span> <span class="function"><a href="/usr/share/gtk-doc/html/gdk3/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="/usr/share/gtk-doc/html/gtk3/GtkWidget.html#gtk-widget-get-window">gtk_widget_get_window</a></span> <span class="gtkdoc opt">(</span>video_window<span class="gtkdoc opt">));</span> 437 video_window_handle <span class="gtkdoc opt">=</span> xid<span class="gtkdoc opt">;</span> 438 <span class="gtkdoc opt">}</span> 439<span class="gtkdoc ppc">#endif</span> 440<span class="gtkdoc ppc">#ifdef GDK_WINDOWING_WIN32</span> 441 <span class="gtkdoc opt">{</span> 442 HWND wnd <span class="gtkdoc opt">=</span> <span class="function">GDK_WINDOW_HWND</span> <span class="gtkdoc opt">(</span><span class="function"><a href="/usr/share/gtk-doc/html/gtk3/GtkWidget.html#gtk-widget-get-window">gtk_widget_get_window</a></span> <span class="gtkdoc opt">(</span>video_window<span class="gtkdoc opt">));</span> 443 video_window_handle <span class="gtkdoc opt">= (</span>guintptr<span class="gtkdoc opt">)</span> wnd<span class="gtkdoc opt">;</span> 444 <span class="gtkdoc opt">}</span> 445<span class="gtkdoc ppc">#endif</span> 446<span class="gtkdoc opt">}</span> 447<span class="gtkdoc opt">...</span> 448<span class="gtkdoc kwb">int</span> 449<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> 450<span class="gtkdoc opt">{</span> 451 GtkWidget <span class="gtkdoc opt">*</span>video_window<span class="gtkdoc opt">;</span> 452 GtkWidget <span class="gtkdoc opt">*</span>app_window<span class="gtkdoc opt">;</span> 453 <span class="gtkdoc opt">...</span> 454 app_window <span class="gtkdoc opt">=</span> <span class="function"><a href="/usr/share/gtk-doc/html/gtk3/GtkWindow.html#gtk-window-new">gtk_window_new</a></span> <span class="gtkdoc opt">(</span>GTK_WINDOW_TOPLEVEL<span class="gtkdoc opt">);</span> 455 <span class="gtkdoc opt">...</span> 456 video_window <span class="gtkdoc opt">=</span> <span class="function"><a href="/usr/share/gtk-doc/html/gtk3/GtkDrawingArea.html#gtk-drawing-area-new">gtk_drawing_area_new</a></span> <span class="gtkdoc opt">();</span> 457 <span class="function"><a href="/usr/share/gtk-doc/html/gobject/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> 458 <span class="function"><a href="/usr/share/gtk-doc/html/gobject/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> 459 <span class="function"><a href="/usr/share/gtk-doc/html/gtk3/GtkWidget.html#gtk-widget-set-double-buffered">gtk_widget_set_double_buffered</a></span> <span class="gtkdoc opt">(</span>video_window<span class="gtkdoc opt">,</span> FALSE<span class="gtkdoc opt">);</span> 460 <span class="gtkdoc opt">...</span> 461 <span class="gtkdoc slc">// usually the video_window will not be directly embedded into the</span> 462 <span class="gtkdoc slc">// application window like this, but there will be many other widgets</span> 463 <span class="gtkdoc slc">// and the video window will be embedded in one of them instead</span> 464 <span class="function"><a href="/usr/share/gtk-doc/html/gtk3/GtkContainer.html#gtk-container-add">gtk_container_add</a></span> <span class="gtkdoc opt">(</span><span class="function">GTK_CONTAINER</span> <span class="gtkdoc opt">(</span>ap_window<span class="gtkdoc opt">),</span> video_window<span class="gtkdoc opt">);</span> 465 <span class="gtkdoc opt">...</span> 466 <span class="gtkdoc slc">// show the GUI</span> 467 <span class="function"><a href="/usr/share/gtk-doc/html/gtk3/GtkWidget.html#gtk-widget-show-all">gtk_widget_show_all</a></span> <span class="gtkdoc opt">(</span>app_window<span class="gtkdoc opt">);</span> 468 469 <span class="gtkdoc slc">// realize window now so that the video window gets created and we can</span> 470 <span class="gtkdoc slc">// obtain its XID/HWND before the pipeline is started up and the videosink</span> 471 <span class="gtkdoc slc">// asks for the XID/HWND of the window to render onto</span> 472 <span class="function"><a href="/usr/share/gtk-doc/html/gtk3/GtkWidget.html#gtk-widget-realize">gtk_widget_realize</a></span> <span class="gtkdoc opt">(</span>video_window<span class="gtkdoc opt">);</span> 473 474 <span class="gtkdoc slc">// we should have the XID/HWND now</span> 475 <span class="function"><a href="/usr/share/gtk-doc/html/glib/glib-Testing.html#g-assert">g_assert</a></span> <span class="gtkdoc opt">(</span>video_window_handle <span class="gtkdoc opt">!=</span> <span class="number">0</span><span class="gtkdoc opt">);</span> 476 <span class="gtkdoc opt">...</span> 477 <span class="gtkdoc slc">// set up sync handler for setting the xid once the pipeline is started</span> 478 bus <span class="gtkdoc opt">=</span> <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/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> 479 <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/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> 480 NULL<span class="gtkdoc opt">);</span> 481 <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstObject.html#gst-object-unref">gst_object_unref</a></span> <span class="gtkdoc opt">(</span>bus<span class="gtkdoc opt">);</span> 482 <span class="gtkdoc opt">...</span> 483 <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/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> 484 <span class="gtkdoc opt">...</span> 485<span class="gtkdoc opt">}</span></pre></td> 486 </tr> 487 </tbody> 488 </table> 489</div> 490 491<p></p> 492</div> 493<div class="refsect3"> 494<a name="id-1.2.15.19.7.10"></a><h4>GstVideoOverlay and Qt</h4> 495<div class="informalexample"> 496 <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> 497 <tbody> 498 <tr> 499 <td class="listing_lines" align="right"><pre>1 5002 5013 5024 5035 5046 5057 5068 5079 50810 50911 51012 51113 51214 51315 51416 51517 51618 51719 51820 51921 52022 52123 52224 52325 52426 52527 52628 52729 52830 52931 53032 53133 53234 53335 53436 53537 53638 53739 53840 53941 54042 54143 54244 54345 54446 54547 54648 54749 54850 54951 55052 55153</pre></td> 552 <td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc">#include <glib.h></span> 553<span class="gtkdoc ppc">#include <gst/gst.h></span> 554<span class="gtkdoc ppc">#include <gst/video/videooverlay.h></span> 555 556<span class="gtkdoc ppc">#include <QApplication></span> 557<span class="gtkdoc ppc">#include <QTimer></span> 558<span class="gtkdoc ppc">#include <QWidget></span> 559 560<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> 561<span class="gtkdoc opt">{</span> 562 <span class="keyword">if</span> <span class="gtkdoc opt">(!</span><span class="function"><a href="/usr/share/gtk-doc/html/glib/glib-Deprecated-Thread-APIs.html#g-thread-supported">g_thread_supported</a></span> <span class="gtkdoc opt">())</span> 563 <span class="function"><a href="/usr/share/gtk-doc/html/glib/glib-Deprecated-Thread-APIs.html#g-thread-init">g_thread_init</a></span> <span class="gtkdoc opt">(</span>NULL<span class="gtkdoc opt">);</span> 564 565 <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/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> 566 QApplication <span class="function">app</span><span class="gtkdoc opt">(</span>argc<span class="gtkdoc opt">,</span> argv<span class="gtkdoc opt">);</span> 567 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> 568 569 <span class="gtkdoc slc">// prepare the pipeline</span> 570 571 GstElement <span class="gtkdoc opt">*</span>pipeline <span class="gtkdoc opt">=</span> <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/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> 572 GstElement <span class="gtkdoc opt">*</span>src <span class="gtkdoc opt">=</span> <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/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> 573 GstElement <span class="gtkdoc opt">*</span>sink <span class="gtkdoc opt">=</span> <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/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> 574 <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/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> 575 <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/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> 576 577 <span class="gtkdoc slc">// prepare the ui</span> 578 579 QWidget window<span class="gtkdoc opt">;</span> 580 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> 581 window<span class="gtkdoc opt">.</span><span class="function">show</span><span class="gtkdoc opt">();</span> 582 583 WId xwinid <span class="gtkdoc opt">=</span> window<span class="gtkdoc opt">.</span><span class="function">winId</span><span class="gtkdoc opt">();</span> 584 <span class="function"><a href="GstVideoOverlay.html#gst-video-overlay-set-window-handle">gst_video_overlay_set_window_handle</a></span> <span class="gtkdoc opt">(</span><span class="function">GST_VIDEO_OVERLAY</span> <span class="gtkdoc opt">(</span>sink<span class="gtkdoc opt">),</span> xwinid<span class="gtkdoc opt">);</span> 585 586 <span class="gtkdoc slc">// run the pipeline</span> 587 588 GstStateChangeReturn sret <span class="gtkdoc opt">=</span> <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstElement.html#gst-element-set-state">gst_element_set_state</a></span> <span class="gtkdoc opt">(</span>pipeline<span class="gtkdoc opt">,</span> 589 GST_STATE_PLAYING<span class="gtkdoc opt">);</span> 590 <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> 591 <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/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> 592 <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstObject.html#gst-object-unref">gst_object_unref</a></span> <span class="gtkdoc opt">(</span>pipeline<span class="gtkdoc opt">);</span> 593 <span class="gtkdoc slc">// Exit application</span> 594 <span class="gtkdoc kwc">QTimer</span><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> <span class="gtkdoc kwc">QApplication</span><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> 595 <span class="gtkdoc opt">}</span> 596 597 <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> 598 599 window<span class="gtkdoc opt">.</span><span class="function">hide</span><span class="gtkdoc opt">();</span> 600 <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/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> 601 <span class="function"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstObject.html#gst-object-unref">gst_object_unref</a></span> <span class="gtkdoc opt">(</span>pipeline<span class="gtkdoc opt">);</span> 602 603 <span class="keyword">return</span> ret<span class="gtkdoc opt">;</span> 604<span class="gtkdoc opt">}</span></pre></td> 605 </tr> 606 </tbody> 607 </table> 608</div> 609 610<p></p> 611</div> 612</div> 613<div class="refsect1"> 614<a name="GstVideoOverlay.functions_details"></a><h2>Functions</h2> 615<div class="refsect2"> 616<a name="gst-video-overlay-got-window-handle"></a><h3>gst_video_overlay_got_window_handle ()</h3> 617<pre class="programlisting"><span class="returnvalue">void</span> 618gst_video_overlay_got_window_handle (<em class="parameter"><code><a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a> *overlay</code></em>, 619 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guintptr"><span class="type">guintptr</span></a> handle</code></em>);</pre> 620<p>This will post a "have-window-handle" element message on the bus.</p> 621<p>This function should only be used by video overlay plugin developers.</p> 622<div class="refsect3"> 623<a name="gst-video-overlay-got-window-handle.parameters"></a><h4>Parameters</h4> 624<div class="informaltable"><table class="informaltable" width="100%" border="0"> 625<colgroup> 626<col width="150px" class="parameters_name"> 627<col class="parameters_description"> 628<col width="200px" class="parameters_annotations"> 629</colgroup> 630<tbody> 631<tr> 632<td class="parameter_name"><p>overlay</p></td> 633<td class="parameter_description"><p>a <a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a> which got a window</p></td> 634<td class="parameter_annotations"> </td> 635</tr> 636<tr> 637<td class="parameter_name"><p>handle</p></td> 638<td class="parameter_description"><p>a platform-specific handle referencing the window</p></td> 639<td class="parameter_annotations"> </td> 640</tr> 641</tbody> 642</table></div> 643</div> 644</div> 645<hr> 646<div class="refsect2"> 647<a name="gst-video-overlay-set-window-handle"></a><h3>gst_video_overlay_set_window_handle ()</h3> 648<pre class="programlisting"><span class="returnvalue">void</span> 649gst_video_overlay_set_window_handle (<em class="parameter"><code><a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a> *overlay</code></em>, 650 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guintptr"><span class="type">guintptr</span></a> handle</code></em>);</pre> 651<p>This will call the video overlay's set_window_handle method. You 652should use this method to tell to an overlay to display video output to a 653specific window (e.g. an XWindow on X11). Passing 0 as the <em class="parameter"><code>handle</code></em> 654 will 655tell the overlay to stop using that window and create an internal one.</p> 656<div class="refsect3"> 657<a name="gst-video-overlay-set-window-handle.parameters"></a><h4>Parameters</h4> 658<div class="informaltable"><table class="informaltable" width="100%" border="0"> 659<colgroup> 660<col width="150px" class="parameters_name"> 661<col class="parameters_description"> 662<col width="200px" class="parameters_annotations"> 663</colgroup> 664<tbody> 665<tr> 666<td class="parameter_name"><p>overlay</p></td> 667<td class="parameter_description"><p>a <a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a> to set the window on.</p></td> 668<td class="parameter_annotations"> </td> 669</tr> 670<tr> 671<td class="parameter_name"><p>handle</p></td> 672<td class="parameter_description"><p>a handle referencing the window.</p></td> 673<td class="parameter_annotations"> </td> 674</tr> 675</tbody> 676</table></div> 677</div> 678</div> 679<hr> 680<div class="refsect2"> 681<a name="gst-video-overlay-prepare-window-handle"></a><h3>gst_video_overlay_prepare_window_handle ()</h3> 682<pre class="programlisting"><span class="returnvalue">void</span> 683gst_video_overlay_prepare_window_handle 684 (<em class="parameter"><code><a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a> *overlay</code></em>);</pre> 685<p>This will post a "prepare-window-handle" element message on the bus 686to give applications an opportunity to call 687<a class="link" href="GstVideoOverlay.html#gst-video-overlay-set-window-handle" title="gst_video_overlay_set_window_handle ()"><code class="function">gst_video_overlay_set_window_handle()</code></a> before a plugin creates its own 688window.</p> 689<p>This function should only be used by video overlay plugin developers.</p> 690<div class="refsect3"> 691<a name="gst-video-overlay-prepare-window-handle.parameters"></a><h4>Parameters</h4> 692<div class="informaltable"><table class="informaltable" width="100%" border="0"> 693<colgroup> 694<col width="150px" class="parameters_name"> 695<col class="parameters_description"> 696<col width="200px" class="parameters_annotations"> 697</colgroup> 698<tbody><tr> 699<td class="parameter_name"><p>overlay</p></td> 700<td class="parameter_description"><p>a <a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a> which does not yet have an Window handle set</p></td> 701<td class="parameter_annotations"> </td> 702</tr></tbody> 703</table></div> 704</div> 705</div> 706<hr> 707<div class="refsect2"> 708<a name="gst-video-overlay-expose"></a><h3>gst_video_overlay_expose ()</h3> 709<pre class="programlisting"><span class="returnvalue">void</span> 710gst_video_overlay_expose (<em class="parameter"><code><a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a> *overlay</code></em>);</pre> 711<p>Tell an overlay that it has been exposed. This will redraw the current frame 712in the drawable even if the pipeline is PAUSED.</p> 713<div class="refsect3"> 714<a name="gst-video-overlay-expose.parameters"></a><h4>Parameters</h4> 715<div class="informaltable"><table class="informaltable" width="100%" border="0"> 716<colgroup> 717<col width="150px" class="parameters_name"> 718<col class="parameters_description"> 719<col width="200px" class="parameters_annotations"> 720</colgroup> 721<tbody><tr> 722<td class="parameter_name"><p>overlay</p></td> 723<td class="parameter_description"><p>a <a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a> to expose.</p></td> 724<td class="parameter_annotations"> </td> 725</tr></tbody> 726</table></div> 727</div> 728</div> 729<hr> 730<div class="refsect2"> 731<a name="gst-video-overlay-handle-events"></a><h3>gst_video_overlay_handle_events ()</h3> 732<pre class="programlisting"><span class="returnvalue">void</span> 733gst_video_overlay_handle_events (<em class="parameter"><code><a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a> *overlay</code></em>, 734 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> handle_events</code></em>);</pre> 735<p>Tell an overlay that it should handle events from the window system. These 736events are forwarded upstream as navigation events. In some window system, 737events are not propagated in the window hierarchy if a client is listening 738for them. This method allows you to disable events handling completely 739from the <a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a>.</p> 740<div class="refsect3"> 741<a name="gst-video-overlay-handle-events.parameters"></a><h4>Parameters</h4> 742<div class="informaltable"><table class="informaltable" width="100%" border="0"> 743<colgroup> 744<col width="150px" class="parameters_name"> 745<col class="parameters_description"> 746<col width="200px" class="parameters_annotations"> 747</colgroup> 748<tbody> 749<tr> 750<td class="parameter_name"><p>overlay</p></td> 751<td class="parameter_description"><p>a <a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a> to expose.</p></td> 752<td class="parameter_annotations"> </td> 753</tr> 754<tr> 755<td class="parameter_name"><p>handle_events</p></td> 756<td class="parameter_description"><p>a <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> indicating if events should be handled or not.</p></td> 757<td class="parameter_annotations"> </td> 758</tr> 759</tbody> 760</table></div> 761</div> 762</div> 763<hr> 764<div class="refsect2"> 765<a name="gst-video-overlay-set-render-rectangle"></a><h3>gst_video_overlay_set_render_rectangle ()</h3> 766<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 767gst_video_overlay_set_render_rectangle 768 (<em class="parameter"><code><a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a> *overlay</code></em>, 769 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> x</code></em>, 770 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> y</code></em>, 771 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>, 772 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>);</pre> 773<p>Configure a subregion as a video target within the window set by 774<a class="link" href="GstVideoOverlay.html#gst-video-overlay-set-window-handle" title="gst_video_overlay_set_window_handle ()"><code class="function">gst_video_overlay_set_window_handle()</code></a>. If this is not used or not supported 775the video will fill the area of the window set as the overlay to 100%. 776By specifying the rectangle, the video can be overlayed to a specific region 777of that window only. After setting the new rectangle one should call 778<a class="link" href="GstVideoOverlay.html#gst-video-overlay-expose" title="gst_video_overlay_expose ()"><code class="function">gst_video_overlay_expose()</code></a> to force a redraw. To unset the region pass -1 for 779the <em class="parameter"><code>width</code></em> 780 and <em class="parameter"><code>height</code></em> 781 parameters.</p> 782<p>This method is needed for non fullscreen video overlay in UI toolkits that 783do not support subwindows.</p> 784<div class="refsect3"> 785<a name="gst-video-overlay-set-render-rectangle.parameters"></a><h4>Parameters</h4> 786<div class="informaltable"><table class="informaltable" width="100%" border="0"> 787<colgroup> 788<col width="150px" class="parameters_name"> 789<col class="parameters_description"> 790<col width="200px" class="parameters_annotations"> 791</colgroup> 792<tbody> 793<tr> 794<td class="parameter_name"><p>overlay</p></td> 795<td class="parameter_description"><p>a <a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a></p></td> 796<td class="parameter_annotations"> </td> 797</tr> 798<tr> 799<td class="parameter_name"><p>x</p></td> 800<td class="parameter_description"><p>the horizontal offset of the render area inside the window</p></td> 801<td class="parameter_annotations"> </td> 802</tr> 803<tr> 804<td class="parameter_name"><p>y</p></td> 805<td class="parameter_description"><p>the vertical offset of the render area inside the window</p></td> 806<td class="parameter_annotations"> </td> 807</tr> 808<tr> 809<td class="parameter_name"><p>width</p></td> 810<td class="parameter_description"><p>the width of the render area inside the window</p></td> 811<td class="parameter_annotations"> </td> 812</tr> 813<tr> 814<td class="parameter_name"><p>height</p></td> 815<td class="parameter_description"><p>the height of the render area inside the window</p></td> 816<td class="parameter_annotations"> </td> 817</tr> 818</tbody> 819</table></div> 820</div> 821<div class="refsect3"> 822<a name="gst-video-overlay-set-render-rectangle.returns"></a><h4>Returns</h4> 823<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if not supported by the sink.</p> 824</div> 825</div> 826<hr> 827<div class="refsect2"> 828<a name="gst-is-video-overlay-prepare-window-handle-message"></a><h3>gst_is_video_overlay_prepare_window_handle_message ()</h3> 829<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 830gst_is_video_overlay_prepare_window_handle_message 831 (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstMessage.html#GstMessage-struct"><span class="type">GstMessage</span></a> *msg</code></em>);</pre> 832<p>Convenience function to check if the given message is a 833"prepare-window-handle" message from a <a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a>.</p> 834<div class="refsect3"> 835<a name="gst-is-video-overlay-prepare-window-handle-message.parameters"></a><h4>Parameters</h4> 836<div class="informaltable"><table class="informaltable" width="100%" border="0"> 837<colgroup> 838<col width="150px" class="parameters_name"> 839<col class="parameters_description"> 840<col width="200px" class="parameters_annotations"> 841</colgroup> 842<tbody><tr> 843<td class="parameter_name"><p>msg</p></td> 844<td class="parameter_description"><p>a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstMessage.html#GstMessage-struct"><span class="type">GstMessage</span></a></p></td> 845<td class="parameter_annotations"> </td> 846</tr></tbody> 847</table></div> 848</div> 849<div class="refsect3"> 850<a name="gst-is-video-overlay-prepare-window-handle-message.returns"></a><h4>Returns</h4> 851<p> whether <em class="parameter"><code>msg</code></em> 852is a "prepare-window-handle" message</p> 853</div> 854</div> 855<hr> 856<div class="refsect2"> 857<a name="gst-video-overlay-install-properties"></a><h3>gst_video_overlay_install_properties ()</h3> 858<pre class="programlisting"><span class="returnvalue">void</span> 859gst_video_overlay_install_properties (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObjectClass"><span class="type">GObjectClass</span></a> *oclass</code></em>, 860 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> last_prop_id</code></em>);</pre> 861<p>This helper shall be used by classes implementing the <a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a> 862interface that want the render rectangle to be controllable using 863properties. This helper will install "render-rectangle" property into the 864class.</p> 865<div class="refsect3"> 866<a name="gst-video-overlay-install-properties.parameters"></a><h4>Parameters</h4> 867<div class="informaltable"><table class="informaltable" width="100%" border="0"> 868<colgroup> 869<col width="150px" class="parameters_name"> 870<col class="parameters_description"> 871<col width="200px" class="parameters_annotations"> 872</colgroup> 873<tbody> 874<tr> 875<td class="parameter_name"><p>oclass</p></td> 876<td class="parameter_description"><p>The class on which the properties will be installed</p></td> 877<td class="parameter_annotations"> </td> 878</tr> 879<tr> 880<td class="parameter_name"><p>last_prop_id</p></td> 881<td class="parameter_description"><p>The first free property ID to use</p></td> 882<td class="parameter_annotations"> </td> 883</tr> 884</tbody> 885</table></div> 886</div> 887<p class="since">Since: <a class="link" href="ix04.html#api-index-1.14">1.14</a></p> 888</div> 889<hr> 890<div class="refsect2"> 891<a name="gst-video-overlay-set-property"></a><h3>gst_video_overlay_set_property ()</h3> 892<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 893gst_video_overlay_set_property (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> *object</code></em>, 894 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> last_prop_id</code></em>, 895 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> property_id</code></em>, 896 <em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/gobject/gobject-Generic-values.html#GValue-struct"><span class="type">GValue</span></a> *value</code></em>);</pre> 897<p>This helper shall be used by classes implementing the <a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a> 898interface that want the render rectangle to be controllable using 899properties. This helper will parse and set the render rectangle calling 900<a class="link" href="GstVideoOverlay.html#gst-video-overlay-set-render-rectangle" title="gst_video_overlay_set_render_rectangle ()"><code class="function">gst_video_overlay_set_render_rectangle()</code></a>.</p> 901<div class="refsect3"> 902<a name="gst-video-overlay-set-property.parameters"></a><h4>Parameters</h4> 903<div class="informaltable"><table class="informaltable" width="100%" border="0"> 904<colgroup> 905<col width="150px" class="parameters_name"> 906<col class="parameters_description"> 907<col width="200px" class="parameters_annotations"> 908</colgroup> 909<tbody> 910<tr> 911<td class="parameter_name"><p>object</p></td> 912<td class="parameter_description"><p>The instance on which the property is set</p></td> 913<td class="parameter_annotations"> </td> 914</tr> 915<tr> 916<td class="parameter_name"><p>last_prop_id</p></td> 917<td class="parameter_description"><p>The highest property ID.</p></td> 918<td class="parameter_annotations"> </td> 919</tr> 920<tr> 921<td class="parameter_name"><p>property_id</p></td> 922<td class="parameter_description"><p>The property ID</p></td> 923<td class="parameter_annotations"> </td> 924</tr> 925<tr> 926<td class="parameter_name"><p>value</p></td> 927<td class="parameter_description"><p>The <a href="/usr/share/gtk-doc/html/gobject/gobject-Generic-values.html#GValue-struct"><span class="type">GValue</span></a> to be set</p></td> 928<td class="parameter_annotations"> </td> 929</tr> 930</tbody> 931</table></div> 932</div> 933<div class="refsect3"> 934<a name="gst-video-overlay-set-property.returns"></a><h4>Returns</h4> 935<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the <em class="parameter"><code>property_id</code></em> 936matches the GstVideoOverlay property</p> 937</div> 938<p class="since">Since: <a class="link" href="ix04.html#api-index-1.14">1.14</a></p> 939</div> 940</div> 941<div class="refsect1"> 942<a name="GstVideoOverlay.other_details"></a><h2>Types and Values</h2> 943<div class="refsect2"> 944<a name="GstVideoOverlay-struct"></a><h3>GstVideoOverlay</h3> 945<pre class="programlisting">typedef struct _GstVideoOverlay GstVideoOverlay;</pre> 946<p>Opaque <a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a> interface structure</p> 947</div> 948<hr> 949<div class="refsect2"> 950<a name="GstVideoOverlayInterface"></a><h3>struct GstVideoOverlayInterface</h3> 951<pre class="programlisting">struct GstVideoOverlayInterface { 952 GTypeInterface iface; 953 954 /* virtual functions */ 955 void (*expose) (GstVideoOverlay *overlay); 956 957 void (*handle_events) (GstVideoOverlay *overlay, gboolean handle_events); 958 959 void (*set_render_rectangle) (GstVideoOverlay *overlay, 960 gint x, gint y, 961 gint width, gint height); 962 963 void (*set_window_handle) (GstVideoOverlay *overlay, guintptr handle); 964}; 965</pre> 966<p><a class="link" href="GstVideoOverlay.html" title="GstVideoOverlay"><span class="type">GstVideoOverlay</span></a> interface</p> 967<div class="refsect3"> 968<a name="GstVideoOverlayInterface.members"></a><h4>Members</h4> 969<div class="informaltable"><table class="informaltable" width="100%" border="0"> 970<colgroup> 971<col width="300px" class="struct_members_name"> 972<col class="struct_members_description"> 973<col width="200px" class="struct_members_annotations"> 974</colgroup> 975<tbody> 976<tr> 977<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#GTypeInterface"><span class="type">GTypeInterface</span></a> <em class="structfield"><code><a name="GstVideoOverlayInterface.iface"></a>iface</code></em>;</p></td> 978<td class="struct_member_description"><p>parent interface type.</p></td> 979<td class="struct_member_annotations"> </td> 980</tr> 981<tr> 982<td class="struct_member_name"><p><em class="structfield"><code><a name="GstVideoOverlayInterface.expose"></a>expose</code></em> ()</p></td> 983<td class="struct_member_description"><p>virtual method to handle expose events</p></td> 984<td class="struct_member_annotations"> </td> 985</tr> 986<tr> 987<td class="struct_member_name"><p><em class="structfield"><code><a name="GstVideoOverlayInterface.handle-events"></a>handle_events</code></em> ()</p></td> 988<td class="struct_member_description"><p>virtual method to handle events</p></td> 989<td class="struct_member_annotations"> </td> 990</tr> 991<tr> 992<td class="struct_member_name"><p><em class="structfield"><code><a name="GstVideoOverlayInterface.set-render-rectangle"></a>set_render_rectangle</code></em> ()</p></td> 993<td class="struct_member_description"><p>virtual method to set the render rectangle</p></td> 994<td class="struct_member_annotations"> </td> 995</tr> 996<tr> 997<td class="struct_member_name"><p><em class="structfield"><code><a name="GstVideoOverlayInterface.set-window-handle"></a>set_window_handle</code></em> ()</p></td> 998<td class="struct_member_description"><p>virtual method to configure the window handle</p></td> 999<td class="struct_member_annotations"> </td> 1000</tr> 1001</tbody> 1002</table></div> 1003</div> 1004</div> 1005</div> 1006</div> 1007<div class="footer"> 1008<hr>Generated by GTK-Doc V1.28</div> 1009</body> 1010</html>