42d6ec76116a600be0577099b7cbe6f24c3b61ab
[framework/multimedia/gst-plugins-base0.10.git] / docs / plugins / html / gst-plugins-base-plugins-ximagesink.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>ximagesink</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7 <link rel="home" href="index.html" title="GStreamer Base Plugins 0.10 Plugins Reference Manual">
8 <link rel="up" href="ch01.html" title="gst-plugins-base Elements">
9 <link rel="prev" href="gst-plugins-base-plugins-vorbistag.html" title="vorbistag">
10 <link rel="next" href="gst-plugins-base-plugins-xvimagesink.html" title="xvimagesink">
11 <meta name="generator" content="GTK-Doc V1.17 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
16 <tr valign="middle">
17 <td><a accesskey="p" href="gst-plugins-base-plugins-vorbistag.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18 <td><a accesskey="u" href="ch01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20 <th width="100%" align="center">GStreamer Base Plugins 0.10 Plugins Reference Manual</th>
21 <td><a accesskey="n" href="gst-plugins-base-plugins-xvimagesink.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
22 </tr>
23 <tr><td colspan="5" class="shortcuts">
24 <a href="#gst-plugins-base-plugins-ximagesink.synopsis" class="shortcut">Top</a>
25                    | 
26                   <a href="#gst-plugins-base-plugins-ximagesink.description" class="shortcut">Description</a>
27                    | 
28                   <a href="#gst-plugins-base-plugins-ximagesink.object-hierarchy" class="shortcut">Object Hierarchy</a>
29                    | 
30                   <a href="#gst-plugins-base-plugins-ximagesink.implemented-interfaces" class="shortcut">Implemented Interfaces</a>
31                    | 
32                   <a href="#gst-plugins-base-plugins-ximagesink.properties" class="shortcut">Properties</a>
33 </td></tr>
34 </table>
35 <div class="refentry">
36 <a name="gst-plugins-base-plugins-ximagesink"></a><div class="titlepage"></div>
37 <div class="refnamediv"><table width="100%"><tr>
38 <td valign="top">
39 <h2><span class="refentrytitle"><a name="gst-plugins-base-plugins-ximagesink.top_of_page"></a>ximagesink</span></h2>
40 <p>ximagesink — A standard X based videosink</p>
41 </td>
42 <td valign="top" align="right"></td>
43 </tr></table></div>
44 <div class="refsynopsisdiv">
45 <a name="gst-plugins-base-plugins-ximagesink.synopsis"></a><h2>Synopsis</h2>
46 <a name="GstXImageSink"></a><pre class="synopsis">struct              <a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink-struct" title="struct GstXImageSink">GstXImageSink</a>;
47 </pre>
48 </div>
49 <div class="refsect1">
50 <a name="gst-plugins-base-plugins-ximagesink.object-hierarchy"></a><h2>Object Hierarchy</h2>
51 <pre class="synopsis">
52   <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
53    +----<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
54          +----<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
55                +----<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseSink.html">GstBaseSink</a>
56                      +----<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideosink.html#GstVideoSink">GstVideoSink</a>
57                            +----GstXImageSink
58 </pre>
59 </div>
60 <div class="refsect1">
61 <a name="gst-plugins-base-plugins-ximagesink.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
62 <p>
63 GstXImageSink implements
64  <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstImplementsInterface.html">GstImplementsInterface</a>,  <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstnavigation.html#GstNavigation">GstNavigation</a> and  <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstxoverlay.html#GstXOverlay">GstXOverlay</a>.</p>
65 </div>
66 <div class="refsect1">
67 <a name="gst-plugins-base-plugins-ximagesink.properties"></a><h2>Properties</h2>
68 <pre class="synopsis">
69   "<a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--display" title='The "display" property'>display</a>"                  <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Read / Write
70   "<a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--pixel-aspect-ratio" title='The "pixel-aspect-ratio" property'>pixel-aspect-ratio</a>"       <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Read / Write
71   "<a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--synchronous" title='The "synchronous" property'>synchronous</a>"              <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write
72   "<a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--force-aspect-ratio" title='The "force-aspect-ratio" property'>force-aspect-ratio</a>"       <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write
73   "<a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--handle-events" title='The "handle-events" property'>handle-events</a>"            <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write
74   "<a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--handle-expose" title='The "handle-expose" property'>handle-expose</a>"            <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write
75   "<a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--window-height" title='The "window-height" property'>window-height</a>"            <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint64"><span class="type">guint64</span></a>               : Read
76   "<a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink--window-width" title='The "window-width" property'>window-width</a>"             <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint64"><span class="type">guint64</span></a>               : Read
77 </pre>
78 </div>
79 <div class="refsect1">
80 <a name="gst-plugins-base-plugins-ximagesink.description"></a><h2>Description</h2>
81 <p>
82 XImageSink renders video frames to a drawable (XWindow) on a local or remote
83 display. This element can receive a Window ID from the application through
84 the XOverlay interface and will then render video frames in this drawable.
85 If no Window ID was provided by the application, the element will create its
86 own internal window and render into it.
87 </p>
88 <p>
89 </p>
90 <div class="refsect2">
91 <a name="idp15989760"></a><h3>Scaling</h3>
92 <p>
93 As standard XImage rendering to a drawable is not scaled, XImageSink will use
94 reverse caps negotiation to try to get scaled video frames for the drawable.
95 This is accomplished by asking the peer pad if it accepts some different caps
96 which in most cases implies that there is a scaling element in the pipeline,
97 or that an element generating the video frames can generate them with a 
98 different geometry. This mechanism is handled during buffer allocations, for
99 each allocation request the video sink will check the drawable geometry, look
100 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
101 desired video frames and then check that the peer pad accept those new caps.
102 If it does it will then allocate a buffer in video memory with this new
103 geometry and return it with the new caps.
104 </p>
105 </div>
106 <p>
107 </p>
108 <hr>
109 <div class="refsect2">
110 <a name="idp15992704"></a><h3>Events</h3>
111 <p>
112 XImageSink creates a thread to handle events coming from the drawable. There
113 are several kind of events that can be grouped in 2 big categories: input 
114 events and window state related events. Input events will be translated to
115 navigation events and pushed upstream for other elements to react on them.
116 This includes events such as pointer moves, key press/release, clicks etc...
117 Other events are used to handle the drawable appearance even when the data
118 is not flowing (GST_STATE_PAUSED). That means that even when the element is
119 paused, it will receive expose events from the drawable and draw the latest
120 frame with correct borders/aspect-ratio.
121 </p>
122 </div>
123 <p>
124 </p>
125 <hr>
126 <div class="refsect2">
127 <a name="idp15994688"></a><h3>Pixel aspect ratio</h3>
128 <p>
129 When changing state to GST_STATE_READY, XImageSink will open a connection to
130 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
131 display if nothing specified. Once this connection is open it will inspect 
132 the display configuration including the physical display geometry and 
133 then calculate the pixel aspect ratio. When caps negotiation will occur, the
134 video sink will set the calculated pixel aspect ratio on the caps to make 
135 sure that incoming video frames will have the correct pixel aspect ratio for
136 this display. Sometimes the calculated pixel aspect ratio can be wrong, it is
137 then possible to enforce a specific pixel aspect ratio using the
138 <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.
139 </p>
140 </div>
141 <p>
142 </p>
143 <hr>
144 <div class="refsect2">
145 <a name="idp15998368"></a><h3>Examples</h3>
146 <div class="informalexample">
147   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
148     <tbody>
149       <tr>
150         <td class="listing_lines" align="right"><pre>1</pre></td>
151         <td class="listing_code"><pre class="programlisting">gst<span class="gtkdoc opt">-</span>launch <span class="gtkdoc opt">-</span>v videotestsrc <span class="gtkdoc opt">!</span> queue <span class="gtkdoc opt">!</span> ximagesink</pre></td>
152       </tr>
153     </tbody>
154   </table>
155 </div>
156  A pipeline to test reverse negotiation. When the test video signal appears
157 you can resize the window and see that scaled buffers of the desired size are
158 going to arrive with a short delay. This illustrates how buffers of desired
159 size are allocated along the way. If you take away the queue, scaling will
160 happen almost immediately.
161 <div class="informalexample">
162   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
163     <tbody>
164       <tr>
165         <td class="listing_lines" align="right"><pre>1</pre></td>
166         <td class="listing_code"><pre class="programlisting">gst<span class="gtkdoc opt">-</span>launch <span class="gtkdoc opt">-</span>v videotestsrc <span class="gtkdoc opt">!</span> navigationtest <span class="gtkdoc opt">!</span> ffmpegcolorspace <span class="gtkdoc opt">!</span> ximagesink</pre></td>
167       </tr>
168     </tbody>
169   </table>
170 </div>
171  A pipeline to test navigation events.
172 While moving the mouse pointer over the test signal you will see a black box
173 following the mouse pointer. If you press the mouse button somewhere on the 
174 video and release it somewhere else a green box will appear where you pressed
175 the button and a red one where you released it. (The navigationtest element
176 is part of gst-plugins-good.)
177 <div class="informalexample">
178   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
179     <tbody>
180       <tr>
181         <td class="listing_lines" align="right"><pre>1</pre></td>
182         <td class="listing_code"><pre class="programlisting">gst<span class="gtkdoc opt">-</span>launch <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>rgb<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>
183       </tr>
184     </tbody>
185   </table>
186 </div>
187  This is faking a 4/3 pixel aspect ratio caps on video frames produced by
188 videotestsrc, in most cases the pixel aspect ratio of the display will be
189 1/1. This means that videoscale will have to do the scaling to convert 
190 incoming frames to a size that will match the display pixel aspect ratio
191 (from 320x240 to 320x180 in this case). Note that you might have to escape 
192 some characters for your shell like '\(fraction\)'.
193 </div>
194 <p>
195 </p>
196 <div class="refsynopsisdiv">
197 <h2>Synopsis</h2>
198 <div class="refsect2">
199 <a name="idp16003856"></a><h3>Element Information</h3>
200 <div class="variablelist"><table border="0">
201 <col align="left" valign="top">
202 <tbody>
203 <tr>
204 <td><p><span class="term">plugin</span></p></td>
205 <td>
206             <a class="link" href="gst-plugins-base-plugins-plugin-ximagesink.html#plugin-ximagesink">ximagesink</a>
207           </td>
208 </tr>
209 <tr>
210 <td><p><span class="term">author</span></p></td>
211 <td>Julien Moutte &lt;julien@moutte.net&gt;</td>
212 </tr>
213 <tr>
214 <td><p><span class="term">class</span></p></td>
215 <td>Sink/Video</td>
216 </tr>
217 </tbody>
218 </table></div>
219 </div>
220 <hr>
221 <div class="refsect2">
222 <a name="idp16011312"></a><h3>Element Pads</h3>
223 <div class="variablelist"><table border="0">
224 <col align="left" valign="top">
225 <tbody>
226 <tr>
227 <td><p><span class="term">name</span></p></td>
228 <td>sink</td>
229 </tr>
230 <tr>
231 <td><p><span class="term">direction</span></p></td>
232 <td>sink</td>
233 </tr>
234 <tr>
235 <td><p><span class="term">presence</span></p></td>
236 <td>always</td>
237 </tr>
238 <tr>
239 <td><p><span class="term">details</span></p></td>
240 <td>video/x-raw-rgb, framerate=(fraction)[ 0/1, 2147483647/1 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]</td>
241 </tr>
242 </tbody>
243 </table></div>
244 </div>
245 </div>
246 <p>
247 </p>
248 </div>
249 <div class="refsect1">
250 <a name="gst-plugins-base-plugins-ximagesink.details"></a><h2>Details</h2>
251 <div class="refsect2">
252 <a name="GstXImageSink-struct"></a><h3>struct GstXImageSink</h3>
253 <pre class="programlisting">struct GstXImageSink;</pre>
254 <p>
255 The <a class="link" href="gst-plugins-base-plugins-ximagesink.html#GstXImageSink"><span class="type">GstXImageSink</span></a> data structure.
256 </p>
257 <div class="variablelist"><table border="0">
258 <col align="left" valign="top">
259 <tbody></tbody>
260 </table></div>
261 </div>
262 </div>
263 <div class="refsect1">
264 <a name="gst-plugins-base-plugins-ximagesink.property-details"></a><h2>Property Details</h2>
265 <div class="refsect2">
266 <a name="GstXImageSink--display"></a><h3>The <code class="literal">"display"</code> property</h3>
267 <pre class="programlisting">  "display"                  <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Read / Write</pre>
268 <p>X Display name.</p>
269 <p>Default value: NULL</p>
270 </div>
271 <hr>
272 <div class="refsect2">
273 <a name="GstXImageSink--pixel-aspect-ratio"></a><h3>The <code class="literal">"pixel-aspect-ratio"</code> property</h3>
274 <pre class="programlisting">  "pixel-aspect-ratio"       <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Read / Write</pre>
275 <p>The pixel aspect ratio of the device.</p>
276 <p>Default value: "1/1"</p>
277 </div>
278 <hr>
279 <div class="refsect2">
280 <a name="GstXImageSink--synchronous"></a><h3>The <code class="literal">"synchronous"</code> property</h3>
281 <pre class="programlisting">  "synchronous"              <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write</pre>
282 <p>When enabled, runs the X display in synchronous mode. (used only for debugging).</p>
283 <p>Default value: FALSE</p>
284 </div>
285 <hr>
286 <div class="refsect2">
287 <a name="GstXImageSink--force-aspect-ratio"></a><h3>The <code class="literal">"force-aspect-ratio"</code> property</h3>
288 <pre class="programlisting">  "force-aspect-ratio"       <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write</pre>
289 <p>When enabled, reverse caps negotiation (scaling) will respect original aspect ratio.</p>
290 <p>Default value: FALSE</p>
291 </div>
292 <hr>
293 <div class="refsect2">
294 <a name="GstXImageSink--handle-events"></a><h3>The <code class="literal">"handle-events"</code> property</h3>
295 <pre class="programlisting">  "handle-events"            <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write</pre>
296 <p>When enabled, XEvents will be selected and handled.</p>
297 <p>Default value: TRUE</p>
298 </div>
299 <hr>
300 <div class="refsect2">
301 <a name="GstXImageSink--handle-expose"></a><h3>The <code class="literal">"handle-expose"</code> property</h3>
302 <pre class="programlisting">  "handle-expose"            <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write</pre>
303 <p>When enabled, the current frame will always be drawn in response to X Expose events.</p>
304 <p>Default value: TRUE</p>
305 </div>
306 <hr>
307 <div class="refsect2">
308 <a name="GstXImageSink--window-height"></a><h3>The <code class="literal">"window-height"</code> property</h3>
309 <pre class="programlisting">  "window-height"            <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint64"><span class="type">guint64</span></a>               : Read</pre>
310 <p>
311 Actual height of the video window.
312 </p>
313 <p>Default value: 0</p>
314 <p class="since">Since 0.10.32</p>
315 </div>
316 <hr>
317 <div class="refsect2">
318 <a name="GstXImageSink--window-width"></a><h3>The <code class="literal">"window-width"</code> property</h3>
319 <pre class="programlisting">  "window-width"             <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint64"><span class="type">guint64</span></a>               : Read</pre>
320 <p>
321 Actual width of the video window.
322 </p>
323 <p>Default value: 0</p>
324 <p class="since">Since 0.10.32</p>
325 </div>
326 </div>
327 </div>
328 <div class="footer">
329 <hr>
330           Generated by GTK-Doc V1.17</div>
331 </body>
332 </html>