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>dfbvideosink: GStreamer Bad Plugins 1.0 Plugins Reference Manual</title> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual"> 8<link rel="up" href="ch01.html" title="gst-plugins-bad Elements"> 9<link rel="prev" href="gst-plugins-bad-plugins-dewarp.html" title="dewarp"> 10<link rel="next" href="gst-plugins-bad-plugins-diffuse.html" title="diffuse"> 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="#gst-plugins-bad-plugins-dfbvideosink.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> 19 <a href="#gst-plugins-bad-plugins-dfbvideosink.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_interfaces"> <span class="dim">|</span> 20 <a href="#gst-plugins-bad-plugins-dfbvideosink.implemented-interfaces" class="shortcut">Implemented Interfaces</a></span><span id="nav_properties"> <span class="dim">|</span> 21 <a href="#gst-plugins-bad-plugins-dfbvideosink.properties" class="shortcut">Properties</a></span> 22</td> 23<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> 24<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> 25<td><a accesskey="p" href="gst-plugins-bad-plugins-dewarp.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> 26<td><a accesskey="n" href="gst-plugins-bad-plugins-diffuse.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> 27</tr></table> 28<div class="refentry"> 29<a name="gst-plugins-bad-plugins-dfbvideosink"></a><div class="titlepage"></div> 30<div class="refnamediv"><table width="100%"><tr> 31<td valign="top"> 32<h2><span class="refentrytitle"><a name="gst-plugins-bad-plugins-dfbvideosink.top_of_page"></a>dfbvideosink</span></h2> 33<p>dfbvideosink</p> 34</td> 35<td class="gallery_image" valign="top" align="right"></td> 36</tr></table></div> 37<div class="refsect1"> 38<a name="gst-plugins-bad-plugins-dfbvideosink.properties"></a><h2>Properties</h2> 39<div class="informaltable"><table class="informaltable" border="0"> 40<colgroup> 41<col width="150px" class="properties_type"> 42<col width="300px" class="properties_name"> 43<col width="200px" class="properties_flags"> 44</colgroup> 45<tbody> 46<tr> 47<td class="property_type"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td> 48<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dfbvideosink.html#GstDfbVideoSink--brightness" title="The “brightness” property">brightness</a></td> 49<td class="property_flags">Read / Write</td> 50</tr> 51<tr> 52<td class="property_type"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td> 53<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dfbvideosink.html#GstDfbVideoSink--contrast" title="The “contrast” property">contrast</a></td> 54<td class="property_flags">Read / Write</td> 55</tr> 56<tr> 57<td class="property_type"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td> 58<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dfbvideosink.html#GstDfbVideoSink--hue" title="The “hue” property">hue</a></td> 59<td class="property_flags">Read / Write</td> 60</tr> 61<tr> 62<td class="property_type"> 63<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</td> 64<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dfbvideosink.html#GstDfbVideoSink--pixel-aspect-ratio" title="The “pixel-aspect-ratio” property">pixel-aspect-ratio</a></td> 65<td class="property_flags">Read / Write</td> 66</tr> 67<tr> 68<td class="property_type"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td> 69<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dfbvideosink.html#GstDfbVideoSink--saturation" title="The “saturation” property">saturation</a></td> 70<td class="property_flags">Read / Write</td> 71</tr> 72<tr> 73<td class="property_type"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a></td> 74<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dfbvideosink.html#GstDfbVideoSink--surface" title="The “surface” property">surface</a></td> 75<td class="property_flags">Write</td> 76</tr> 77<tr> 78<td class="property_type"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td> 79<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dfbvideosink.html#GstDfbVideoSink--vsync" title="The “vsync” property">vsync</a></td> 80<td class="property_flags">Read / Write</td> 81</tr> 82<tr> 83<td class="property_type"><span class="type">GstDfbVideoSinkLayerMode</span></td> 84<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dfbvideosink.html#GstDfbVideoSink--layer-mode" title="The “layer-mode” property">layer-mode</a></td> 85<td class="property_flags">Read / Write</td> 86</tr> 87</tbody> 88</table></div> 89</div> 90<a name="GstDfbVideoSink"></a><div class="refsect1"> 91<a name="gst-plugins-bad-plugins-dfbvideosink.other"></a><h2>Types and Values</h2> 92<div class="informaltable"><table class="informaltable" width="100%" border="0"> 93<colgroup> 94<col width="150px" class="name"> 95<col class="description"> 96</colgroup> 97<tbody><tr> 98<td class="datatype_keyword">struct</td> 99<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-dfbvideosink.html#GstDfbVideoSink-struct" title="struct GstDfbVideoSink">GstDfbVideoSink</a></td> 100</tr></tbody> 101</table></div> 102</div> 103<div class="refsect1"> 104<a name="gst-plugins-bad-plugins-dfbvideosink.object-hierarchy"></a><h2>Object Hierarchy</h2> 105<pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject-struct">GObject</a> 106 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a> 107 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstObject.html#GstObject-struct">GstObject</a> 108 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstElement.html#GstElement-struct">GstElement</a> 109 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-libs-1.0/GstBaseSink.html#GstBaseSink-struct">GstBaseSink</a> 110 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gst-plugins-base-libs-1.0/GstVideoSink.html#GstVideoSink-struct">GstVideoSink</a> 111 <span class="lineart">╰──</span> GstDfbVideoSink 112</pre> 113</div> 114<div class="refsect1"> 115<a name="gst-plugins-bad-plugins-dfbvideosink.implemented-interfaces"></a><h2>Implemented Interfaces</h2> 116<p> 117GstDfbVideoSink implements 118 <a href="/usr/share/gtk-doc/html/gst-plugins-base-libs-1.0/GstNavigation.html#GstNavigation-struct">GstNavigation</a> and <a href="/usr/share/gtk-doc/html/gst-plugins-base-libs-1.0/GstColorBalance.html#GstColorBalance-struct">GstColorBalance</a>.</p> 119</div> 120<div class="refsect1"> 121<a name="gst-plugins-bad-plugins-dfbvideosink.description"></a><h2>Description</h2> 122<p>DfbVideoSink renders video frames using the</p> 123<a class="ulink" href="http://www.directfb.org/" target="_top">DirectFB</a> library. 124<p>Rendering can happen in two different modes :</p> 125<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 126<li class="listitem"> 127<p>Standalone: this mode will take complete control of the monitor forcing</p> 128<a class="ulink" href="http://www.directfb.org/" target="_top">DirectFB</a> to fullscreen layout. 129<p>This is convenient to test using the gst-launch-1.0 command line tool or 130other simple applications. It is possible to interrupt playback while 131being in this mode by pressing the Escape key. 132This mode handles navigation events for every input device supported by 133the <a class="ulink" href="http://www.directfb.org/" target="_top">DirectFB</a> library, it will 134look for available video modes in the fb.modes file and try to switch 135the framebuffer video mode to the most suitable one. Depending on 136hardware acceleration capabilities the element will handle scaling or not. 137If no acceleration is available it will do clipping or centering of the 138video frames respecting the original aspect ratio.</p> 139</li> 140<li class="listitem"> 141<p>Embedded: this mode will render video frames in a 142<a class="link" href="gst-plugins-bad-plugins-dfbvideosink.html#GstDfbVideoSink--surface" title="The “surface” property"><span class="type">“surface”</span></a> provided by the 143application developer. This is a more advanced usage of the element and 144it is required to integrate video playback in existing</p> 145<a class="ulink" href="http://www.directfb.org/" target="_top">DirectFB</a> applications. 146<p>When using this mode the element just renders to the 147<a class="link" href="gst-plugins-bad-plugins-dfbvideosink.html#GstDfbVideoSink--surface" title="The “surface” property"><span class="type">“surface”</span></a> provided by the 148application, that means it won't handle navigation events and won't resize 149the <a class="link" href="gst-plugins-bad-plugins-dfbvideosink.html#GstDfbVideoSink--surface" title="The “surface” property"><span class="type">“surface”</span></a> to fit video 150frames geometry. Application has to implement the necessary code to grab 151informations about the negotiated geometry and resize there 152<a class="link" href="gst-plugins-bad-plugins-dfbvideosink.html#GstDfbVideoSink--surface" title="The “surface” property"><span class="type">“surface”</span></a> accordingly.</p> 153</li> 154</ul></div> 155<p>For both modes the element implements a buffer pool allocation system to 156optimize memory allocation time and handle reverse negotiation. Indeed if 157you insert an element like videoscale in the pipeline the video sink will 158negotiate with it to try get a scaled video for either the fullscreen layout 159or the application provided external <a class="link" href="gst-plugins-bad-plugins-dfbvideosink.html#GstDfbVideoSink--surface" title="The “surface” property"><span class="type">“surface”</span></a>.</p> 160<div class="refsect3"> 161<a name="id-1.2.60.8.7"></a><h4>Example application</h4> 162<pre class="programlisting"> 163 164#include <directfb.h> 165 166#ifdef __no_instrument_function__ 167#undef __no_instrument_function__ 168#endif 169 170#include <stdio.h> 171#include <gst/gst.h> 172 173static IDirectFB *dfb = NULL; 174static IDirectFBSurface *primary = NULL; 175static GMainLoop *loop; 176 177#define DFBCHECK(x...) \ 178 { \ 179 DFBResult err = x; \ 180 \ 181 if (err != DFB_OK) \ 182 { \ 183 fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \ 184 DirectFBErrorFatal( #x, err ); \ 185 } \ 186 } 187 188static gboolean 189get_me_out (gpointer data) 190{ 191 g_main_loop_quit (loop); 192 return FALSE; 193} 194 195int 196main (int argc, char *argv[]) 197{ 198 DFBSurfaceDescription dsc; 199 GstElement *pipeline, *src, *sink; 200 201 /* Init both GStreamer and DirectFB */ 202 DFBCHECK (DirectFBInit (&argc, &argv)); 203 gst_init (&argc, &argv); 204 205 /* Creates DirectFB main context and set it to fullscreen layout */ 206 DFBCHECK (DirectFBCreate (&dfb)); 207 DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)); 208 209 /* We want a double buffered primary surface */ 210 dsc.flags = DSDESC_CAPS; 211 dsc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING; 212 213 DFBCHECK (dfb->CreateSurface (dfb, &dsc, &primary)); 214 215 /* Creating our pipeline : videotestsrc ! dfbvideosink */ 216 pipeline = gst_pipeline_new (NULL); 217 g_assert (pipeline); 218 src = gst_element_factory_make ("videotestsrc", NULL); 219 g_assert (src); 220 sink = gst_element_factory_make ("dfbvideosink", NULL); 221 g_assert (sink); 222 /* That's the interesting part, giving the primary surface to dfbvideosink */ 223 g_object_set (sink, "surface", primary, NULL); 224 225 /* Adding elements to the pipeline */ 226 gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); 227 if (!gst_element_link (src, sink)) 228 g_error ("Couldn't link videotestsrc and dfbvideosink"); 229 230 /* Let's play ! */ 231 gst_element_set_state (pipeline, GST_STATE_PLAYING); 232 233 /* we need to run a GLib main loop to get out of here */ 234 loop = g_main_loop_new (NULL, FALSE); 235 /* Get us out after 20 seconds */ 236 g_timeout_add (20000, get_me_out, NULL); 237 g_main_loop_run (loop); 238 239 /* Release elements and stop playback */ 240 gst_element_set_state (pipeline, GST_STATE_NULL); 241 242 /* Free the main loop */ 243 g_main_loop_unref (loop); 244 245 /* Release DirectFB context and surface */ 246 primary->Release (primary); 247 dfb->Release (dfb); 248 249 return 0; 250} 251 252</pre> 253</div> 254<div class="refsect3"> 255<a name="id-1.2.60.8.8"></a><h4>Example pipelines</h4> 256<div class="informalexample"> 257 <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> 258 <tbody> 259 <tr> 260 <td class="listing_lines" align="right"><pre>1</pre></td> 261 <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> dfbvideosink hue<span class="gtkdoc opt">=</span><span class="number">20000</span> saturation<span class="gtkdoc opt">=</span><span class="number">40000</span> brightness<span class="gtkdoc opt">=</span><span class="number">25000</span></pre></td> 262 </tr> 263 </tbody> 264 </table> 265</div> 266 267<p> test the colorbalance interface implementation in dfbvideosink</p> 268</div> 269<div class="refsynopsisdiv"> 270<h2>Synopsis</h2> 271<div class="refsect2"> 272<a name="id-1.2.60.8.9.1"></a><h3>Element Information</h3> 273<div class="variablelist"><table border="0" class="variablelist"> 274<colgroup> 275<col align="left" valign="top"> 276<col> 277</colgroup> 278<tbody> 279<tr> 280<td><p><span class="term">plugin</span></p></td> 281<td> 282 <a class="link" href="gst-plugins-bad-plugins-plugin-dfbvideosink.html#plugin-dfbvideosink">dfbvideosink</a> 283 </td> 284</tr> 285<tr> 286<td><p><span class="term">author</span></p></td> 287<td>Julien Moutte <julien@moutte.net></td> 288</tr> 289<tr> 290<td><p><span class="term">class</span></p></td> 291<td>Sink/Video</td> 292</tr> 293</tbody> 294</table></div> 295</div> 296<hr> 297<div class="refsect2"> 298<a name="id-1.2.60.8.9.2"></a><h3>Element Pads</h3> 299<div class="variablelist"><table border="0" class="variablelist"> 300<colgroup> 301<col align="left" valign="top"> 302<col> 303</colgroup> 304<tbody> 305<tr> 306<td><p><span class="term">name</span></p></td> 307<td>sink</td> 308</tr> 309<tr> 310<td><p><span class="term">direction</span></p></td> 311<td>sink</td> 312</tr> 313<tr> 314<td><p><span class="term">presence</span></p></td> 315<td>always</td> 316</tr> 317<tr> 318<td><p><span class="term">details</span></p></td> 319<td>video/x-raw, framerate=(fraction)[ 0/1, 2147483647/1 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]</td> 320</tr> 321</tbody> 322</table></div> 323</div> 324</div> 325</div> 326<div class="refsect1"> 327<a name="gst-plugins-bad-plugins-dfbvideosink.functions_details"></a><h2>Functions</h2> 328<p></p> 329</div> 330<div class="refsect1"> 331<a name="gst-plugins-bad-plugins-dfbvideosink.other_details"></a><h2>Types and Values</h2> 332<div class="refsect2"> 333<a name="GstDfbVideoSink-struct"></a><h3>struct GstDfbVideoSink</h3> 334<pre class="programlisting">struct GstDfbVideoSink;</pre> 335<p>The opaque <a class="link" href="gst-plugins-bad-plugins-dfbvideosink.html#GstDfbVideoSink"><span class="type">GstDfbVideoSink</span></a> structure.</p> 336</div> 337</div> 338<div class="refsect1"> 339<a name="gst-plugins-bad-plugins-dfbvideosink.property-details"></a><h2>Property Details</h2> 340<div class="refsect2"> 341<a name="GstDfbVideoSink--brightness"></a><h3>The <code class="literal">“brightness”</code> property</h3> 342<pre class="programlisting"> “brightness” <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre> 343<p>The brightness of the video.</p> 344<p>Flags: Read / Write</p> 345<p>Allowed values: [0,65535]</p> 346<p>Default value: 32768</p> 347</div> 348<hr> 349<div class="refsect2"> 350<a name="GstDfbVideoSink--contrast"></a><h3>The <code class="literal">“contrast”</code> property</h3> 351<pre class="programlisting"> “contrast” <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre> 352<p>The contrast of the video.</p> 353<p>Flags: Read / Write</p> 354<p>Allowed values: [0,65535]</p> 355<p>Default value: 32768</p> 356</div> 357<hr> 358<div class="refsect2"> 359<a name="GstDfbVideoSink--hue"></a><h3>The <code class="literal">“hue”</code> property</h3> 360<pre class="programlisting"> “hue” <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre> 361<p>The hue of the video.</p> 362<p>Flags: Read / Write</p> 363<p>Allowed values: [0,65535]</p> 364<p>Default value: 32768</p> 365</div> 366<hr> 367<div class="refsect2"> 368<a name="GstDfbVideoSink--pixel-aspect-ratio"></a><h3>The <code class="literal">“pixel-aspect-ratio”</code> property</h3> 369<pre class="programlisting"> “pixel-aspect-ratio” <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</pre> 370<p>The pixel aspect ratio of the device.</p> 371<p>Flags: Read / Write</p> 372<p>Default value: "1/1"</p> 373</div> 374<hr> 375<div class="refsect2"> 376<a name="GstDfbVideoSink--saturation"></a><h3>The <code class="literal">“saturation”</code> property</h3> 377<pre class="programlisting"> “saturation” <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre> 378<p>The saturation of the video.</p> 379<p>Flags: Read / Write</p> 380<p>Allowed values: [0,65535]</p> 381<p>Default value: 32768</p> 382</div> 383<hr> 384<div class="refsect2"> 385<a name="GstDfbVideoSink--surface"></a><h3>The <code class="literal">“surface”</code> property</h3> 386<pre class="programlisting"> “surface” <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a></pre> 387<p>The target surface for video.</p> 388<p>Flags: Write</p> 389</div> 390<hr> 391<div class="refsect2"> 392<a name="GstDfbVideoSink--vsync"></a><h3>The <code class="literal">“vsync”</code> property</h3> 393<pre class="programlisting"> “vsync” <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre> 394<p>Wait for next vertical sync to draw frames.</p> 395<p>Flags: Read / Write</p> 396<p>Default value: TRUE</p> 397</div> 398<hr> 399<div class="refsect2"> 400<a name="GstDfbVideoSink--layer-mode"></a><h3>The <code class="literal">“layer-mode”</code> property</h3> 401<pre class="programlisting"> “layer-mode” <span class="type">GstDfbVideoSinkLayerMode</span></pre> 402<p>The cooperative level handling the access permission (set this to 'administrative' when the cursor is required).</p> 403<p>Flags: Read / Write</p> 404<p>Default value: DLSCL_EXCLUSIVE</p> 405</div> 406</div> 407</div> 408<div class="footer"> 409<hr>Generated by GTK-Doc V1.28</div> 410</body> 411</html>