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>GstAppSink: 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-app.html" title="App Library"> 9<link rel="prev" href="gst-plugins-base-libs-appsrc.html" title="GstAppSrc"> 10<link rel="next" href="gstreamer-audio.html" title="Audio Library"> 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-base-libs-appsink.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> 19 <a href="#gst-plugins-base-libs-appsink.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties"> <span class="dim">|</span> 20 <a href="#gst-plugins-base-libs-appsink.properties" class="shortcut">Properties</a></span><span id="nav_signals"> <span class="dim">|</span> 21 <a href="#gst-plugins-base-libs-appsink.signals" class="shortcut">Signals</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="gstreamer-app.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> 25<td><a accesskey="p" href="gst-plugins-base-libs-appsrc.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> 26<td><a accesskey="n" href="gstreamer-audio.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-base-libs-appsink"></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-base-libs-appsink.top_of_page"></a>GstAppSink</span></h2> 33<p>GstAppSink — Easy way for applications to extract samples from a 34 pipeline</p> 35</td> 36<td class="gallery_image" valign="top" align="right"></td> 37</tr></table></div> 38<div class="refsect1"> 39<a name="gst-plugins-base-libs-appsink.functions"></a><h2>Functions</h2> 40<div class="informaltable"><table class="informaltable" width="100%" border="0"> 41<colgroup> 42<col width="150px" class="functions_return"> 43<col class="functions_name"> 44</colgroup> 45<tbody> 46<tr> 47<td class="function_type"> 48<span class="returnvalue">void</span> 49</td> 50<td class="function_name"> 51<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-set-caps" title="gst_app_sink_set_caps ()">gst_app_sink_set_caps</a> <span class="c_punctuation">()</span> 52</td> 53</tr> 54<tr> 55<td class="function_type"> 56<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstCaps.html#GstCaps-struct"><span class="returnvalue">GstCaps</span></a> * 57</td> 58<td class="function_name"> 59<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-get-caps" title="gst_app_sink_get_caps ()">gst_app_sink_get_caps</a> <span class="c_punctuation">()</span> 60</td> 61</tr> 62<tr> 63<td class="function_type"> 64<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 65</td> 66<td class="function_name"> 67<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-is-eos" title="gst_app_sink_is_eos ()">gst_app_sink_is_eos</a> <span class="c_punctuation">()</span> 68</td> 69</tr> 70<tr> 71<td class="function_type"> 72<span class="returnvalue">void</span> 73</td> 74<td class="function_name"> 75<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-set-emit-signals" title="gst_app_sink_set_emit_signals ()">gst_app_sink_set_emit_signals</a> <span class="c_punctuation">()</span> 76</td> 77</tr> 78<tr> 79<td class="function_type"> 80<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 81</td> 82<td class="function_name"> 83<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-get-emit-signals" title="gst_app_sink_get_emit_signals ()">gst_app_sink_get_emit_signals</a> <span class="c_punctuation">()</span> 84</td> 85</tr> 86<tr> 87<td class="function_type"> 88<span class="returnvalue">void</span> 89</td> 90<td class="function_name"> 91<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-set-max-buffers" title="gst_app_sink_set_max_buffers ()">gst_app_sink_set_max_buffers</a> <span class="c_punctuation">()</span> 92</td> 93</tr> 94<tr> 95<td class="function_type"> 96<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a> 97</td> 98<td class="function_name"> 99<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-get-max-buffers" title="gst_app_sink_get_max_buffers ()">gst_app_sink_get_max_buffers</a> <span class="c_punctuation">()</span> 100</td> 101</tr> 102<tr> 103<td class="function_type"> 104<span class="returnvalue">void</span> 105</td> 106<td class="function_name"> 107<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-set-drop" title="gst_app_sink_set_drop ()">gst_app_sink_set_drop</a> <span class="c_punctuation">()</span> 108</td> 109</tr> 110<tr> 111<td class="function_type"> 112<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 113</td> 114<td class="function_name"> 115<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-get-drop" title="gst_app_sink_get_drop ()">gst_app_sink_get_drop</a> <span class="c_punctuation">()</span> 116</td> 117</tr> 118<tr> 119<td class="function_type"> 120<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="returnvalue">GstSample</span></a> * 121</td> 122<td class="function_name"> 123<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-pull-preroll" title="gst_app_sink_pull_preroll ()">gst_app_sink_pull_preroll</a> <span class="c_punctuation">()</span> 124</td> 125</tr> 126<tr> 127<td class="function_type"> 128<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="returnvalue">GstSample</span></a> * 129</td> 130<td class="function_name"> 131<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-pull-sample" title="gst_app_sink_pull_sample ()">gst_app_sink_pull_sample</a> <span class="c_punctuation">()</span> 132</td> 133</tr> 134<tr> 135<td class="function_type"> 136<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="returnvalue">GstSample</span></a> * 137</td> 138<td class="function_name"> 139<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-try-pull-preroll" title="gst_app_sink_try_pull_preroll ()">gst_app_sink_try_pull_preroll</a> <span class="c_punctuation">()</span> 140</td> 141</tr> 142<tr> 143<td class="function_type"> 144<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="returnvalue">GstSample</span></a> * 145</td> 146<td class="function_name"> 147<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-try-pull-sample" title="gst_app_sink_try_pull_sample ()">gst_app_sink_try_pull_sample</a> <span class="c_punctuation">()</span> 148</td> 149</tr> 150<tr> 151<td class="function_type"> 152<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 153</td> 154<td class="function_name"> 155<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-get-buffer-list-support" title="gst_app_sink_get_buffer_list_support ()">gst_app_sink_get_buffer_list_support</a> <span class="c_punctuation">()</span> 156</td> 157</tr> 158<tr> 159<td class="function_type"> 160<span class="returnvalue">void</span> 161</td> 162<td class="function_name"> 163<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-set-buffer-list-support" title="gst_app_sink_set_buffer_list_support ()">gst_app_sink_set_buffer_list_support</a> <span class="c_punctuation">()</span> 164</td> 165</tr> 166<tr> 167<td class="function_type"> 168<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 169</td> 170<td class="function_name"> 171<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-get-wait-on-eos" title="gst_app_sink_get_wait_on_eos ()">gst_app_sink_get_wait_on_eos</a> <span class="c_punctuation">()</span> 172</td> 173</tr> 174<tr> 175<td class="function_type"> 176<span class="returnvalue">void</span> 177</td> 178<td class="function_name"> 179<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-set-wait-on-eos" title="gst_app_sink_set_wait_on_eos ()">gst_app_sink_set_wait_on_eos</a> <span class="c_punctuation">()</span> 180</td> 181</tr> 182<tr> 183<td class="function_type"> 184<span class="returnvalue">void</span> 185</td> 186<td class="function_name"> 187<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-set-callbacks" title="gst_app_sink_set_callbacks ()">gst_app_sink_set_callbacks</a> <span class="c_punctuation">()</span> 188</td> 189</tr> 190</tbody> 191</table></div> 192</div> 193<div class="refsect1"> 194<a name="gst-plugins-base-libs-appsink.properties"></a><h2>Properties</h2> 195<div class="informaltable"><table class="informaltable" border="0"> 196<colgroup> 197<col width="150px" class="properties_type"> 198<col width="300px" class="properties_name"> 199<col width="200px" class="properties_flags"> 200</colgroup> 201<tbody> 202<tr> 203<td class="property_type"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td> 204<td class="property_name"><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink--buffer-list" title="The “buffer-list” property">buffer-list</a></td> 205<td class="property_flags">Read / Write</td> 206</tr> 207<tr> 208<td class="property_type"> 209<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstCaps.html#GstCaps-struct"><span class="type">GstCaps</span></a> *</td> 210<td class="property_name"><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink--caps" title="The “caps” property">caps</a></td> 211<td class="property_flags">Read / Write</td> 212</tr> 213<tr> 214<td class="property_type"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td> 215<td class="property_name"><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink--drop" title="The “drop” property">drop</a></td> 216<td class="property_flags">Read / Write</td> 217</tr> 218<tr> 219<td class="property_type"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td> 220<td class="property_name"><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink--emit-signals" title="The “emit-signals” property">emit-signals</a></td> 221<td class="property_flags">Read / Write</td> 222</tr> 223<tr> 224<td class="property_type"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td> 225<td class="property_name"><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink--eos" title="The “eos” property">eos</a></td> 226<td class="property_flags">Read</td> 227</tr> 228<tr> 229<td class="property_type"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td> 230<td class="property_name"><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink--max-buffers" title="The “max-buffers” property">max-buffers</a></td> 231<td class="property_flags">Read / Write</td> 232</tr> 233<tr> 234<td class="property_type"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td> 235<td class="property_name"><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink--wait-on-eos" title="The “wait-on-eos” property">wait-on-eos</a></td> 236<td class="property_flags">Read / Write</td> 237</tr> 238</tbody> 239</table></div> 240</div> 241<div class="refsect1"> 242<a name="gst-plugins-base-libs-appsink.signals"></a><h2>Signals</h2> 243<div class="informaltable"><table class="informaltable" border="0"> 244<colgroup> 245<col width="150px" class="signals_return"> 246<col width="300px" class="signals_name"> 247<col width="200px" class="signals_flags"> 248</colgroup> 249<tbody> 250<tr> 251<td class="signal_type"><span class="returnvalue">void</span></td> 252<td class="signal_name"><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink-eos" title="The “eos” signal">eos</a></td> 253<td class="signal_flags"><a href="/usr/share/gtk-doc/html/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td> 254</tr> 255<tr> 256<td class="signal_type"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstPad.html#GstFlowReturn"><span class="returnvalue">GstFlowReturn</span></a></td> 257<td class="signal_name"><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink-new-preroll" title="The “new-preroll” signal">new-preroll</a></td> 258<td class="signal_flags"><a href="/usr/share/gtk-doc/html/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td> 259</tr> 260<tr> 261<td class="signal_type"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstPad.html#GstFlowReturn"><span class="returnvalue">GstFlowReturn</span></a></td> 262<td class="signal_name"><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink-new-sample" title="The “new-sample” signal">new-sample</a></td> 263<td class="signal_flags"><a href="/usr/share/gtk-doc/html/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td> 264</tr> 265<tr> 266<td class="signal_type"> 267<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="returnvalue">GstSample</span></a>*</td> 268<td class="signal_name"><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink-pull-preroll" title="The “pull-preroll” signal">pull-preroll</a></td> 269<td class="signal_flags"><a href="/usr/share/gtk-doc/html/gobject/gobject-Signals.html#G-SIGNAL-ACTION:CAPS">Action</a></td> 270</tr> 271<tr> 272<td class="signal_type"> 273<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="returnvalue">GstSample</span></a>*</td> 274<td class="signal_name"><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink-pull-sample" title="The “pull-sample” signal">pull-sample</a></td> 275<td class="signal_flags"><a href="/usr/share/gtk-doc/html/gobject/gobject-Signals.html#G-SIGNAL-ACTION:CAPS">Action</a></td> 276</tr> 277<tr> 278<td class="signal_type"> 279<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="returnvalue">GstSample</span></a>*</td> 280<td class="signal_name"><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink-try-pull-preroll" title="The “try-pull-preroll” signal">try-pull-preroll</a></td> 281<td class="signal_flags"><a href="/usr/share/gtk-doc/html/gobject/gobject-Signals.html#G-SIGNAL-ACTION:CAPS">Action</a></td> 282</tr> 283<tr> 284<td class="signal_type"> 285<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="returnvalue">GstSample</span></a>*</td> 286<td class="signal_name"><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink-try-pull-sample" title="The “try-pull-sample” signal">try-pull-sample</a></td> 287<td class="signal_flags"><a href="/usr/share/gtk-doc/html/gobject/gobject-Signals.html#G-SIGNAL-ACTION:CAPS">Action</a></td> 288</tr> 289</tbody> 290</table></div> 291</div> 292<a name="GstAppSink"></a><div class="refsect1"> 293<a name="gst-plugins-base-libs-appsink.other"></a><h2>Types and Values</h2> 294<div class="informaltable"><table class="informaltable" width="100%" border="0"> 295<colgroup> 296<col width="150px" class="name"> 297<col class="description"> 298</colgroup> 299<tbody><tr> 300<td class="datatype_keyword"> </td> 301<td class="function_name"><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSinkCallbacks" title="GstAppSinkCallbacks">GstAppSinkCallbacks</a></td> 302</tr></tbody> 303</table></div> 304</div> 305<div class="refsect1"> 306<a name="gst-plugins-base-libs-appsink.object-hierarchy"></a><h2>Object Hierarchy</h2> 307<pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject-struct">GObject</a> 308 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a> 309 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstObject.html#GstObject-struct">GstObject</a> 310 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstElement.html#GstElement-struct">GstElement</a> 311 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-libs-1.0/GstBaseSink.html#GstBaseSink-struct">GstBaseSink</a> 312 <span class="lineart">╰──</span> GstAppSink 313</pre> 314</div> 315<div class="refsect1"> 316<a name="gst-plugins-base-libs-appsink.includes"></a><h2>Includes</h2> 317<pre class="synopsis">#include <gst/app/app.h> 318</pre> 319</div> 320<div class="refsect1"> 321<a name="gst-plugins-base-libs-appsink.description"></a><h2>Description</h2> 322<p>Appsink is a sink plugin that supports many different methods for making 323the application get a handle on the GStreamer data in a pipeline. Unlike 324most GStreamer elements, Appsink provides external API functions.</p> 325<p>appsink can be used by linking to the gstappsink.h header file to access the 326methods or by using the appsink action signals and properties.</p> 327<p>The normal way of retrieving samples from appsink is by using the 328<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-pull-sample" title="gst_app_sink_pull_sample ()"><code class="function">gst_app_sink_pull_sample()</code></a> and <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-pull-preroll" title="gst_app_sink_pull_preroll ()"><code class="function">gst_app_sink_pull_preroll()</code></a> methods. 329These methods block until a sample becomes available in the sink or when the 330sink is shut down or reaches EOS. There are also timed variants of these 331methods, <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-try-pull-sample" title="gst_app_sink_try_pull_sample ()"><code class="function">gst_app_sink_try_pull_sample()</code></a> and <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-try-pull-preroll" title="gst_app_sink_try_pull_preroll ()"><code class="function">gst_app_sink_try_pull_preroll()</code></a>, 332which accept a timeout parameter to limit the amount of time to wait.</p> 333<p>Appsink will internally use a queue to collect buffers from the streaming 334thread. If the application is not pulling samples fast enough, this queue 335will consume a lot of memory over time. The "max-buffers" property can be 336used to limit the queue size. The "drop" property controls whether the 337streaming thread blocks or if older buffers are dropped when the maximum 338queue size is reached. Note that blocking the streaming thread can negatively 339affect real-time performance and should be avoided.</p> 340<p>If a blocking behaviour is not desirable, setting the "emit-signals" property 341to <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> will make appsink emit the "new-sample" and "new-preroll" signals 342when a sample can be pulled without blocking.</p> 343<p>The "caps" property on appsink can be used to control the formats that 344appsink can receive. This property can contain non-fixed caps, the format of 345the pulled samples can be obtained by getting the sample caps.</p> 346<p>If one of the pull-preroll or pull-sample methods return <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the appsink 347is stopped or in the EOS state. You can check for the EOS state with the 348"eos" property or with the <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-is-eos" title="gst_app_sink_is_eos ()"><code class="function">gst_app_sink_is_eos()</code></a> method.</p> 349<p>The eos signal can also be used to be informed when the EOS state is reached 350to avoid polling.</p> 351</div> 352<div class="refsect1"> 353<a name="gst-plugins-base-libs-appsink.functions_details"></a><h2>Functions</h2> 354<div class="refsect2"> 355<a name="gst-app-sink-set-caps"></a><h3>gst_app_sink_set_caps ()</h3> 356<pre class="programlisting"><span class="returnvalue">void</span> 357gst_app_sink_set_caps (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>, 358 <em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstCaps.html#GstCaps-struct"><span class="type">GstCaps</span></a> *caps</code></em>);</pre> 359<p>Set the capabilities on the appsink element. This function takes 360a copy of the caps structure. After calling this method, the sink will only 361accept caps that match <em class="parameter"><code>caps</code></em> 362. If <em class="parameter"><code>caps</code></em> 363 is non-fixed, or incomplete, 364you must check the caps on the samples to get the actual used caps.</p> 365<div class="refsect3"> 366<a name="gst-app-sink-set-caps.parameters"></a><h4>Parameters</h4> 367<div class="informaltable"><table class="informaltable" width="100%" border="0"> 368<colgroup> 369<col width="150px" class="parameters_name"> 370<col class="parameters_description"> 371<col width="200px" class="parameters_annotations"> 372</colgroup> 373<tbody> 374<tr> 375<td class="parameter_name"><p>appsink</p></td> 376<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 377<td class="parameter_annotations"> </td> 378</tr> 379<tr> 380<td class="parameter_name"><p>caps</p></td> 381<td class="parameter_description"><p>caps to set</p></td> 382<td class="parameter_annotations"> </td> 383</tr> 384</tbody> 385</table></div> 386</div> 387</div> 388<hr> 389<div class="refsect2"> 390<a name="gst-app-sink-get-caps"></a><h3>gst_app_sink_get_caps ()</h3> 391<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstCaps.html#GstCaps-struct"><span class="returnvalue">GstCaps</span></a> * 392gst_app_sink_get_caps (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>);</pre> 393<p>Get the configured caps on <em class="parameter"><code>appsink</code></em> 394.</p> 395<div class="refsect3"> 396<a name="gst-app-sink-get-caps.parameters"></a><h4>Parameters</h4> 397<div class="informaltable"><table class="informaltable" width="100%" border="0"> 398<colgroup> 399<col width="150px" class="parameters_name"> 400<col class="parameters_description"> 401<col width="200px" class="parameters_annotations"> 402</colgroup> 403<tbody><tr> 404<td class="parameter_name"><p>appsink</p></td> 405<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 406<td class="parameter_annotations"> </td> 407</tr></tbody> 408</table></div> 409</div> 410<div class="refsect3"> 411<a name="gst-app-sink-get-caps.returns"></a><h4>Returns</h4> 412<p> the <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstCaps.html#GstCaps-struct"><span class="type">GstCaps</span></a> accepted by the sink. <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstCaps.html#gst-caps-unref"><code class="function">gst_caps_unref()</code></a> after usage.</p> 413</div> 414</div> 415<hr> 416<div class="refsect2"> 417<a name="gst-app-sink-is-eos"></a><h3>gst_app_sink_is_eos ()</h3> 418<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 419gst_app_sink_is_eos (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>);</pre> 420<p>Check if <em class="parameter"><code>appsink</code></em> 421 is EOS, which is when no more samples can be pulled because 422an EOS event was received.</p> 423<p>This function also returns <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> when the appsink is not in the PAUSED or 424PLAYING state.</p> 425<div class="refsect3"> 426<a name="gst-app-sink-is-eos.parameters"></a><h4>Parameters</h4> 427<div class="informaltable"><table class="informaltable" width="100%" border="0"> 428<colgroup> 429<col width="150px" class="parameters_name"> 430<col class="parameters_description"> 431<col width="200px" class="parameters_annotations"> 432</colgroup> 433<tbody><tr> 434<td class="parameter_name"><p>appsink</p></td> 435<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 436<td class="parameter_annotations"> </td> 437</tr></tbody> 438</table></div> 439</div> 440<div class="refsect3"> 441<a name="gst-app-sink-is-eos.returns"></a><h4>Returns</h4> 442<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if no more samples can be pulled and the appsink is EOS.</p> 443</div> 444</div> 445<hr> 446<div class="refsect2"> 447<a name="gst-app-sink-set-emit-signals"></a><h3>gst_app_sink_set_emit_signals ()</h3> 448<pre class="programlisting"><span class="returnvalue">void</span> 449gst_app_sink_set_emit_signals (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>, 450 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> emit</code></em>);</pre> 451<p>Make appsink emit the "new-preroll" and "new-sample" signals. This option is 452by default disabled because signal emission is expensive and unneeded when 453the application prefers to operate in pull mode.</p> 454<div class="refsect3"> 455<a name="gst-app-sink-set-emit-signals.parameters"></a><h4>Parameters</h4> 456<div class="informaltable"><table class="informaltable" width="100%" border="0"> 457<colgroup> 458<col width="150px" class="parameters_name"> 459<col class="parameters_description"> 460<col width="200px" class="parameters_annotations"> 461</colgroup> 462<tbody> 463<tr> 464<td class="parameter_name"><p>appsink</p></td> 465<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 466<td class="parameter_annotations"> </td> 467</tr> 468<tr> 469<td class="parameter_name"><p>emit</p></td> 470<td class="parameter_description"><p>the new state</p></td> 471<td class="parameter_annotations"> </td> 472</tr> 473</tbody> 474</table></div> 475</div> 476</div> 477<hr> 478<div class="refsect2"> 479<a name="gst-app-sink-get-emit-signals"></a><h3>gst_app_sink_get_emit_signals ()</h3> 480<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 481gst_app_sink_get_emit_signals (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>);</pre> 482<p>Check if appsink will emit the "new-preroll" and "new-sample" signals.</p> 483<div class="refsect3"> 484<a name="gst-app-sink-get-emit-signals.parameters"></a><h4>Parameters</h4> 485<div class="informaltable"><table class="informaltable" width="100%" border="0"> 486<colgroup> 487<col width="150px" class="parameters_name"> 488<col class="parameters_description"> 489<col width="200px" class="parameters_annotations"> 490</colgroup> 491<tbody><tr> 492<td class="parameter_name"><p>appsink</p></td> 493<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 494<td class="parameter_annotations"> </td> 495</tr></tbody> 496</table></div> 497</div> 498<div class="refsect3"> 499<a name="gst-app-sink-get-emit-signals.returns"></a><h4>Returns</h4> 500<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>appsink</code></em> 501is emiting the "new-preroll" and "new-sample" 502signals.</p> 503</div> 504</div> 505<hr> 506<div class="refsect2"> 507<a name="gst-app-sink-set-max-buffers"></a><h3>gst_app_sink_set_max_buffers ()</h3> 508<pre class="programlisting"><span class="returnvalue">void</span> 509gst_app_sink_set_max_buffers (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>, 510 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> max</code></em>);</pre> 511<p>Set the maximum amount of buffers that can be queued in <em class="parameter"><code>appsink</code></em> 512. After this 513amount of buffers are queued in appsink, any more buffers will block upstream 514elements until a sample is pulled from <em class="parameter"><code>appsink</code></em> 515.</p> 516<div class="refsect3"> 517<a name="gst-app-sink-set-max-buffers.parameters"></a><h4>Parameters</h4> 518<div class="informaltable"><table class="informaltable" width="100%" border="0"> 519<colgroup> 520<col width="150px" class="parameters_name"> 521<col class="parameters_description"> 522<col width="200px" class="parameters_annotations"> 523</colgroup> 524<tbody> 525<tr> 526<td class="parameter_name"><p>appsink</p></td> 527<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 528<td class="parameter_annotations"> </td> 529</tr> 530<tr> 531<td class="parameter_name"><p>max</p></td> 532<td class="parameter_description"><p>the maximum number of buffers to queue</p></td> 533<td class="parameter_annotations"> </td> 534</tr> 535</tbody> 536</table></div> 537</div> 538</div> 539<hr> 540<div class="refsect2"> 541<a name="gst-app-sink-get-max-buffers"></a><h3>gst_app_sink_get_max_buffers ()</h3> 542<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a> 543gst_app_sink_get_max_buffers (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>);</pre> 544<p>Get the maximum amount of buffers that can be queued in <em class="parameter"><code>appsink</code></em> 545.</p> 546<div class="refsect3"> 547<a name="gst-app-sink-get-max-buffers.parameters"></a><h4>Parameters</h4> 548<div class="informaltable"><table class="informaltable" width="100%" border="0"> 549<colgroup> 550<col width="150px" class="parameters_name"> 551<col class="parameters_description"> 552<col width="200px" class="parameters_annotations"> 553</colgroup> 554<tbody><tr> 555<td class="parameter_name"><p>appsink</p></td> 556<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 557<td class="parameter_annotations"> </td> 558</tr></tbody> 559</table></div> 560</div> 561<div class="refsect3"> 562<a name="gst-app-sink-get-max-buffers.returns"></a><h4>Returns</h4> 563<p> The maximum amount of buffers that can be queued.</p> 564</div> 565</div> 566<hr> 567<div class="refsect2"> 568<a name="gst-app-sink-set-drop"></a><h3>gst_app_sink_set_drop ()</h3> 569<pre class="programlisting"><span class="returnvalue">void</span> 570gst_app_sink_set_drop (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>, 571 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> drop</code></em>);</pre> 572<p>Instruct <em class="parameter"><code>appsink</code></em> 573 to drop old buffers when the maximum amount of queued 574buffers is reached.</p> 575<div class="refsect3"> 576<a name="gst-app-sink-set-drop.parameters"></a><h4>Parameters</h4> 577<div class="informaltable"><table class="informaltable" width="100%" border="0"> 578<colgroup> 579<col width="150px" class="parameters_name"> 580<col class="parameters_description"> 581<col width="200px" class="parameters_annotations"> 582</colgroup> 583<tbody> 584<tr> 585<td class="parameter_name"><p>appsink</p></td> 586<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 587<td class="parameter_annotations"> </td> 588</tr> 589<tr> 590<td class="parameter_name"><p>drop</p></td> 591<td class="parameter_description"><p>the new state</p></td> 592<td class="parameter_annotations"> </td> 593</tr> 594</tbody> 595</table></div> 596</div> 597</div> 598<hr> 599<div class="refsect2"> 600<a name="gst-app-sink-get-drop"></a><h3>gst_app_sink_get_drop ()</h3> 601<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 602gst_app_sink_get_drop (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>);</pre> 603<p>Check if <em class="parameter"><code>appsink</code></em> 604 will drop old buffers when the maximum amount of queued 605buffers is reached.</p> 606<div class="refsect3"> 607<a name="gst-app-sink-get-drop.parameters"></a><h4>Parameters</h4> 608<div class="informaltable"><table class="informaltable" width="100%" border="0"> 609<colgroup> 610<col width="150px" class="parameters_name"> 611<col class="parameters_description"> 612<col width="200px" class="parameters_annotations"> 613</colgroup> 614<tbody><tr> 615<td class="parameter_name"><p>appsink</p></td> 616<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 617<td class="parameter_annotations"> </td> 618</tr></tbody> 619</table></div> 620</div> 621<div class="refsect3"> 622<a name="gst-app-sink-get-drop.returns"></a><h4>Returns</h4> 623<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>appsink</code></em> 624is dropping old buffers when the queue is 625filled.</p> 626</div> 627</div> 628<hr> 629<div class="refsect2"> 630<a name="gst-app-sink-pull-preroll"></a><h3>gst_app_sink_pull_preroll ()</h3> 631<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="returnvalue">GstSample</span></a> * 632gst_app_sink_pull_preroll (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>);</pre> 633<p>Get the last preroll sample in <em class="parameter"><code>appsink</code></em> 634. This was the sample that caused the 635appsink to preroll in the PAUSED state.</p> 636<p>This function is typically used when dealing with a pipeline in the PAUSED 637state. Calling this function after doing a seek will give the sample right 638after the seek position.</p> 639<p>Calling this function will clear the internal reference to the preroll 640buffer.</p> 641<p>Note that the preroll sample will also be returned as the first sample 642when calling <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-pull-sample" title="gst_app_sink_pull_sample ()"><code class="function">gst_app_sink_pull_sample()</code></a>.</p> 643<p>If an EOS event was received before any buffers, this function returns 644<a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. Use <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-is-eos" title="gst_app_sink_is_eos ()"><code class="function">gst_app_sink_is_eos()</code></a> to check for the EOS condition.</p> 645<p>This function blocks until a preroll sample or EOS is received or the appsink 646element is set to the READY/NULL state.</p> 647<div class="refsect3"> 648<a name="gst-app-sink-pull-preroll.parameters"></a><h4>Parameters</h4> 649<div class="informaltable"><table class="informaltable" width="100%" border="0"> 650<colgroup> 651<col width="150px" class="parameters_name"> 652<col class="parameters_description"> 653<col width="200px" class="parameters_annotations"> 654</colgroup> 655<tbody><tr> 656<td class="parameter_name"><p>appsink</p></td> 657<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 658<td class="parameter_annotations"> </td> 659</tr></tbody> 660</table></div> 661</div> 662<div class="refsect3"> 663<a name="gst-app-sink-pull-preroll.returns"></a><h4>Returns</h4> 664<p>a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="type">GstSample</span></a> or NULL when the appsink is stopped or EOS. 665Call <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#gst-sample-unref"><code class="function">gst_sample_unref()</code></a> after usage. </p> 666<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> 667</div> 668</div> 669<hr> 670<div class="refsect2"> 671<a name="gst-app-sink-pull-sample"></a><h3>gst_app_sink_pull_sample ()</h3> 672<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="returnvalue">GstSample</span></a> * 673gst_app_sink_pull_sample (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>);</pre> 674<p>This function blocks until a sample or EOS becomes available or the appsink 675element is set to the READY/NULL state.</p> 676<p>This function will only return samples when the appsink is in the PLAYING 677state. All rendered buffers will be put in a queue so that the application 678can pull samples at its own rate. Note that when the application does not 679pull samples fast enough, the queued buffers could consume a lot of memory, 680especially when dealing with raw video frames.</p> 681<p>If an EOS event was received before any buffers, this function returns 682<a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. Use <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-is-eos" title="gst_app_sink_is_eos ()"><code class="function">gst_app_sink_is_eos()</code></a> to check for the EOS condition.</p> 683<div class="refsect3"> 684<a name="gst-app-sink-pull-sample.parameters"></a><h4>Parameters</h4> 685<div class="informaltable"><table class="informaltable" width="100%" border="0"> 686<colgroup> 687<col width="150px" class="parameters_name"> 688<col class="parameters_description"> 689<col width="200px" class="parameters_annotations"> 690</colgroup> 691<tbody><tr> 692<td class="parameter_name"><p>appsink</p></td> 693<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 694<td class="parameter_annotations"> </td> 695</tr></tbody> 696</table></div> 697</div> 698<div class="refsect3"> 699<a name="gst-app-sink-pull-sample.returns"></a><h4>Returns</h4> 700<p>a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="type">GstSample</span></a> or NULL when the appsink is stopped or EOS. 701Call <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#gst-sample-unref"><code class="function">gst_sample_unref()</code></a> after usage. </p> 702<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> 703</div> 704</div> 705<hr> 706<div class="refsect2"> 707<a name="gst-app-sink-try-pull-preroll"></a><h3>gst_app_sink_try_pull_preroll ()</h3> 708<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="returnvalue">GstSample</span></a> * 709gst_app_sink_try_pull_preroll (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>, 710 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a> timeout</code></em>);</pre> 711<p>Get the last preroll sample in <em class="parameter"><code>appsink</code></em> 712. This was the sample that caused the 713appsink to preroll in the PAUSED state.</p> 714<p>This function is typically used when dealing with a pipeline in the PAUSED 715state. Calling this function after doing a seek will give the sample right 716after the seek position.</p> 717<p>Calling this function will clear the internal reference to the preroll 718buffer.</p> 719<p>Note that the preroll sample will also be returned as the first sample 720when calling <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-pull-sample" title="gst_app_sink_pull_sample ()"><code class="function">gst_app_sink_pull_sample()</code></a>.</p> 721<p>If an EOS event was received before any buffers or the timeout expires, 722this function returns <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. Use <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-is-eos" title="gst_app_sink_is_eos ()"><code class="function">gst_app_sink_is_eos()</code></a> to check for the EOS 723condition.</p> 724<p>This function blocks until a preroll sample or EOS is received, the appsink 725element is set to the READY/NULL state, or the timeout expires.</p> 726<div class="refsect3"> 727<a name="gst-app-sink-try-pull-preroll.parameters"></a><h4>Parameters</h4> 728<div class="informaltable"><table class="informaltable" width="100%" border="0"> 729<colgroup> 730<col width="150px" class="parameters_name"> 731<col class="parameters_description"> 732<col width="200px" class="parameters_annotations"> 733</colgroup> 734<tbody> 735<tr> 736<td class="parameter_name"><p>appsink</p></td> 737<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 738<td class="parameter_annotations"> </td> 739</tr> 740<tr> 741<td class="parameter_name"><p>timeout</p></td> 742<td class="parameter_description"><p>the maximum amount of time to wait for the preroll sample</p></td> 743<td class="parameter_annotations"> </td> 744</tr> 745</tbody> 746</table></div> 747</div> 748<div class="refsect3"> 749<a name="gst-app-sink-try-pull-preroll.returns"></a><h4>Returns</h4> 750<p>a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="type">GstSample</span></a> or NULL when the appsink is stopped or EOS or the timeout expires. 751Call <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#gst-sample-unref"><code class="function">gst_sample_unref()</code></a> after usage. </p> 752<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> 753</div> 754<p class="since">Since: <a class="link" href="ix06.html#api-index-1.10">1.10</a></p> 755</div> 756<hr> 757<div class="refsect2"> 758<a name="gst-app-sink-try-pull-sample"></a><h3>gst_app_sink_try_pull_sample ()</h3> 759<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="returnvalue">GstSample</span></a> * 760gst_app_sink_try_pull_sample (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>, 761 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a> timeout</code></em>);</pre> 762<p>This function blocks until a sample or EOS becomes available or the appsink 763element is set to the READY/NULL state or the timeout expires.</p> 764<p>This function will only return samples when the appsink is in the PLAYING 765state. All rendered buffers will be put in a queue so that the application 766can pull samples at its own rate. Note that when the application does not 767pull samples fast enough, the queued buffers could consume a lot of memory, 768especially when dealing with raw video frames.</p> 769<p>If an EOS event was received before any buffers or the timeout expires, 770this function returns <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. Use <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-is-eos" title="gst_app_sink_is_eos ()"><code class="function">gst_app_sink_is_eos()</code></a> to check for the EOS 771condition.</p> 772<div class="refsect3"> 773<a name="gst-app-sink-try-pull-sample.parameters"></a><h4>Parameters</h4> 774<div class="informaltable"><table class="informaltable" width="100%" border="0"> 775<colgroup> 776<col width="150px" class="parameters_name"> 777<col class="parameters_description"> 778<col width="200px" class="parameters_annotations"> 779</colgroup> 780<tbody> 781<tr> 782<td class="parameter_name"><p>appsink</p></td> 783<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 784<td class="parameter_annotations"> </td> 785</tr> 786<tr> 787<td class="parameter_name"><p>timeout</p></td> 788<td class="parameter_description"><p>the maximum amount of time to wait for a sample</p></td> 789<td class="parameter_annotations"> </td> 790</tr> 791</tbody> 792</table></div> 793</div> 794<div class="refsect3"> 795<a name="gst-app-sink-try-pull-sample.returns"></a><h4>Returns</h4> 796<p>a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="type">GstSample</span></a> or NULL when the appsink is stopped or EOS or the timeout expires. 797Call <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#gst-sample-unref"><code class="function">gst_sample_unref()</code></a> after usage. </p> 798<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> 799</div> 800<p class="since">Since: <a class="link" href="ix06.html#api-index-1.10">1.10</a></p> 801</div> 802<hr> 803<div class="refsect2"> 804<a name="gst-app-sink-get-buffer-list-support"></a><h3>gst_app_sink_get_buffer_list_support ()</h3> 805<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 806gst_app_sink_get_buffer_list_support (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>);</pre> 807<p>Check if <em class="parameter"><code>appsink</code></em> 808 supports buffer lists.</p> 809<div class="refsect3"> 810<a name="gst-app-sink-get-buffer-list-support.parameters"></a><h4>Parameters</h4> 811<div class="informaltable"><table class="informaltable" width="100%" border="0"> 812<colgroup> 813<col width="150px" class="parameters_name"> 814<col class="parameters_description"> 815<col width="200px" class="parameters_annotations"> 816</colgroup> 817<tbody><tr> 818<td class="parameter_name"><p>appsink</p></td> 819<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 820<td class="parameter_annotations"> </td> 821</tr></tbody> 822</table></div> 823</div> 824<div class="refsect3"> 825<a name="gst-app-sink-get-buffer-list-support.returns"></a><h4>Returns</h4> 826<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>appsink</code></em> 827supports buffer lists.</p> 828</div> 829<p class="since">Since: <a class="link" href="ix05.html#api-index-1.12">1.12</a></p> 830</div> 831<hr> 832<div class="refsect2"> 833<a name="gst-app-sink-set-buffer-list-support"></a><h3>gst_app_sink_set_buffer_list_support ()</h3> 834<pre class="programlisting"><span class="returnvalue">void</span> 835gst_app_sink_set_buffer_list_support (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>, 836 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> enable_lists</code></em>);</pre> 837<p>Instruct <em class="parameter"><code>appsink</code></em> 838 to enable or disable buffer list support.</p> 839<p>For backwards-compatibility reasons applications need to opt in 840to indicate that they will be able to handle buffer lists.</p> 841<div class="refsect3"> 842<a name="gst-app-sink-set-buffer-list-support.parameters"></a><h4>Parameters</h4> 843<div class="informaltable"><table class="informaltable" width="100%" border="0"> 844<colgroup> 845<col width="150px" class="parameters_name"> 846<col class="parameters_description"> 847<col width="200px" class="parameters_annotations"> 848</colgroup> 849<tbody> 850<tr> 851<td class="parameter_name"><p>appsink</p></td> 852<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 853<td class="parameter_annotations"> </td> 854</tr> 855<tr> 856<td class="parameter_name"><p>enable_lists</p></td> 857<td class="parameter_description"><p>enable or disable buffer list support</p></td> 858<td class="parameter_annotations"> </td> 859</tr> 860</tbody> 861</table></div> 862</div> 863<p class="since">Since: <a class="link" href="ix05.html#api-index-1.12">1.12</a></p> 864</div> 865<hr> 866<div class="refsect2"> 867<a name="gst-app-sink-get-wait-on-eos"></a><h3>gst_app_sink_get_wait_on_eos ()</h3> 868<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 869gst_app_sink_get_wait_on_eos (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>);</pre> 870<p>Check if <em class="parameter"><code>appsink</code></em> 871 will wait for all buffers to be consumed when an EOS is 872received.</p> 873<div class="refsect3"> 874<a name="gst-app-sink-get-wait-on-eos.parameters"></a><h4>Parameters</h4> 875<div class="informaltable"><table class="informaltable" width="100%" border="0"> 876<colgroup> 877<col width="150px" class="parameters_name"> 878<col class="parameters_description"> 879<col width="200px" class="parameters_annotations"> 880</colgroup> 881<tbody><tr> 882<td class="parameter_name"><p>appsink</p></td> 883<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 884<td class="parameter_annotations"> </td> 885</tr></tbody> 886</table></div> 887</div> 888<div class="refsect3"> 889<a name="gst-app-sink-get-wait-on-eos.returns"></a><h4>Returns</h4> 890<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>appsink</code></em> 891will wait for all buffers to be consumed when an 892EOS is received.</p> 893</div> 894</div> 895<hr> 896<div class="refsect2"> 897<a name="gst-app-sink-set-wait-on-eos"></a><h3>gst_app_sink_set_wait_on_eos ()</h3> 898<pre class="programlisting"><span class="returnvalue">void</span> 899gst_app_sink_set_wait_on_eos (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>, 900 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> wait</code></em>);</pre> 901<p>Instruct <em class="parameter"><code>appsink</code></em> 902 to wait for all buffers to be consumed when an EOS is received.</p> 903<div class="refsect3"> 904<a name="gst-app-sink-set-wait-on-eos.parameters"></a><h4>Parameters</h4> 905<div class="informaltable"><table class="informaltable" width="100%" border="0"> 906<colgroup> 907<col width="150px" class="parameters_name"> 908<col class="parameters_description"> 909<col width="200px" class="parameters_annotations"> 910</colgroup> 911<tbody> 912<tr> 913<td class="parameter_name"><p>appsink</p></td> 914<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 915<td class="parameter_annotations"> </td> 916</tr> 917<tr> 918<td class="parameter_name"><p>wait</p></td> 919<td class="parameter_description"><p>the new state</p></td> 920<td class="parameter_annotations"> </td> 921</tr> 922</tbody> 923</table></div> 924</div> 925</div> 926<hr> 927<div class="refsect2"> 928<a name="gst-app-sink-set-callbacks"></a><h3>gst_app_sink_set_callbacks ()</h3> 929<pre class="programlisting"><span class="returnvalue">void</span> 930gst_app_sink_set_callbacks (<em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink</code></em>, 931 <em class="parameter"><code><a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSinkCallbacks" title="GstAppSinkCallbacks"><span class="type">GstAppSinkCallbacks</span></a> *callbacks</code></em>, 932 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>, 933 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> notify</code></em>);</pre> 934<p>Set callbacks which will be executed for each new preroll, new sample and eos. 935This is an alternative to using the signals, it has lower overhead and is thus 936less expensive, but also less flexible.</p> 937<p>If callbacks are installed, no signals will be emitted for performance 938reasons.</p> 939<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> 940<div class="refsect3"> 941<a name="gst-app-sink-set-callbacks.parameters"></a><h4>Parameters</h4> 942<div class="informaltable"><table class="informaltable" width="100%" border="0"> 943<colgroup> 944<col width="150px" class="parameters_name"> 945<col class="parameters_description"> 946<col width="200px" class="parameters_annotations"> 947</colgroup> 948<tbody> 949<tr> 950<td class="parameter_name"><p>appsink</p></td> 951<td class="parameter_description"><p>a <a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a></p></td> 952<td class="parameter_annotations"> </td> 953</tr> 954<tr> 955<td class="parameter_name"><p>callbacks</p></td> 956<td class="parameter_description"><p>the callbacks</p></td> 957<td class="parameter_annotations"> </td> 958</tr> 959<tr> 960<td class="parameter_name"><p>user_data</p></td> 961<td class="parameter_description"><p>a user_data argument for the callbacks</p></td> 962<td class="parameter_annotations"> </td> 963</tr> 964<tr> 965<td class="parameter_name"><p>notify</p></td> 966<td class="parameter_description"><p>a destroy notify function</p></td> 967<td class="parameter_annotations"> </td> 968</tr> 969</tbody> 970</table></div> 971</div> 972</div> 973</div> 974<div class="refsect1"> 975<a name="gst-plugins-base-libs-appsink.other_details"></a><h2>Types and Values</h2> 976<div class="refsect2"> 977<a name="GstAppSinkCallbacks"></a><h3>GstAppSinkCallbacks</h3> 978<pre class="programlisting">typedef struct { 979 void (*eos) (GstAppSink *appsink, gpointer user_data); 980 GstFlowReturn (*new_preroll) (GstAppSink *appsink, gpointer user_data); 981 GstFlowReturn (*new_sample) (GstAppSink *appsink, gpointer user_data); 982} GstAppSinkCallbacks; 983</pre> 984<p>A set of callbacks that can be installed on the appsink with 985<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-set-callbacks" title="gst_app_sink_set_callbacks ()"><code class="function">gst_app_sink_set_callbacks()</code></a>.</p> 986<div class="refsect3"> 987<a name="GstAppSinkCallbacks.members"></a><h4>Members</h4> 988<div class="informaltable"><table class="informaltable" width="100%" border="0"> 989<colgroup> 990<col width="300px" class="struct_members_name"> 991<col class="struct_members_description"> 992<col width="200px" class="struct_members_annotations"> 993</colgroup> 994<tbody> 995<tr> 996<td class="struct_member_name"><p><em class="structfield"><code><a name="GstAppSinkCallbacks.eos"></a>eos</code></em> ()</p></td> 997<td class="struct_member_description"><p>Called when the end-of-stream has been reached. This callback 998is called from the streaming thread.</p></td> 999<td class="struct_member_annotations"> </td> 1000</tr> 1001<tr> 1002<td class="struct_member_name"><p><em class="structfield"><code><a name="GstAppSinkCallbacks.new-preroll"></a>new_preroll</code></em> ()</p></td> 1003<td class="struct_member_description"><p>Called when a new preroll sample is available. 1004This callback is called from the streaming thread. 1005The new preroll sample can be retrieved with 1006<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-pull-preroll" title="gst_app_sink_pull_preroll ()"><code class="function">gst_app_sink_pull_preroll()</code></a> either from this callback 1007or from any other thread.</p></td> 1008<td class="struct_member_annotations"> </td> 1009</tr> 1010<tr> 1011<td class="struct_member_name"><p><em class="structfield"><code><a name="GstAppSinkCallbacks.new-sample"></a>new_sample</code></em> ()</p></td> 1012<td class="struct_member_description"><p>Called when a new sample is available. 1013This callback is called from the streaming thread. 1014The new sample can be retrieved with 1015<a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-pull-sample" title="gst_app_sink_pull_sample ()"><code class="function">gst_app_sink_pull_sample()</code></a> either from this callback 1016or from any other thread.</p></td> 1017<td class="struct_member_annotations"> </td> 1018</tr> 1019</tbody> 1020</table></div> 1021</div> 1022</div> 1023</div> 1024<div class="refsect1"> 1025<a name="gst-plugins-base-libs-appsink.property-details"></a><h2>Property Details</h2> 1026<div class="refsect2"> 1027<a name="GstAppSink--buffer-list"></a><h3>The <code class="literal">“buffer-list”</code> property</h3> 1028<pre class="programlisting"> “buffer-list” <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre> 1029<p>Use buffer lists.</p> 1030<p>Flags: Read / Write</p> 1031<p>Default value: FALSE</p> 1032</div> 1033<hr> 1034<div class="refsect2"> 1035<a name="GstAppSink--caps"></a><h3>The <code class="literal">“caps”</code> property</h3> 1036<pre class="programlisting"> “caps” <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstCaps.html#GstCaps-struct"><span class="type">GstCaps</span></a> *</pre> 1037<p>The allowed caps for the sink pad.</p> 1038<p>Flags: Read / Write</p> 1039</div> 1040<hr> 1041<div class="refsect2"> 1042<a name="GstAppSink--drop"></a><h3>The <code class="literal">“drop”</code> property</h3> 1043<pre class="programlisting"> “drop” <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre> 1044<p>Drop old buffers when the buffer queue is filled.</p> 1045<p>Flags: Read / Write</p> 1046<p>Default value: FALSE</p> 1047</div> 1048<hr> 1049<div class="refsect2"> 1050<a name="GstAppSink--emit-signals"></a><h3>The <code class="literal">“emit-signals”</code> property</h3> 1051<pre class="programlisting"> “emit-signals” <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre> 1052<p>Emit new-preroll and new-sample signals.</p> 1053<p>Flags: Read / Write</p> 1054<p>Default value: FALSE</p> 1055</div> 1056<hr> 1057<div class="refsect2"> 1058<a name="GstAppSink--eos"></a><h3>The <code class="literal">“eos”</code> property</h3> 1059<pre class="programlisting"> “eos” <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre> 1060<p>Check if the sink is EOS or not started.</p> 1061<p>Flags: Read</p> 1062<p>Default value: TRUE</p> 1063</div> 1064<hr> 1065<div class="refsect2"> 1066<a name="GstAppSink--max-buffers"></a><h3>The <code class="literal">“max-buffers”</code> property</h3> 1067<pre class="programlisting"> “max-buffers” <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre> 1068<p>The maximum number of buffers to queue internally (0 = unlimited).</p> 1069<p>Flags: Read / Write</p> 1070<p>Default value: 0</p> 1071</div> 1072<hr> 1073<div class="refsect2"> 1074<a name="GstAppSink--wait-on-eos"></a><h3>The <code class="literal">“wait-on-eos”</code> property</h3> 1075<pre class="programlisting"> “wait-on-eos” <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre> 1076<p>Wait for all buffers to be processed after receiving an EOS.</p> 1077<p>Flags: Read / Write</p> 1078<p>Default value: TRUE</p> 1079</div> 1080</div> 1081<div class="refsect1"> 1082<a name="gst-plugins-base-libs-appsink.signal-details"></a><h2>Signal Details</h2> 1083<div class="refsect2"> 1084<a name="GstAppSink-eos"></a><h3>The <code class="literal">“eos”</code> signal</h3> 1085<pre class="programlisting"><span class="returnvalue">void</span> 1086user_function (<a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink, 1087 <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre> 1088<p>Signal that the end-of-stream has been reached. This signal is emitted from 1089the streaming thread.</p> 1090<div class="refsect3"> 1091<a name="GstAppSink-eos.parameters"></a><h4>Parameters</h4> 1092<div class="informaltable"><table class="informaltable" width="100%" border="0"> 1093<colgroup> 1094<col width="150px" class="parameters_name"> 1095<col class="parameters_description"> 1096<col width="200px" class="parameters_annotations"> 1097</colgroup> 1098<tbody> 1099<tr> 1100<td class="parameter_name"><p>appsink</p></td> 1101<td class="parameter_description"><p>the appsink element that emitted the signal</p></td> 1102<td class="parameter_annotations"> </td> 1103</tr> 1104<tr> 1105<td class="parameter_name"><p>user_data</p></td> 1106<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td> 1107<td class="parameter_annotations"> </td> 1108</tr> 1109</tbody> 1110</table></div> 1111</div> 1112<p>Flags: <a href="/usr/share/gtk-doc/html/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p> 1113</div> 1114<hr> 1115<div class="refsect2"> 1116<a name="GstAppSink-new-preroll"></a><h3>The <code class="literal">“new-preroll”</code> signal</h3> 1117<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstPad.html#GstFlowReturn"><span class="returnvalue">GstFlowReturn</span></a> 1118user_function (<a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink, 1119 <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre> 1120<p>Signal that a new preroll sample is available.</p> 1121<p>This signal is emitted from the streaming thread and only when the 1122"emit-signals" property is <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>.</p> 1123<p>The new preroll sample can be retrieved with the "pull-preroll" action 1124signal or <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-pull-preroll" title="gst_app_sink_pull_preroll ()"><code class="function">gst_app_sink_pull_preroll()</code></a> either from this signal callback 1125or from any other thread.</p> 1126<p>Note that this signal is only emitted when the "emit-signals" property is 1127set to <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, which it is not by default for performance reasons.</p> 1128<div class="refsect3"> 1129<a name="GstAppSink-new-preroll.parameters"></a><h4>Parameters</h4> 1130<div class="informaltable"><table class="informaltable" width="100%" border="0"> 1131<colgroup> 1132<col width="150px" class="parameters_name"> 1133<col class="parameters_description"> 1134<col width="200px" class="parameters_annotations"> 1135</colgroup> 1136<tbody> 1137<tr> 1138<td class="parameter_name"><p>appsink</p></td> 1139<td class="parameter_description"><p>the appsink element that emitted the signal</p></td> 1140<td class="parameter_annotations"> </td> 1141</tr> 1142<tr> 1143<td class="parameter_name"><p>user_data</p></td> 1144<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td> 1145<td class="parameter_annotations"> </td> 1146</tr> 1147</tbody> 1148</table></div> 1149</div> 1150<p>Flags: <a href="/usr/share/gtk-doc/html/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p> 1151</div> 1152<hr> 1153<div class="refsect2"> 1154<a name="GstAppSink-new-sample"></a><h3>The <code class="literal">“new-sample”</code> signal</h3> 1155<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstPad.html#GstFlowReturn"><span class="returnvalue">GstFlowReturn</span></a> 1156user_function (<a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink, 1157 <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre> 1158<p>Signal that a new sample is available.</p> 1159<p>This signal is emitted from the streaming thread and only when the 1160"emit-signals" property is <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>.</p> 1161<p>The new sample can be retrieved with the "pull-sample" action 1162signal or <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-pull-sample" title="gst_app_sink_pull_sample ()"><code class="function">gst_app_sink_pull_sample()</code></a> either from this signal callback 1163or from any other thread.</p> 1164<p>Note that this signal is only emitted when the "emit-signals" property is 1165set to <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, which it is not by default for performance reasons.</p> 1166<div class="refsect3"> 1167<a name="GstAppSink-new-sample.parameters"></a><h4>Parameters</h4> 1168<div class="informaltable"><table class="informaltable" width="100%" border="0"> 1169<colgroup> 1170<col width="150px" class="parameters_name"> 1171<col class="parameters_description"> 1172<col width="200px" class="parameters_annotations"> 1173</colgroup> 1174<tbody> 1175<tr> 1176<td class="parameter_name"><p>appsink</p></td> 1177<td class="parameter_description"><p>the appsink element that emitted the signal</p></td> 1178<td class="parameter_annotations"> </td> 1179</tr> 1180<tr> 1181<td class="parameter_name"><p>user_data</p></td> 1182<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td> 1183<td class="parameter_annotations"> </td> 1184</tr> 1185</tbody> 1186</table></div> 1187</div> 1188<p>Flags: <a href="/usr/share/gtk-doc/html/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p> 1189</div> 1190<hr> 1191<div class="refsect2"> 1192<a name="GstAppSink-pull-preroll"></a><h3>The <code class="literal">“pull-preroll”</code> signal</h3> 1193<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="returnvalue">GstSample</span></a>* 1194user_function (<a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink, 1195 <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre> 1196<p>Get the last preroll sample in <em class="parameter"><code>appsink</code></em> 1197. This was the sample that caused the 1198appsink to preroll in the PAUSED state.</p> 1199<p>This function is typically used when dealing with a pipeline in the PAUSED 1200state. Calling this function after doing a seek will give the sample right 1201after the seek position.</p> 1202<p>Calling this function will clear the internal reference to the preroll 1203buffer.</p> 1204<p>Note that the preroll sample will also be returned as the first sample 1205when calling <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-pull-sample" title="gst_app_sink_pull_sample ()"><code class="function">gst_app_sink_pull_sample()</code></a> or the "pull-sample" action signal.</p> 1206<p>If an EOS event was received before any buffers, this function returns 1207<a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. Use <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-is-eos" title="gst_app_sink_is_eos ()"><code class="function">gst_app_sink_is_eos()</code></a> to check for the EOS condition.</p> 1208<p>This function blocks until a preroll sample or EOS is received or the appsink 1209element is set to the READY/NULL state.</p> 1210<div class="refsect3"> 1211<a name="GstAppSink-pull-preroll.parameters"></a><h4>Parameters</h4> 1212<div class="informaltable"><table class="informaltable" width="100%" border="0"> 1213<colgroup> 1214<col width="150px" class="parameters_name"> 1215<col class="parameters_description"> 1216<col width="200px" class="parameters_annotations"> 1217</colgroup> 1218<tbody> 1219<tr> 1220<td class="parameter_name"><p>appsink</p></td> 1221<td class="parameter_description"><p>the appsink element to emit this signal on</p></td> 1222<td class="parameter_annotations"> </td> 1223</tr> 1224<tr> 1225<td class="parameter_name"><p>user_data</p></td> 1226<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td> 1227<td class="parameter_annotations"> </td> 1228</tr> 1229</tbody> 1230</table></div> 1231</div> 1232<div class="refsect3"> 1233<a name="GstAppSink-pull-preroll.returns"></a><h4>Returns</h4> 1234<p> a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="type">GstSample</span></a> or NULL when the appsink is stopped or EOS.</p> 1235</div> 1236<p>Flags: <a href="/usr/share/gtk-doc/html/gobject/gobject-Signals.html#G-SIGNAL-ACTION:CAPS">Action</a></p> 1237</div> 1238<hr> 1239<div class="refsect2"> 1240<a name="GstAppSink-pull-sample"></a><h3>The <code class="literal">“pull-sample”</code> signal</h3> 1241<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="returnvalue">GstSample</span></a>* 1242user_function (<a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink, 1243 <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre> 1244<p>This function blocks until a sample or EOS becomes available or the appsink 1245element is set to the READY/NULL state.</p> 1246<p>This function will only return samples when the appsink is in the PLAYING 1247state. All rendered samples will be put in a queue so that the application 1248can pull samples at its own rate.</p> 1249<p>Note that when the application does not pull samples fast enough, the 1250queued samples could consume a lot of memory, especially when dealing with 1251raw video frames. It's possible to control the behaviour of the queue with 1252the "drop" and "max-buffers" properties.</p> 1253<p>If an EOS event was received before any buffers, this function returns 1254<a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. Use <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-is-eos" title="gst_app_sink_is_eos ()"><code class="function">gst_app_sink_is_eos()</code></a> to check for the EOS condition.</p> 1255<div class="refsect3"> 1256<a name="GstAppSink-pull-sample.parameters"></a><h4>Parameters</h4> 1257<div class="informaltable"><table class="informaltable" width="100%" border="0"> 1258<colgroup> 1259<col width="150px" class="parameters_name"> 1260<col class="parameters_description"> 1261<col width="200px" class="parameters_annotations"> 1262</colgroup> 1263<tbody> 1264<tr> 1265<td class="parameter_name"><p>appsink</p></td> 1266<td class="parameter_description"><p>the appsink element to emit this signal on</p></td> 1267<td class="parameter_annotations"> </td> 1268</tr> 1269<tr> 1270<td class="parameter_name"><p>user_data</p></td> 1271<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td> 1272<td class="parameter_annotations"> </td> 1273</tr> 1274</tbody> 1275</table></div> 1276</div> 1277<div class="refsect3"> 1278<a name="GstAppSink-pull-sample.returns"></a><h4>Returns</h4> 1279<p> a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="type">GstSample</span></a> or NULL when the appsink is stopped or EOS.</p> 1280</div> 1281<p>Flags: <a href="/usr/share/gtk-doc/html/gobject/gobject-Signals.html#G-SIGNAL-ACTION:CAPS">Action</a></p> 1282</div> 1283<hr> 1284<div class="refsect2"> 1285<a name="GstAppSink-try-pull-preroll"></a><h3>The <code class="literal">“try-pull-preroll”</code> signal</h3> 1286<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="returnvalue">GstSample</span></a>* 1287user_function (<a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink, 1288 <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint64"><span class="type">guint64</span></a> timeout, 1289 <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre> 1290<p>Get the last preroll sample in <em class="parameter"><code>appsink</code></em> 1291. This was the sample that caused the 1292appsink to preroll in the PAUSED state.</p> 1293<p>This function is typically used when dealing with a pipeline in the PAUSED 1294state. Calling this function after doing a seek will give the sample right 1295after the seek position.</p> 1296<p>Calling this function will clear the internal reference to the preroll 1297buffer.</p> 1298<p>Note that the preroll sample will also be returned as the first sample 1299when calling <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-pull-sample" title="gst_app_sink_pull_sample ()"><code class="function">gst_app_sink_pull_sample()</code></a> or the "pull-sample" action signal.</p> 1300<p>If an EOS event was received before any buffers or the timeout expires, 1301this function returns <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. Use <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-is-eos" title="gst_app_sink_is_eos ()"><code class="function">gst_app_sink_is_eos()</code></a> to check for the EOS 1302condition.</p> 1303<p>This function blocks until a preroll sample or EOS is received, the appsink 1304element is set to the READY/NULL state, or the timeout expires.</p> 1305<div class="refsect3"> 1306<a name="GstAppSink-try-pull-preroll.parameters"></a><h4>Parameters</h4> 1307<div class="informaltable"><table class="informaltable" width="100%" border="0"> 1308<colgroup> 1309<col width="150px" class="parameters_name"> 1310<col class="parameters_description"> 1311<col width="200px" class="parameters_annotations"> 1312</colgroup> 1313<tbody> 1314<tr> 1315<td class="parameter_name"><p>appsink</p></td> 1316<td class="parameter_description"><p>the appsink element to emit this signal on</p></td> 1317<td class="parameter_annotations"> </td> 1318</tr> 1319<tr> 1320<td class="parameter_name"><p>timeout</p></td> 1321<td class="parameter_description"><p>the maximum amount of time to wait for the preroll sample</p></td> 1322<td class="parameter_annotations"> </td> 1323</tr> 1324<tr> 1325<td class="parameter_name"><p>user_data</p></td> 1326<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td> 1327<td class="parameter_annotations"> </td> 1328</tr> 1329</tbody> 1330</table></div> 1331</div> 1332<div class="refsect3"> 1333<a name="GstAppSink-try-pull-preroll.returns"></a><h4>Returns</h4> 1334<p> a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="type">GstSample</span></a> or NULL when the appsink is stopped or EOS or the timeout expires.</p> 1335</div> 1336<p>Flags: <a href="/usr/share/gtk-doc/html/gobject/gobject-Signals.html#G-SIGNAL-ACTION:CAPS">Action</a></p> 1337<p class="since">Since: <a class="link" href="ix06.html#api-index-1.10">1.10</a></p> 1338</div> 1339<hr> 1340<div class="refsect2"> 1341<a name="GstAppSink-try-pull-sample"></a><h3>The <code class="literal">“try-pull-sample”</code> signal</h3> 1342<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="returnvalue">GstSample</span></a>* 1343user_function (<a class="link" href="gst-plugins-base-libs-appsink.html#GstAppSink"><span class="type">GstAppSink</span></a> *appsink, 1344 <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint64"><span class="type">guint64</span></a> timeout, 1345 <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre> 1346<p>This function blocks until a sample or EOS becomes available or the appsink 1347element is set to the READY/NULL state or the timeout expires.</p> 1348<p>This function will only return samples when the appsink is in the PLAYING 1349state. All rendered samples will be put in a queue so that the application 1350can pull samples at its own rate.</p> 1351<p>Note that when the application does not pull samples fast enough, the 1352queued samples could consume a lot of memory, especially when dealing with 1353raw video frames. It's possible to control the behaviour of the queue with 1354the "drop" and "max-buffers" properties.</p> 1355<p>If an EOS event was received before any buffers or the timeout expires, 1356this function returns <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. Use <a class="link" href="gst-plugins-base-libs-appsink.html#gst-app-sink-is-eos" title="gst_app_sink_is_eos ()"><code class="function">gst_app_sink_is_eos()</code></a> to check 1357for the EOS condition.</p> 1358<div class="refsect3"> 1359<a name="GstAppSink-try-pull-sample.parameters"></a><h4>Parameters</h4> 1360<div class="informaltable"><table class="informaltable" width="100%" border="0"> 1361<colgroup> 1362<col width="150px" class="parameters_name"> 1363<col class="parameters_description"> 1364<col width="200px" class="parameters_annotations"> 1365</colgroup> 1366<tbody> 1367<tr> 1368<td class="parameter_name"><p>appsink</p></td> 1369<td class="parameter_description"><p>the appsink element to emit this signal on</p></td> 1370<td class="parameter_annotations"> </td> 1371</tr> 1372<tr> 1373<td class="parameter_name"><p>timeout</p></td> 1374<td class="parameter_description"><p>the maximum amount of time to wait for a sample</p></td> 1375<td class="parameter_annotations"> </td> 1376</tr> 1377<tr> 1378<td class="parameter_name"><p>user_data</p></td> 1379<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td> 1380<td class="parameter_annotations"> </td> 1381</tr> 1382</tbody> 1383</table></div> 1384</div> 1385<div class="refsect3"> 1386<a name="GstAppSink-try-pull-sample.returns"></a><h4>Returns</h4> 1387<p> a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="type">GstSample</span></a> or NULL when the appsink is stopped or EOS or the timeout expires.</p> 1388</div> 1389<p>Flags: <a href="/usr/share/gtk-doc/html/gobject/gobject-Signals.html#G-SIGNAL-ACTION:CAPS">Action</a></p> 1390<p class="since">Since: <a class="link" href="ix06.html#api-index-1.10">1.10</a></p> 1391</div> 1392</div> 1393<div class="refsect1"> 1394<a name="gst-plugins-base-libs-appsink.see-also"></a><h2>See Also</h2> 1395<p><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSample.html#GstSample-struct"><span class="type">GstSample</span></a>, <a href="/usr/share/gtk-doc/html/gstreamer-libs-1.0/GstBaseSink.html#GstBaseSink-struct"><span class="type">GstBaseSink</span></a>, appsrc</p> 1396</div> 1397</div> 1398<div class="footer"> 1399<hr>Generated by GTK-Doc V1.28</div> 1400</body> 1401</html>