<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>gstxoverlay</title> <meta name="generator" content="DocBook XSL Stylesheets V1.72.0"> <link rel="start" href="index.html" title="GStreamer Base Plugins 0.10 Library Reference Manual"> <link rel="up" href="gstreamer-interfaces.html" title="Interfaces Library"> <link rel="prev" href="gst-plugins-base-libs-gstvideoorientation.html" title="gstvideoorientation"> <link rel="next" href="gstreamer-netbuffer.html" title="Network Buffer Library"> <meta name="generator" content="GTK-Doc V1.8 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> <link rel="part" href="gstreamer-plugins-base.html" title="Part I. GStreamer Base Plugins Libraries"> <link rel="chapter" href="gstreamer-audio.html" title="Audio Library"> <link rel="chapter" href="gstreamer-cdda.html" title="CDDA Library"> <link rel="chapter" href="gstreamer-ffft.html" title="FFT Library"> <link rel="chapter" href="gstreamer-floatcast.html" title="FloatCast Library"> <link rel="chapter" href="gstreamer-interfaces.html" title="Interfaces Library"> <link rel="chapter" href="gstreamer-netbuffer.html" title="Network Buffer Library"> <link rel="chapter" href="gstreamer-riff.html" title="Riff Media Library"> <link rel="chapter" href="gstreamer-rtp.html" title="RTP Library"> <link rel="chapter" href="gstreamer-rtsp.html" title="RTSP Library"> <link rel="chapter" href="gstreamer-sdp.html" title="SDP Library"> <link rel="chapter" href="gstreamer-tag.html" title="Tag Support Library"> <link rel="chapter" href="gstreamer-base-utils.html" title="Base Utils Library"> <link rel="chapter" href="gstreamer-video.html" title="Video Library"> <link rel="part" href="gstreamer-libs-hierarchy.html" title="Part II. Object Hierarchy"> <link rel="index" href="api-index.html" title="Index"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"> <tr valign="middle"> <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> <td><a accesskey="u" href="gstreamer-interfaces.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> <th width="100%" align="center">GStreamer Base Plugins 0.10 Library Reference Manual</th> <td><a accesskey="n" href="gstreamer-netbuffer.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> </tr> <tr><td colspan="5" class="shortcuts"><nobr><a href="#id2623126" class="shortcut">Top</a>  |  <a href="#id2623354" class="shortcut">Description</a>  |  <a href="#id2623293" class="shortcut">Object Hierarchy</a>  |  <a href="#id2623318" class="shortcut">Prerequisites</a></nobr></td></tr> </table> <div class="refentry" lang="en"> <a name="gst-plugins-base-libs-gstxoverlay"></a><div class="titlepage"></div> <div class="refnamediv"><table width="100%"><tr> <td valign="top"> <h2> <a name="id2623126"></a><span class="refentrytitle">gstxoverlay</span> </h2> <p>gstxoverlay — Interface for setting/getting a Window on elements supporting it</p> </td> <td valign="top" align="right"></td> </tr></table></div> <div class="refsynopsisdiv"> <h2>Synopsis</h2> <a name="GstXOverlay"></a><pre class="synopsis"> #include <gst/interfaces/xoverlay.h> <a href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay-struct">GstXOverlay</a>; void <a href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-set-xwindow-id">gst_x_overlay_set_xwindow_id</a> (<a href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay">GstXOverlay</a> *overlay, gulong xwindow_id); void <a href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-got-xwindow-id">gst_x_overlay_got_xwindow_id</a> (<a href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay">GstXOverlay</a> *overlay, gulong xwindow_id); void <a href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-prepare-xwindow-id">gst_x_overlay_prepare_xwindow_id</a> (<a href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay">GstXOverlay</a> *overlay); void <a href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-expose">gst_x_overlay_expose</a> (<a href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay">GstXOverlay</a> *overlay); void <a href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-handle-events">gst_x_overlay_handle_events</a> (<a href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay">GstXOverlay</a> *overlay, gboolean handle_events); </pre> </div> <div class="refsect1" lang="en"> <a name="id2623293"></a><h2>Object Hierarchy</h2> <pre class="synopsis"> GInterface +----GstXOverlay </pre> </div> <div class="refsect1" lang="en"> <a name="id2623318"></a><h2>Prerequisites</h2> <p> GstXOverlay requires GstObject, GstImplementsInterface and GstElement.</p> </div> <div class="refsect1" lang="en"> <a name="id2623354"></a><h2>Description</h2> <p> </p> <div class="refsect2" lang="en"> <a name="id2623367"></a><p> The XOverlay interface is used for 2 main purposes : </p> <div class="itemizedlist"><ul type="disc"> <li><p> To get a grab on the Window where the video sink element is going to render. This is achieved by either being informed about the Window identifier that the video sink element generated, or by forcing the video sink element to use a specific Window identifier for rendering. </p></li> <li><p> To force a redrawing of the latest video frame the video sink element displayed on the Window. Indeed if the <span class="type">GstPipeline</span> is in <span class="type">GST_STATE_PAUSED</span> state, moving the Window around will damage its content. Application developers will want to handle the Expose events themselves and force the video sink element to refresh the Window's content. </p></li> </ul></div> <p> </p> <p> Using the Window created by the video sink is probably the simplest scenario, in some cases, though, it might not be flexible enough for application developers if they need to catch events such as mouse moves and button clicks. </p> <p> Setting a specific Window identifier on the video sink element is the most flexible solution but it has some issues. Indeed the application needs to set its Window identifier at the right time to avoid internal Window creation from the video sink element. To solve this issue a <span class="type">GstMessage</span> is posted on the bus to inform the application that it should set the Window identifier immediately. Here is an example on how to do that correctly: </p> <pre class="programlisting"> static GstBusSyncReply create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline) { // ignore anything but 'prepare-xwindow-id' element messages if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT) return GST_BUS_PASS; if (!gst_structure_has_name (message->structure, "prepare-xwindow-id")) return GST_BUS_PASS; win = XCreateSimpleWindow (disp, root, 0, 0, 320, 240, 0, 0, 0); XSetWindowBackgroundPixmap (disp, win, None); XMapRaised (disp, win); XSync (disp, FALSE); gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)), win); gst_message_unref (message); return GST_BUS_DROP; } ... int main (int argc, char **argv) { ... bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, pipeline); ... } </pre> <p> </p> </div> <p> </p> </div> <div class="refsect1" lang="en"> <a name="id2623500"></a><h2>Details</h2> <div class="refsect2" lang="en"> <a name="id2623511"></a><h3> <a name="GstXOverlay-struct"></a>GstXOverlay</h3> <a class="indexterm" name="id2623523"></a><pre class="programlisting">typedef struct _GstXOverlay GstXOverlay;</pre> <p> </p> </div> <hr> <div class="refsect2" lang="en"> <a name="id2623537"></a><h3> <a name="gst-x-overlay-set-xwindow-id"></a>gst_x_overlay_set_xwindow_id ()</h3> <a class="indexterm" name="id2623551"></a><pre class="programlisting">void gst_x_overlay_set_xwindow_id (<a href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay">GstXOverlay</a> *overlay, gulong xwindow_id);</pre> <p> This will call the video overlay's set_xwindow_id method. You should use this method to tell to a XOverlay to display video output to a specific XWindow. Passing 0 as the xwindow_id will tell the overlay to stop using that window and create an internal one.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><span class="term"><em class="parameter"><code>overlay</code></em> :</span></td> <td> a <a href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> to set the XWindow on. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>xwindow_id</code></em> :</span></td> <td> a <span class="type">XID</span> referencing the XWindow. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> <a name="id2623644"></a><h3> <a name="gst-x-overlay-got-xwindow-id"></a>gst_x_overlay_got_xwindow_id ()</h3> <a class="indexterm" name="id2623657"></a><pre class="programlisting">void gst_x_overlay_got_xwindow_id (<a href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay">GstXOverlay</a> *overlay, gulong xwindow_id);</pre> <p> This will post a "have-xwindow-id" element message on the bus. </p> <p> This function should only be used by video overlay plugin developers.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><span class="term"><em class="parameter"><code>overlay</code></em> :</span></td> <td> a <a href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> which got a XWindow. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>xwindow_id</code></em> :</span></td> <td> a <span class="type">XID</span> referencing the XWindow. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> <a name="id2623751"></a><h3> <a name="gst-x-overlay-prepare-xwindow-id"></a>gst_x_overlay_prepare_xwindow_id ()</h3> <a class="indexterm" name="id2623764"></a><pre class="programlisting">void gst_x_overlay_prepare_xwindow_id (<a href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay">GstXOverlay</a> *overlay);</pre> <p> This will post a "prepare-xwindow-id" element message on the bus to give applications an opportunity to call <a href="gst-plugins-base-libs-gstxoverlay.html#gst-x-overlay-set-xwindow-id"><code class="function">gst_x_overlay_set_xwindow_id()</code></a> before a plugin creates its own window. </p> <p> This function should only be used by video overlay plugin developers.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody><tr> <td><span class="term"><em class="parameter"><code>overlay</code></em> :</span></td> <td> a <a href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> which does not yet have an XWindow. </td> </tr></tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> <a name="id2623840"></a><h3> <a name="gst-x-overlay-expose"></a>gst_x_overlay_expose ()</h3> <a class="indexterm" name="id2623853"></a><pre class="programlisting">void gst_x_overlay_expose (<a href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay">GstXOverlay</a> *overlay);</pre> <p> Tell an overlay that it has been exposed. This will redraw the current frame in the drawable even if the pipeline is PAUSED.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody><tr> <td><span class="term"><em class="parameter"><code>overlay</code></em> :</span></td> <td> a <a href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> to expose. </td> </tr></tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> <a name="id2623913"></a><h3> <a name="gst-x-overlay-handle-events"></a>gst_x_overlay_handle_events ()</h3> <a class="indexterm" name="id2623927"></a><pre class="programlisting">void gst_x_overlay_handle_events (<a href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay">GstXOverlay</a> *overlay, gboolean handle_events);</pre> <p> Tell an overlay that it should handle events from the window system. These events are forwared upstream as navigation events. In some window system, events are not propagated in the window hierarchy if a client is listening for them. This method allows you to disable events handling completely from the XOverlay.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><span class="term"><em class="parameter"><code>overlay</code></em> :</span></td> <td> a <a href="gst-plugins-base-libs-gstxoverlay.html#GstXOverlay"><span class="type">GstXOverlay</span></a> to expose. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>handle_events</code></em> :</span></td> <td> a <span class="type">gboolean</span> indicating if events should be handled or not. </td> </tr> </tbody> </table></div> </div> </div> </div> </body> </html>