blob: a8990b1fdea3b61dd43ac1a6168592d6419406a1 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ximagesink: GStreamer Base Plugins 1.0 Plugins Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GStreamer Base Plugins 1.0 Plugins Reference Manual">
<link rel="up" href="ch01.html" title="gst-plugins-base Elements">
<link rel="prev" href="gst-plugins-base-plugins-vorbistag.html" title="vorbistag">
<link rel="next" href="gst-plugins-base-plugins-xvimagesink.html" title="xvimagesink">
<meta name="generator" content="GTK-Doc V1.25 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</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="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
<a href="#gst-plugins-base-plugins-ximagesink.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
<a href="#gst-plugins-base-plugins-ximagesink.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_interfaces">  <span class="dim">|</span> 
<a href="#gst-plugins-base-plugins-ximagesink.implemented-interfaces" class="shortcut">Implemented Interfaces</a></span><span id="nav_properties">  <span class="dim">|</span> 
<a href="#gst-plugins-base-plugins-ximagesink.properties" class="shortcut">Properties</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="gst-plugins-base-plugins-vorbistag.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gst-plugins-base-plugins-xvimagesink.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="gst-plugins-base-plugins-ximagesink"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gst-plugins-base-plugins-ximagesink.top_of_page"></a>ximagesink</span></h2>
<p>ximagesink</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="gst-plugins-base-plugins-ximagesink.properties"></a><h2>Properties</h2>
<div class="informaltable"><table class="informaltable" border="0">
<colgroup>
<col width="150px" class="properties_type">
<col width="300px" class="properties_name">
<col width="200px" class="properties_flags">
</colgroup>
<tbody>
<tr>
<td class="property_type">
<a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</td>
<td class="property_name"><a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--display" title="The “display” property">display</a></td>
<td class="property_flags">Read / Write</td>
</tr>
<tr>
<td class="property_type"><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
<td class="property_name"><a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--force-aspect-ratio" title="The “force-aspect-ratio” property">force-aspect-ratio</a></td>
<td class="property_flags">Read / Write</td>
</tr>
<tr>
<td class="property_type"><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
<td class="property_name"><a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--handle-events" title="The “handle-events” property">handle-events</a></td>
<td class="property_flags">Read / Write</td>
</tr>
<tr>
<td class="property_type"><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
<td class="property_name"><a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--handle-expose" title="The “handle-expose” property">handle-expose</a></td>
<td class="property_flags">Read / Write</td>
</tr>
<tr>
<td class="property_type">
<a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</td>
<td class="property_name"><a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--pixel-aspect-ratio" title="The “pixel-aspect-ratio” property">pixel-aspect-ratio</a></td>
<td class="property_flags">Read / Write</td>
</tr>
<tr>
<td class="property_type"><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
<td class="property_name"><a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--synchronous" title="The “synchronous” property">synchronous</a></td>
<td class="property_flags">Read / Write</td>
</tr>
<tr>
<td class="property_type"><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a></td>
<td class="property_name"><a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--window-height" title="The “window-height” property">window-height</a></td>
<td class="property_flags">Read</td>
</tr>
<tr>
<td class="property_type"><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a></td>
<td class="property_name"><a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--window-width" title="The “window-width” property">window-width</a></td>
<td class="property_flags">Read</td>
</tr>
</tbody>
</table></div>
</div>
<a name="GstXImageSink"></a><div class="refsect1">
<a name="gst-plugins-base-plugins-ximagesink.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody><tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink-struct" title="struct GstXImageSink">GstXImageSink</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="gst-plugins-base-plugins-ximagesink.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen"> <a href="/usr/share/gtk-doc/html/gobjectgobject-The-Base-Object-Type.html#GObject-struct">GObject</a>
<span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gobjectgobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
<span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0GstObject.html#GstObject-struct">GstObject</a>
<span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0GstElement.html#GstElement-struct">GstElement</a>
<span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-libs-1.0GstBaseSink.html#GstBaseSink-struct">GstBaseSink</a>
<span class="lineart">╰──</span> <a href="../html/gst-plugins-base-libs-gstvideosink.html#GstVideoSink-struct">GstVideoSink</a>
<span class="lineart">╰──</span> GstXImageSink
</pre>
</div>
<div class="refsect1">
<a name="gst-plugins-base-plugins-ximagesink.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
<p>
GstXImageSink implements
<a href="../html/gst-plugins-base-libs-gstnavigation.html#GstNavigation-struct">GstNavigation</a> and <a href="../html/gst-plugins-base-libs-gstvideooverlay.html#GstVideoOverlay-struct">GstVideoOverlay</a>.</p>
</div>
<div class="refsect1">
<a name="gst-plugins-base-plugins-ximagesink.description"></a><h2>Description</h2>
<p>XImageSink renders video frames to a drawable (XWindow) on a local or remote
display. This element can receive a Window ID from the application through
the <a href="../html/gst-plugins-base-libs-gstvideooverlay.html#GstVideoOverlay-struct"><span class="type">GstVideoOverlay</span></a> interface and will then render video frames in this
drawable. If no Window ID was provided by the application, the element will
create its own internal window and render into it.</p>
<div class="refsect2">
<a name="id-1.2.62.8.3"></a><h3>Scaling</h3>
<p>
As standard XImage rendering to a drawable is not scaled, XImageSink will use
reverse caps negotiation to try to get scaled video frames for the drawable.
This is accomplished by asking the peer pad if it accepts some different caps
which in most cases implies that there is a scaling element in the pipeline,
or that an element generating the video frames can generate them with a
different geometry. This mechanism is handled during buffer allocations, for
each allocation request the video sink will check the drawable geometry, look
at the <a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--force-aspect-ratio" title="The “force-aspect-ratio” property"><span class="type">“force-aspect-ratio”</span></a> property, calculate the geometry of
desired video frames and then check that the peer pad accept those new caps.
If it does it will then allocate a buffer in video memory with this new
geometry and return it with the new caps.
</p>
</div>
<hr>
<div class="refsect2">
<a name="id-1.2.62.8.4"></a><h3>Events</h3>
<p>
XImageSink creates a thread to handle events coming from the drawable. There
are several kind of events that can be grouped in 2 big categories: input
events and window state related events. Input events will be translated to
navigation events and pushed upstream for other elements to react on them.
This includes events such as pointer moves, key press/release, clicks etc...
Other events are used to handle the drawable appearance even when the data
is not flowing (GST_STATE_PAUSED). That means that even when the element is
paused, it will receive expose events from the drawable and draw the latest
frame with correct borders/aspect-ratio.
</p>
</div>
<hr>
<div class="refsect2">
<a name="id-1.2.62.8.5"></a><h3>Pixel aspect ratio</h3>
<p>
When changing state to GST_STATE_READY, XImageSink will open a connection to
the display specified in the <a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--display" title="The “display” property"><span class="type">“display”</span></a> property or the default
display if nothing specified. Once this connection is open it will inspect
the display configuration including the physical display geometry and
then calculate the pixel aspect ratio. When caps negotiation will occur, the
video sink will set the calculated pixel aspect ratio on the caps to make
sure that incoming video frames will have the correct pixel aspect ratio for
this display. Sometimes the calculated pixel aspect ratio can be wrong, it is
then possible to enforce a specific pixel aspect ratio using the
<a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--pixel-aspect-ratio" title="The “pixel-aspect-ratio” property"><span class="type">“pixel-aspect-ratio”</span></a> property.
</p>
</div>
<hr>
<div class="refsect2">
<a name="id-1.2.62.8.6"></a><h3>Examples</h3>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1</pre></td>
<td class="listing_code"><pre class="programlisting">gst<span class="gtkdoc opt">-</span>launch<span class="gtkdoc opt">-</span><span class="number">1.0</span> <span class="gtkdoc opt">-</span>v videotestsrc <span class="gtkdoc opt">!</span> queue <span class="gtkdoc opt">!</span> ximagesink</pre></td>
</tr>
</tbody>
</table>
</div>
A pipeline to test reverse negotiation. When the test video signal appears
you can resize the window and see that scaled buffers of the desired size are
going to arrive with a short delay. This illustrates how buffers of desired
size are allocated along the way. If you take away the queue, scaling will
happen almost immediately.
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1</pre></td>
<td class="listing_code"><pre class="programlisting">gst<span class="gtkdoc opt">-</span>launch<span class="gtkdoc opt">-</span><span class="number">1.0</span> <span class="gtkdoc opt">-</span>v videotestsrc <span class="gtkdoc opt">!</span> navigationtest <span class="gtkdoc opt">!</span> videoconvert <span class="gtkdoc opt">!</span> ximagesink</pre></td>
</tr>
</tbody>
</table>
</div>
A pipeline to test navigation events.
While moving the mouse pointer over the test signal you will see a black box
following the mouse pointer. If you press the mouse button somewhere on the
video and release it somewhere else a green box will appear where you pressed
the button and a red one where you released it. (The navigationtest element
is part of gst-plugins-good.)
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1</pre></td>
<td class="listing_code"><pre class="programlisting">gst<span class="gtkdoc opt">-</span>launch<span class="gtkdoc opt">-</span><span class="number">1.0</span> <span class="gtkdoc opt">-</span>v videotestsrc <span class="gtkdoc opt">!</span> video<span class="gtkdoc opt">/</span>x<span class="gtkdoc opt">-</span>raw<span class="gtkdoc opt">,</span> pixel<span class="gtkdoc opt">-</span>aspect<span class="gtkdoc opt">-</span>ratio<span class="gtkdoc opt">=(</span>fraction<span class="gtkdoc opt">)</span><span class="number">4</span><span class="gtkdoc opt">/</span><span class="number">3</span> <span class="gtkdoc opt">!</span> videoscale <span class="gtkdoc opt">!</span> ximagesink</pre></td>
</tr>
</tbody>
</table>
</div>
This is faking a 4/3 pixel aspect ratio caps on video frames produced by
videotestsrc, in most cases the pixel aspect ratio of the display will be
1/1. This means that videoscale will have to do the scaling to convert
incoming frames to a size that will match the display pixel aspect ratio
(from 320x240 to 320x180 in this case). Note that you might have to escape
some characters for your shell like '\(fraction\)'.
</div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="refsect2">
<a name="id-1.2.62.8.7.1"></a><h3>Element Information</h3>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">plugin</span></p></td>
<td>
<a class="link" href="gst-plugins-base-plugins-plugin-ximagesink.html#plugin-ximagesink">ximagesink</a>
</td>
</tr>
<tr>
<td><p><span class="term">author</span></p></td>
<td>Julien Moutte &lt;julien@moutte.net&gt;</td>
</tr>
<tr>
<td><p><span class="term">class</span></p></td>
<td>Sink/Video</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="id-1.2.62.8.7.2"></a><h3>Element Pads</h3>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">name</span></p></td>
<td>sink</td>
</tr>
<tr>
<td><p><span class="term">direction</span></p></td>
<td>sink</td>
</tr>
<tr>
<td><p><span class="term">presence</span></p></td>
<td>always</td>
</tr>
<tr>
<td><p><span class="term">details</span></p></td>
<td>video/x-raw, framerate=(fraction)[ 0/1, 2147483647/1 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="refsect1">
<a name="gst-plugins-base-plugins-ximagesink.functions_details"></a><h2>Functions</h2>
<p></p>
</div>
<div class="refsect1">
<a name="gst-plugins-base-plugins-ximagesink.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GstXImageSink-struct"></a><h3>struct GstXImageSink</h3>
<pre class="programlisting">struct GstXImageSink;</pre>
<p>The <a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink"><span class="type">GstXImageSink</span></a> data structure.</p>
<div class="refsect3">
<a name="GstXImageSink.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody></tbody>
</table></div>
</div>
</div>
</div>
<div class="refsect1">
<a name="gst-plugins-base-plugins-ximagesink.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="GstXImageSink--display"></a><h3>The <code class="literal">“display”</code> property</h3>
<pre class="programlisting"> “display” <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</pre>
<p>X Display name.</p>
<p>Flags: Read / Write</p>
<p>Default value: NULL</p>
</div>
<hr>
<div class="refsect2">
<a name="GstXImageSink--force-aspect-ratio"></a><h3>The <code class="literal">“force-aspect-ratio”</code> property</h3>
<pre class="programlisting"> “force-aspect-ratio” <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
<p>When enabled, reverse caps negotiation (scaling) will respect original aspect ratio.</p>
<p>Flags: Read / Write</p>
<p>Default value: TRUE</p>
</div>
<hr>
<div class="refsect2">
<a name="GstXImageSink--handle-events"></a><h3>The <code class="literal">“handle-events”</code> property</h3>
<pre class="programlisting"> “handle-events” <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
<p>When enabled, XEvents will be selected and handled.</p>
<p>Flags: Read / Write</p>
<p>Default value: TRUE</p>
</div>
<hr>
<div class="refsect2">
<a name="GstXImageSink--handle-expose"></a><h3>The <code class="literal">“handle-expose”</code> property</h3>
<pre class="programlisting"> “handle-expose” <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
<p>When enabled, the current frame will always be drawn in response to X Expose events.</p>
<p>Flags: Read / Write</p>
<p>Default value: TRUE</p>
</div>
<hr>
<div class="refsect2">
<a name="GstXImageSink--pixel-aspect-ratio"></a><h3>The <code class="literal">“pixel-aspect-ratio”</code> property</h3>
<pre class="programlisting"> “pixel-aspect-ratio” <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</pre>
<p>The pixel aspect ratio of the device.</p>
<p>Flags: Read / Write</p>
<p>Default value: "1/1"</p>
</div>
<hr>
<div class="refsect2">
<a name="GstXImageSink--synchronous"></a><h3>The <code class="literal">“synchronous”</code> property</h3>
<pre class="programlisting"> “synchronous” <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
<p>When enabled, runs the X display in synchronous mode. (unrelated to A/V sync, used only for debugging).</p>
<p>Flags: Read / Write</p>
<p>Default value: FALSE</p>
</div>
<hr>
<div class="refsect2">
<a name="GstXImageSink--window-height"></a><h3>The <code class="literal">“window-height”</code> property</h3>
<pre class="programlisting"> “window-height” <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a></pre>
<p>Actual height of the video window.</p>
<p>Flags: Read</p>
<p>Default value: 0</p>
</div>
<hr>
<div class="refsect2">
<a name="GstXImageSink--window-width"></a><h3>The <code class="literal">“window-width”</code> property</h3>
<pre class="programlisting"> “window-width” <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a></pre>
<p>Actual width of the video window.</p>
<p>Flags: Read</p>
<p>Default value: 0</p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25</div>
</body>
</html>