2 * Copyright (C) 2007 David Schleef <ds@schleef.org>
3 * (C) 2008 Wim Taymans <wim.taymans@gmail.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
22 * @short_description: Easy way for applications to extract samples from a
24 * @see_also: #GstSample, #GstBaseSink, appsrc
26 * Appsink is a sink plugin that supports many different methods for making
27 * the application get a handle on the GStreamer data in a pipeline. Unlike
28 * most GStreamer elements, Appsink provides external API functions.
30 * appsink can be used by linking to the gstappsink.h header file to access the
31 * methods or by using the appsink action signals and properties.
33 * The normal way of retrieving samples from appsink is by using the
34 * gst_app_sink_pull_sample() and gst_app_sink_pull_preroll() methods.
35 * These methods block until a sample becomes available in the sink or when the
36 * sink is shut down or reaches EOS. There are also timed variants of these
37 * methods, gst_app_sink_try_pull_sample() and gst_app_sink_try_pull_preroll(),
38 * which accept a timeout parameter to limit the amount of time to wait.
40 * Appsink will internally use a queue to collect buffers from the streaming
41 * thread. If the application is not pulling samples fast enough, this queue
42 * will consume a lot of memory over time. The "max-buffers" property can be
43 * used to limit the queue size. The "drop" property controls whether the
44 * streaming thread blocks or if older buffers are dropped when the maximum
45 * queue size is reached. Note that blocking the streaming thread can negatively
46 * affect real-time performance and should be avoided.
48 * If a blocking behaviour is not desirable, setting the "emit-signals" property
49 * to %TRUE will make appsink emit the "new-sample" and "new-preroll" signals
50 * when a sample can be pulled without blocking.
52 * The "caps" property on appsink can be used to control the formats that
53 * appsink can receive. This property can contain non-fixed caps, the format of
54 * the pulled samples can be obtained by getting the sample caps.
56 * If one of the pull-preroll or pull-sample methods return %NULL, the appsink
57 * is stopped or in the EOS state. You can check for the EOS state with the
58 * "eos" property or with the gst_app_sink_is_eos() method.
60 * The eos signal can also be used to be informed when the EOS state is reached
69 #include <gst/base/gstbasesink.h>
70 #include <gst/gstbuffer.h>
74 #include "gstappsink.h"
76 struct _GstAppSinkPrivate
79 gboolean emit_signals;
89 GstCaps *preroll_caps;
91 GstSegment preroll_segment;
92 GstSegment last_segment;
98 GstAppSinkCallbacks callbacks;
100 GDestroyNotify notify;
103 GST_DEBUG_CATEGORY_STATIC (app_sink_debug);
104 #define GST_CAT_DEFAULT app_sink_debug
116 SIGNAL_TRY_PULL_PREROLL,
117 SIGNAL_TRY_PULL_SAMPLE,
122 #define DEFAULT_PROP_EOS TRUE
123 #define DEFAULT_PROP_EMIT_SIGNALS FALSE
124 #define DEFAULT_PROP_MAX_BUFFERS 0
125 #define DEFAULT_PROP_DROP FALSE
126 #define DEFAULT_PROP_WAIT_ON_EOS TRUE
140 static GstStaticPadTemplate gst_app_sink_template =
141 GST_STATIC_PAD_TEMPLATE ("sink",
144 GST_STATIC_CAPS_ANY);
146 static void gst_app_sink_uri_handler_init (gpointer g_iface,
147 gpointer iface_data);
149 static void gst_app_sink_dispose (GObject * object);
150 static void gst_app_sink_finalize (GObject * object);
152 static void gst_app_sink_set_property (GObject * object, guint prop_id,
153 const GValue * value, GParamSpec * pspec);
154 static void gst_app_sink_get_property (GObject * object, guint prop_id,
155 GValue * value, GParamSpec * pspec);
157 static gboolean gst_app_sink_unlock_start (GstBaseSink * bsink);
158 static gboolean gst_app_sink_unlock_stop (GstBaseSink * bsink);
159 static gboolean gst_app_sink_start (GstBaseSink * psink);
160 static gboolean gst_app_sink_stop (GstBaseSink * psink);
161 static gboolean gst_app_sink_event (GstBaseSink * sink, GstEvent * event);
162 static gboolean gst_app_sink_query (GstBaseSink * bsink, GstQuery * query);
163 static GstFlowReturn gst_app_sink_preroll (GstBaseSink * psink,
165 static GstFlowReturn gst_app_sink_render (GstBaseSink * psink,
167 static gboolean gst_app_sink_setcaps (GstBaseSink * sink, GstCaps * caps);
168 static GstCaps *gst_app_sink_getcaps (GstBaseSink * psink, GstCaps * filter);
170 static guint gst_app_sink_signals[LAST_SIGNAL] = { 0 };
172 #define gst_app_sink_parent_class parent_class
173 G_DEFINE_TYPE_WITH_CODE (GstAppSink, gst_app_sink, GST_TYPE_BASE_SINK,
174 G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
175 gst_app_sink_uri_handler_init));
178 gst_app_sink_class_init (GstAppSinkClass * klass)
180 GObjectClass *gobject_class = (GObjectClass *) klass;
181 GstElementClass *element_class = (GstElementClass *) klass;
182 GstBaseSinkClass *basesink_class = (GstBaseSinkClass *) klass;
184 GST_DEBUG_CATEGORY_INIT (app_sink_debug, "appsink", 0, "appsink element");
186 gobject_class->dispose = gst_app_sink_dispose;
187 gobject_class->finalize = gst_app_sink_finalize;
189 gobject_class->set_property = gst_app_sink_set_property;
190 gobject_class->get_property = gst_app_sink_get_property;
192 g_object_class_install_property (gobject_class, PROP_CAPS,
193 g_param_spec_boxed ("caps", "Caps",
194 "The allowed caps for the sink pad", GST_TYPE_CAPS,
195 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
197 g_object_class_install_property (gobject_class, PROP_EOS,
198 g_param_spec_boolean ("eos", "EOS",
199 "Check if the sink is EOS or not started", DEFAULT_PROP_EOS,
200 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
202 g_object_class_install_property (gobject_class, PROP_EMIT_SIGNALS,
203 g_param_spec_boolean ("emit-signals", "Emit signals",
204 "Emit new-preroll and new-sample signals",
205 DEFAULT_PROP_EMIT_SIGNALS,
206 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
208 g_object_class_install_property (gobject_class, PROP_MAX_BUFFERS,
209 g_param_spec_uint ("max-buffers", "Max Buffers",
210 "The maximum number of buffers to queue internally (0 = unlimited)",
211 0, G_MAXUINT, DEFAULT_PROP_MAX_BUFFERS,
212 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
214 g_object_class_install_property (gobject_class, PROP_DROP,
215 g_param_spec_boolean ("drop", "Drop",
216 "Drop old buffers when the buffer queue is filled", DEFAULT_PROP_DROP,
217 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
220 * GstAppSink::wait-on-eos:
222 * Wait for all buffers to be processed after receiving an EOS.
224 * In cases where it is uncertain if an @appsink will have a consumer for its buffers
225 * when it receives an EOS, set to %FALSE to ensure that the @appsink will not hang.
229 g_object_class_install_property (gobject_class, PROP_WAIT_ON_EOS,
230 g_param_spec_boolean ("wait-on-eos", "Wait on EOS",
231 "Wait for all buffers to be processed after receiving an EOS",
232 DEFAULT_PROP_WAIT_ON_EOS,
233 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
237 * @appsink: the appsink element that emitted the signal
239 * Signal that the end-of-stream has been reached. This signal is emitted from
240 * the streaming thread.
242 gst_app_sink_signals[SIGNAL_EOS] =
243 g_signal_new ("eos", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
244 G_STRUCT_OFFSET (GstAppSinkClass, eos),
245 NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
247 * GstAppSink::new-preroll:
248 * @appsink: the appsink element that emitted the signal
250 * Signal that a new preroll sample is available.
252 * This signal is emitted from the streaming thread and only when the
253 * "emit-signals" property is %TRUE.
255 * The new preroll sample can be retrieved with the "pull-preroll" action
256 * signal or gst_app_sink_pull_preroll() either from this signal callback
257 * or from any other thread.
259 * Note that this signal is only emitted when the "emit-signals" property is
260 * set to %TRUE, which it is not by default for performance reasons.
262 gst_app_sink_signals[SIGNAL_NEW_PREROLL] =
263 g_signal_new ("new-preroll", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
264 G_STRUCT_OFFSET (GstAppSinkClass, new_preroll),
265 NULL, NULL, NULL, GST_TYPE_FLOW_RETURN, 0, G_TYPE_NONE);
267 * GstAppSink::new-sample:
268 * @appsink: the appsink element that emited the signal
270 * Signal that a new sample is available.
272 * This signal is emitted from the streaming thread and only when the
273 * "emit-signals" property is %TRUE.
275 * The new sample can be retrieved with the "pull-sample" action
276 * signal or gst_app_sink_pull_sample() either from this signal callback
277 * or from any other thread.
279 * Note that this signal is only emitted when the "emit-signals" property is
280 * set to %TRUE, which it is not by default for performance reasons.
282 gst_app_sink_signals[SIGNAL_NEW_SAMPLE] =
283 g_signal_new ("new-sample", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
284 G_STRUCT_OFFSET (GstAppSinkClass, new_sample),
285 NULL, NULL, NULL, GST_TYPE_FLOW_RETURN, 0, G_TYPE_NONE);
288 * GstAppSink::pull-preroll:
289 * @appsink: the appsink element to emit this signal on
291 * Get the last preroll sample in @appsink. This was the sample that caused the
292 * appsink to preroll in the PAUSED state. This sample can be pulled many times
293 * and remains available to the application even after EOS.
295 * This function is typically used when dealing with a pipeline in the PAUSED
296 * state. Calling this function after doing a seek will give the sample right
297 * after the seek position.
299 * Note that the preroll sample will also be returned as the first sample
300 * when calling gst_app_sink_pull_sample() or the "pull-sample" action signal.
302 * If an EOS event was received before any buffers, this function returns
303 * %NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
305 * This function blocks until a preroll sample or EOS is received or the appsink
306 * element is set to the READY/NULL state.
308 * Returns: a #GstSample or NULL when the appsink is stopped or EOS.
310 gst_app_sink_signals[SIGNAL_PULL_PREROLL] =
311 g_signal_new ("pull-preroll", G_TYPE_FROM_CLASS (klass),
312 G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstAppSinkClass,
313 pull_preroll), NULL, NULL, NULL, GST_TYPE_SAMPLE, 0, G_TYPE_NONE);
315 * GstAppSink::pull-sample:
316 * @appsink: the appsink element to emit this signal on
318 * This function blocks until a sample or EOS becomes available or the appsink
319 * element is set to the READY/NULL state.
321 * This function will only return samples when the appsink is in the PLAYING
322 * state. All rendered samples will be put in a queue so that the application
323 * can pull samples at its own rate.
325 * Note that when the application does not pull samples fast enough, the
326 * queued samples could consume a lot of memory, especially when dealing with
327 * raw video frames. It's possible to control the behaviour of the queue with
328 * the "drop" and "max-buffers" properties.
330 * If an EOS event was received before any buffers, this function returns
331 * %NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
333 * Returns: a #GstSample or NULL when the appsink is stopped or EOS.
335 gst_app_sink_signals[SIGNAL_PULL_SAMPLE] =
336 g_signal_new ("pull-sample", G_TYPE_FROM_CLASS (klass),
337 G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstAppSinkClass,
338 pull_sample), NULL, NULL, NULL, GST_TYPE_SAMPLE, 0, G_TYPE_NONE);
340 * GstAppSink::try-pull-preroll:
341 * @appsink: the appsink element to emit this signal on
342 * @timeout: the maximum amount of time to wait for the preroll sample
344 * Get the last preroll sample in @appsink. This was the sample that caused the
345 * appsink to preroll in the PAUSED state. This sample can be pulled many times
346 * and remains available to the application even after EOS.
348 * This function is typically used when dealing with a pipeline in the PAUSED
349 * state. Calling this function after doing a seek will give the sample right
350 * after the seek position.
352 * Note that the preroll sample will also be returned as the first sample
353 * when calling gst_app_sink_pull_sample() or the "pull-sample" action signal.
355 * If an EOS event was received before any buffers or the timeout expires,
356 * this function returns %NULL. Use gst_app_sink_is_eos () to check for the EOS
359 * This function blocks until a preroll sample or EOS is received, the appsink
360 * element is set to the READY/NULL state, or the timeout expires.
362 * Returns: a #GstSample or NULL when the appsink is stopped or EOS or the timeout expires.
366 gst_app_sink_signals[SIGNAL_TRY_PULL_PREROLL] =
367 g_signal_new ("try-pull-preroll", G_TYPE_FROM_CLASS (klass),
368 G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
369 G_STRUCT_OFFSET (GstAppSinkClass, try_pull_preroll), NULL, NULL, NULL,
370 GST_TYPE_SAMPLE, 1, GST_TYPE_CLOCK_TIME);
372 * GstAppSink::try-pull-sample:
373 * @appsink: the appsink element to emit this signal on
374 * @timeout: the maximum amount of time to wait for a sample
376 * This function blocks until a sample or EOS becomes available or the appsink
377 * element is set to the READY/NULL state or the timeout expires.
379 * This function will only return samples when the appsink is in the PLAYING
380 * state. All rendered samples will be put in a queue so that the application
381 * can pull samples at its own rate.
383 * Note that when the application does not pull samples fast enough, the
384 * queued samples could consume a lot of memory, especially when dealing with
385 * raw video frames. It's possible to control the behaviour of the queue with
386 * the "drop" and "max-buffers" properties.
388 * If an EOS event was received before any buffers or the timeout expires,
389 * this function returns %NULL. Use gst_app_sink_is_eos () to check
390 * for the EOS condition.
392 * Returns: a #GstSample or NULL when the appsink is stopped or EOS or the timeout expires.
396 gst_app_sink_signals[SIGNAL_TRY_PULL_SAMPLE] =
397 g_signal_new ("try-pull-sample", G_TYPE_FROM_CLASS (klass),
398 G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
399 G_STRUCT_OFFSET (GstAppSinkClass, try_pull_sample), NULL, NULL, NULL,
400 GST_TYPE_SAMPLE, 1, GST_TYPE_CLOCK_TIME);
402 gst_element_class_set_static_metadata (element_class, "AppSink",
403 "Generic/Sink", "Allow the application to get access to raw buffer",
404 "David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>");
406 gst_element_class_add_static_pad_template (element_class,
407 &gst_app_sink_template);
409 basesink_class->unlock = gst_app_sink_unlock_start;
410 basesink_class->unlock_stop = gst_app_sink_unlock_stop;
411 basesink_class->start = gst_app_sink_start;
412 basesink_class->stop = gst_app_sink_stop;
413 basesink_class->event = gst_app_sink_event;
414 basesink_class->preroll = gst_app_sink_preroll;
415 basesink_class->render = gst_app_sink_render;
416 basesink_class->get_caps = gst_app_sink_getcaps;
417 basesink_class->set_caps = gst_app_sink_setcaps;
418 basesink_class->query = gst_app_sink_query;
420 klass->pull_preroll = gst_app_sink_pull_preroll;
421 klass->pull_sample = gst_app_sink_pull_sample;
422 klass->try_pull_preroll = gst_app_sink_try_pull_preroll;
423 klass->try_pull_sample = gst_app_sink_try_pull_sample;
425 g_type_class_add_private (klass, sizeof (GstAppSinkPrivate));
429 gst_app_sink_init (GstAppSink * appsink)
431 GstAppSinkPrivate *priv;
433 priv = appsink->priv =
434 G_TYPE_INSTANCE_GET_PRIVATE (appsink, GST_TYPE_APP_SINK,
437 g_mutex_init (&priv->mutex);
438 g_cond_init (&priv->cond);
439 priv->queue = g_queue_new ();
441 priv->emit_signals = DEFAULT_PROP_EMIT_SIGNALS;
442 priv->max_buffers = DEFAULT_PROP_MAX_BUFFERS;
443 priv->drop = DEFAULT_PROP_DROP;
444 priv->wait_on_eos = DEFAULT_PROP_WAIT_ON_EOS;
448 gst_app_sink_dispose (GObject * obj)
450 GstAppSink *appsink = GST_APP_SINK_CAST (obj);
451 GstAppSinkPrivate *priv = appsink->priv;
452 GstMiniObject *queue_obj;
454 GST_OBJECT_LOCK (appsink);
456 gst_caps_unref (priv->caps);
460 priv->notify (priv->user_data);
462 priv->user_data = NULL;
465 GST_OBJECT_UNLOCK (appsink);
467 g_mutex_lock (&priv->mutex);
468 while ((queue_obj = g_queue_pop_head (priv->queue)))
469 gst_mini_object_unref (queue_obj);
470 gst_buffer_replace (&priv->preroll, NULL);
471 gst_caps_replace (&priv->preroll_caps, NULL);
472 gst_caps_replace (&priv->last_caps, NULL);
473 g_mutex_unlock (&priv->mutex);
475 G_OBJECT_CLASS (parent_class)->dispose (obj);
479 gst_app_sink_finalize (GObject * obj)
481 GstAppSink *appsink = GST_APP_SINK_CAST (obj);
482 GstAppSinkPrivate *priv = appsink->priv;
484 g_mutex_clear (&priv->mutex);
485 g_cond_clear (&priv->cond);
486 g_queue_free (priv->queue);
488 G_OBJECT_CLASS (parent_class)->finalize (obj);
492 gst_app_sink_set_property (GObject * object, guint prop_id,
493 const GValue * value, GParamSpec * pspec)
495 GstAppSink *appsink = GST_APP_SINK_CAST (object);
499 gst_app_sink_set_caps (appsink, gst_value_get_caps (value));
501 case PROP_EMIT_SIGNALS:
502 gst_app_sink_set_emit_signals (appsink, g_value_get_boolean (value));
504 case PROP_MAX_BUFFERS:
505 gst_app_sink_set_max_buffers (appsink, g_value_get_uint (value));
508 gst_app_sink_set_drop (appsink, g_value_get_boolean (value));
510 case PROP_WAIT_ON_EOS:
511 gst_app_sink_set_wait_on_eos (appsink, g_value_get_boolean (value));
514 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
520 gst_app_sink_get_property (GObject * object, guint prop_id, GValue * value,
523 GstAppSink *appsink = GST_APP_SINK_CAST (object);
530 caps = gst_app_sink_get_caps (appsink);
531 gst_value_set_caps (value, caps);
533 gst_caps_unref (caps);
537 g_value_set_boolean (value, gst_app_sink_is_eos (appsink));
539 case PROP_EMIT_SIGNALS:
540 g_value_set_boolean (value, gst_app_sink_get_emit_signals (appsink));
542 case PROP_MAX_BUFFERS:
543 g_value_set_uint (value, gst_app_sink_get_max_buffers (appsink));
546 g_value_set_boolean (value, gst_app_sink_get_drop (appsink));
548 case PROP_WAIT_ON_EOS:
549 g_value_set_boolean (value, gst_app_sink_get_wait_on_eos (appsink));
552 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
558 gst_app_sink_unlock_start (GstBaseSink * bsink)
560 GstAppSink *appsink = GST_APP_SINK_CAST (bsink);
561 GstAppSinkPrivate *priv = appsink->priv;
563 g_mutex_lock (&priv->mutex);
564 GST_DEBUG_OBJECT (appsink, "unlock start");
566 g_cond_signal (&priv->cond);
567 g_mutex_unlock (&priv->mutex);
573 gst_app_sink_unlock_stop (GstBaseSink * bsink)
575 GstAppSink *appsink = GST_APP_SINK_CAST (bsink);
576 GstAppSinkPrivate *priv = appsink->priv;
578 g_mutex_lock (&priv->mutex);
579 GST_DEBUG_OBJECT (appsink, "unlock stop");
580 priv->unlock = FALSE;
581 g_cond_signal (&priv->cond);
582 g_mutex_unlock (&priv->mutex);
588 gst_app_sink_flush_unlocked (GstAppSink * appsink)
591 GstAppSinkPrivate *priv = appsink->priv;
593 GST_DEBUG_OBJECT (appsink, "flush stop appsink");
594 priv->is_eos = FALSE;
595 gst_buffer_replace (&priv->preroll, NULL);
596 while ((obj = g_queue_pop_head (priv->queue)))
597 gst_mini_object_unref (obj);
598 priv->num_buffers = 0;
599 g_cond_signal (&priv->cond);
603 gst_app_sink_start (GstBaseSink * psink)
605 GstAppSink *appsink = GST_APP_SINK_CAST (psink);
606 GstAppSinkPrivate *priv = appsink->priv;
608 g_mutex_lock (&priv->mutex);
609 GST_DEBUG_OBJECT (appsink, "starting");
610 priv->flushing = FALSE;
611 priv->started = TRUE;
612 gst_segment_init (&priv->preroll_segment, GST_FORMAT_TIME);
613 gst_segment_init (&priv->last_segment, GST_FORMAT_TIME);
614 g_mutex_unlock (&priv->mutex);
620 gst_app_sink_stop (GstBaseSink * psink)
622 GstAppSink *appsink = GST_APP_SINK_CAST (psink);
623 GstAppSinkPrivate *priv = appsink->priv;
625 g_mutex_lock (&priv->mutex);
626 GST_DEBUG_OBJECT (appsink, "stopping");
627 priv->flushing = TRUE;
628 priv->started = FALSE;
629 gst_app_sink_flush_unlocked (appsink);
630 gst_buffer_replace (&priv->preroll, NULL);
631 gst_caps_replace (&priv->preroll_caps, NULL);
632 gst_caps_replace (&priv->last_caps, NULL);
633 gst_segment_init (&priv->preroll_segment, GST_FORMAT_UNDEFINED);
634 gst_segment_init (&priv->last_segment, GST_FORMAT_UNDEFINED);
635 g_mutex_unlock (&priv->mutex);
641 gst_app_sink_setcaps (GstBaseSink * sink, GstCaps * caps)
643 GstAppSink *appsink = GST_APP_SINK_CAST (sink);
644 GstAppSinkPrivate *priv = appsink->priv;
646 g_mutex_lock (&priv->mutex);
647 GST_DEBUG_OBJECT (appsink, "receiving CAPS");
648 g_queue_push_tail (priv->queue, gst_event_new_caps (caps));
650 gst_caps_replace (&priv->preroll_caps, caps);
651 g_mutex_unlock (&priv->mutex);
657 gst_app_sink_event (GstBaseSink * sink, GstEvent * event)
659 GstAppSink *appsink = GST_APP_SINK_CAST (sink);
660 GstAppSinkPrivate *priv = appsink->priv;
662 switch (event->type) {
663 case GST_EVENT_SEGMENT:
664 g_mutex_lock (&priv->mutex);
665 GST_DEBUG_OBJECT (appsink, "receiving SEGMENT");
666 g_queue_push_tail (priv->queue, gst_event_ref (event));
668 gst_event_copy_segment (event, &priv->preroll_segment);
669 g_mutex_unlock (&priv->mutex);
672 gboolean emit = TRUE;
674 g_mutex_lock (&priv->mutex);
675 GST_DEBUG_OBJECT (appsink, "receiving EOS");
677 g_cond_signal (&priv->cond);
678 g_mutex_unlock (&priv->mutex);
680 g_mutex_lock (&priv->mutex);
681 /* wait until all buffers are consumed or we're flushing.
682 * Otherwise we might signal EOS before all buffers are
683 * consumed, which is a bit confusing for the application
685 while (priv->num_buffers > 0 && !priv->flushing && priv->wait_on_eos)
686 g_cond_wait (&priv->cond, &priv->mutex);
689 g_mutex_unlock (&priv->mutex);
693 if (priv->callbacks.eos)
694 priv->callbacks.eos (appsink, priv->user_data);
696 g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_EOS], 0);
701 case GST_EVENT_FLUSH_START:
702 /* we don't have to do anything here, the base class will call unlock
703 * which will make sure we exit the _render method */
704 GST_DEBUG_OBJECT (appsink, "received FLUSH_START");
706 case GST_EVENT_FLUSH_STOP:
707 g_mutex_lock (&priv->mutex);
708 GST_DEBUG_OBJECT (appsink, "received FLUSH_STOP");
709 gst_app_sink_flush_unlocked (appsink);
710 g_mutex_unlock (&priv->mutex);
715 return GST_BASE_SINK_CLASS (parent_class)->event (sink, event);
719 gst_app_sink_preroll (GstBaseSink * psink, GstBuffer * buffer)
722 GstAppSink *appsink = GST_APP_SINK_CAST (psink);
723 GstAppSinkPrivate *priv = appsink->priv;
726 g_mutex_lock (&priv->mutex);
730 GST_DEBUG_OBJECT (appsink, "setting preroll buffer %p", buffer);
731 gst_buffer_replace (&priv->preroll, buffer);
733 g_cond_signal (&priv->cond);
734 emit = priv->emit_signals;
735 g_mutex_unlock (&priv->mutex);
737 if (priv->callbacks.new_preroll) {
738 res = priv->callbacks.new_preroll (appsink, priv->user_data);
742 g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_NEW_PREROLL], 0,
750 GST_DEBUG_OBJECT (appsink, "we are flushing");
751 g_mutex_unlock (&priv->mutex);
752 return GST_FLOW_FLUSHING;
757 dequeue_buffer (GstAppSink * appsink)
759 GstAppSinkPrivate *priv = appsink->priv;
765 obj = g_queue_pop_head (priv->queue);
767 if (GST_IS_BUFFER (obj)) {
768 buffer = GST_BUFFER_CAST (obj);
769 GST_DEBUG_OBJECT (appsink, "dequeued buffer %p", buffer);
772 } else if (GST_IS_EVENT (obj)) {
773 GstEvent *event = GST_EVENT_CAST (obj);
775 switch (GST_EVENT_TYPE (obj)) {
780 gst_event_parse_caps (event, &caps);
781 GST_DEBUG_OBJECT (appsink, "activating caps %" GST_PTR_FORMAT, caps);
782 gst_caps_replace (&priv->last_caps, caps);
785 case GST_EVENT_SEGMENT:
786 gst_event_copy_segment (event, &priv->last_segment);
787 GST_DEBUG_OBJECT (appsink, "activated segment %" GST_SEGMENT_FORMAT,
788 &priv->last_segment);
793 gst_mini_object_unref (obj);
801 gst_app_sink_render (GstBaseSink * psink, GstBuffer * buffer)
804 GstAppSink *appsink = GST_APP_SINK_CAST (psink);
805 GstAppSinkPrivate *priv = appsink->priv;
809 g_mutex_lock (&priv->mutex);
813 /* queue holding caps event might have been FLUSHed,
814 * but caps state still present in pad caps */
815 if (G_UNLIKELY (!priv->last_caps &&
816 gst_pad_has_current_caps (GST_BASE_SINK_PAD (psink)))) {
817 priv->last_caps = gst_pad_get_current_caps (GST_BASE_SINK_PAD (psink));
818 GST_DEBUG_OBJECT (appsink, "activating pad caps %" GST_PTR_FORMAT,
822 GST_DEBUG_OBJECT (appsink, "pushing render buffer %p on queue (%d)",
823 buffer, priv->num_buffers);
825 while (priv->max_buffers > 0 && priv->num_buffers >= priv->max_buffers) {
829 /* we need to drop the oldest buffer and try again */
830 if ((old = dequeue_buffer (appsink))) {
831 GST_DEBUG_OBJECT (appsink, "dropping old buffer %p", old);
832 gst_buffer_unref (old);
835 GST_DEBUG_OBJECT (appsink, "waiting for free space, length %d >= %d",
836 priv->num_buffers, priv->max_buffers);
839 /* we are asked to unlock, call the wait_preroll method */
840 g_mutex_unlock (&priv->mutex);
841 if ((ret = gst_base_sink_wait_preroll (psink)) != GST_FLOW_OK)
844 /* we are allowed to continue now */
848 /* wait for a buffer to be removed or flush */
849 g_cond_wait (&priv->cond, &priv->mutex);
854 /* we need to ref the buffer when pushing it in the queue */
855 g_queue_push_tail (priv->queue, gst_buffer_ref (buffer));
857 g_cond_signal (&priv->cond);
858 emit = priv->emit_signals;
859 g_mutex_unlock (&priv->mutex);
861 if (priv->callbacks.new_sample) {
862 ret = priv->callbacks.new_sample (appsink, priv->user_data);
866 g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_NEW_SAMPLE], 0, &ret);
872 GST_DEBUG_OBJECT (appsink, "we are flushing");
873 g_mutex_unlock (&priv->mutex);
874 return GST_FLOW_FLUSHING;
878 GST_DEBUG_OBJECT (appsink, "we are stopping");
884 gst_app_sink_getcaps (GstBaseSink * psink, GstCaps * filter)
887 GstAppSink *appsink = GST_APP_SINK_CAST (psink);
888 GstAppSinkPrivate *priv = appsink->priv;
890 GST_OBJECT_LOCK (appsink);
891 if ((caps = priv->caps)) {
893 caps = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
897 GST_DEBUG_OBJECT (appsink, "got caps %" GST_PTR_FORMAT, caps);
898 GST_OBJECT_UNLOCK (appsink);
904 gst_app_sink_query (GstBaseSink * bsink, GstQuery * query)
908 switch (GST_QUERY_TYPE (query)) {
909 case GST_QUERY_SEEKING:{
912 /* we don't supporting seeking */
913 gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
914 gst_query_set_seeking (query, fmt, FALSE, 0, -1);
920 ret = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
930 * gst_app_sink_set_caps:
931 * @appsink: a #GstAppSink
934 * Set the capabilities on the appsink element. This function takes
935 * a copy of the caps structure. After calling this method, the sink will only
936 * accept caps that match @caps. If @caps is non-fixed, or incomplete,
937 * you must check the caps on the samples to get the actual used caps.
940 gst_app_sink_set_caps (GstAppSink * appsink, const GstCaps * caps)
943 GstAppSinkPrivate *priv;
945 g_return_if_fail (GST_IS_APP_SINK (appsink));
947 priv = appsink->priv;
949 GST_OBJECT_LOCK (appsink);
950 GST_DEBUG_OBJECT (appsink, "setting caps to %" GST_PTR_FORMAT, caps);
951 if ((old = priv->caps) != caps) {
953 priv->caps = gst_caps_copy (caps);
957 gst_caps_unref (old);
959 GST_OBJECT_UNLOCK (appsink);
963 * gst_app_sink_get_caps:
964 * @appsink: a #GstAppSink
966 * Get the configured caps on @appsink.
968 * Returns: the #GstCaps accepted by the sink. gst_caps_unref() after usage.
971 gst_app_sink_get_caps (GstAppSink * appsink)
974 GstAppSinkPrivate *priv;
976 g_return_val_if_fail (GST_IS_APP_SINK (appsink), NULL);
978 priv = appsink->priv;
980 GST_OBJECT_LOCK (appsink);
981 if ((caps = priv->caps))
983 GST_DEBUG_OBJECT (appsink, "getting caps of %" GST_PTR_FORMAT, caps);
984 GST_OBJECT_UNLOCK (appsink);
990 * gst_app_sink_is_eos:
991 * @appsink: a #GstAppSink
993 * Check if @appsink is EOS, which is when no more samples can be pulled because
994 * an EOS event was received.
996 * This function also returns %TRUE when the appsink is not in the PAUSED or
999 * Returns: %TRUE if no more samples can be pulled and the appsink is EOS.
1002 gst_app_sink_is_eos (GstAppSink * appsink)
1005 GstAppSinkPrivate *priv;
1007 g_return_val_if_fail (GST_IS_APP_SINK (appsink), FALSE);
1009 priv = appsink->priv;
1011 g_mutex_lock (&priv->mutex);
1015 if (priv->is_eos && priv->num_buffers == 0) {
1016 GST_DEBUG_OBJECT (appsink, "we are EOS and the queue is empty");
1019 GST_DEBUG_OBJECT (appsink, "we are not yet EOS");
1022 g_mutex_unlock (&priv->mutex);
1028 GST_DEBUG_OBJECT (appsink, "we are stopped, return TRUE");
1029 g_mutex_unlock (&priv->mutex);
1035 * gst_app_sink_set_emit_signals:
1036 * @appsink: a #GstAppSink
1037 * @emit: the new state
1039 * Make appsink emit the "new-preroll" and "new-sample" signals. This option is
1040 * by default disabled because signal emission is expensive and unneeded when
1041 * the application prefers to operate in pull mode.
1044 gst_app_sink_set_emit_signals (GstAppSink * appsink, gboolean emit)
1046 GstAppSinkPrivate *priv;
1048 g_return_if_fail (GST_IS_APP_SINK (appsink));
1050 priv = appsink->priv;
1052 g_mutex_lock (&priv->mutex);
1053 priv->emit_signals = emit;
1054 g_mutex_unlock (&priv->mutex);
1058 * gst_app_sink_get_emit_signals:
1059 * @appsink: a #GstAppSink
1061 * Check if appsink will emit the "new-preroll" and "new-sample" signals.
1063 * Returns: %TRUE if @appsink is emiting the "new-preroll" and "new-sample"
1067 gst_app_sink_get_emit_signals (GstAppSink * appsink)
1070 GstAppSinkPrivate *priv;
1072 g_return_val_if_fail (GST_IS_APP_SINK (appsink), FALSE);
1074 priv = appsink->priv;
1076 g_mutex_lock (&priv->mutex);
1077 result = priv->emit_signals;
1078 g_mutex_unlock (&priv->mutex);
1084 * gst_app_sink_set_max_buffers:
1085 * @appsink: a #GstAppSink
1086 * @max: the maximum number of buffers to queue
1088 * Set the maximum amount of buffers that can be queued in @appsink. After this
1089 * amount of buffers are queued in appsink, any more buffers will block upstream
1090 * elements until a sample is pulled from @appsink.
1093 gst_app_sink_set_max_buffers (GstAppSink * appsink, guint max)
1095 GstAppSinkPrivate *priv;
1097 g_return_if_fail (GST_IS_APP_SINK (appsink));
1099 priv = appsink->priv;
1101 g_mutex_lock (&priv->mutex);
1102 if (max != priv->max_buffers) {
1103 priv->max_buffers = max;
1104 /* signal the change */
1105 g_cond_signal (&priv->cond);
1107 g_mutex_unlock (&priv->mutex);
1111 * gst_app_sink_get_max_buffers:
1112 * @appsink: a #GstAppSink
1114 * Get the maximum amount of buffers that can be queued in @appsink.
1116 * Returns: The maximum amount of buffers that can be queued.
1119 gst_app_sink_get_max_buffers (GstAppSink * appsink)
1122 GstAppSinkPrivate *priv;
1124 g_return_val_if_fail (GST_IS_APP_SINK (appsink), 0);
1126 priv = appsink->priv;
1128 g_mutex_lock (&priv->mutex);
1129 result = priv->max_buffers;
1130 g_mutex_unlock (&priv->mutex);
1136 * gst_app_sink_set_drop:
1137 * @appsink: a #GstAppSink
1138 * @drop: the new state
1140 * Instruct @appsink to drop old buffers when the maximum amount of queued
1141 * buffers is reached.
1144 gst_app_sink_set_drop (GstAppSink * appsink, gboolean drop)
1146 GstAppSinkPrivate *priv;
1148 g_return_if_fail (GST_IS_APP_SINK (appsink));
1150 priv = appsink->priv;
1152 g_mutex_lock (&priv->mutex);
1153 if (priv->drop != drop) {
1155 /* signal the change */
1156 g_cond_signal (&priv->cond);
1158 g_mutex_unlock (&priv->mutex);
1162 * gst_app_sink_get_drop:
1163 * @appsink: a #GstAppSink
1165 * Check if @appsink will drop old buffers when the maximum amount of queued
1166 * buffers is reached.
1168 * Returns: %TRUE if @appsink is dropping old buffers when the queue is
1172 gst_app_sink_get_drop (GstAppSink * appsink)
1175 GstAppSinkPrivate *priv;
1177 g_return_val_if_fail (GST_IS_APP_SINK (appsink), FALSE);
1179 priv = appsink->priv;
1181 g_mutex_lock (&priv->mutex);
1182 result = priv->drop;
1183 g_mutex_unlock (&priv->mutex);
1189 * gst_app_sink_set_wait_on_eos:
1190 * @appsink: a #GstAppSink
1191 * @wait: the new state
1193 * Instruct @appsink to wait for all buffers to be consumed when an EOS is received.
1197 gst_app_sink_set_wait_on_eos (GstAppSink * appsink, gboolean wait)
1199 GstAppSinkPrivate *priv;
1201 g_return_if_fail (GST_IS_APP_SINK (appsink));
1203 priv = appsink->priv;
1205 g_mutex_lock (&priv->mutex);
1206 if (priv->wait_on_eos != wait) {
1207 priv->wait_on_eos = wait;
1208 /* signal the change */
1209 g_cond_signal (&priv->cond);
1211 g_mutex_unlock (&priv->mutex);
1215 * gst_app_sink_get_wait_on_eos:
1216 * @appsink: a #GstAppSink
1218 * Check if @appsink will wait for all buffers to be consumed when an EOS is
1221 * Returns: %TRUE if @appsink will wait for all buffers to be consumed when an
1225 gst_app_sink_get_wait_on_eos (GstAppSink * appsink)
1228 GstAppSinkPrivate *priv;
1230 g_return_val_if_fail (GST_IS_APP_SINK (appsink), FALSE);
1232 priv = appsink->priv;
1234 g_mutex_lock (&priv->mutex);
1235 result = priv->wait_on_eos;
1236 g_mutex_unlock (&priv->mutex);
1242 * gst_app_sink_pull_preroll:
1243 * @appsink: a #GstAppSink
1245 * Get the last preroll sample in @appsink. This was the sample that caused the
1246 * appsink to preroll in the PAUSED state. This sample can be pulled many times
1247 * and remains available to the application even after EOS.
1249 * This function is typically used when dealing with a pipeline in the PAUSED
1250 * state. Calling this function after doing a seek will give the sample right
1251 * after the seek position.
1253 * Note that the preroll sample will also be returned as the first sample
1254 * when calling gst_app_sink_pull_sample().
1256 * If an EOS event was received before any buffers, this function returns
1257 * %NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
1259 * This function blocks until a preroll sample or EOS is received or the appsink
1260 * element is set to the READY/NULL state.
1262 * Returns: (transfer full): a #GstSample or NULL when the appsink is stopped or EOS.
1263 * Call gst_sample_unref() after usage.
1266 gst_app_sink_pull_preroll (GstAppSink * appsink)
1268 return gst_app_sink_try_pull_preroll (appsink, GST_CLOCK_TIME_NONE);
1272 * gst_app_sink_pull_sample:
1273 * @appsink: a #GstAppSink
1275 * This function blocks until a sample or EOS becomes available or the appsink
1276 * element is set to the READY/NULL state.
1278 * This function will only return samples when the appsink is in the PLAYING
1279 * state. All rendered buffers will be put in a queue so that the application
1280 * can pull samples at its own rate. Note that when the application does not
1281 * pull samples fast enough, the queued buffers could consume a lot of memory,
1282 * especially when dealing with raw video frames.
1284 * If an EOS event was received before any buffers, this function returns
1285 * %NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
1287 * Returns: (transfer full): a #GstSample or NULL when the appsink is stopped or EOS.
1288 * Call gst_sample_unref() after usage.
1291 gst_app_sink_pull_sample (GstAppSink * appsink)
1293 return gst_app_sink_try_pull_sample (appsink, GST_CLOCK_TIME_NONE);
1297 * gst_app_sink_try_pull_preroll:
1298 * @appsink: a #GstAppSink
1299 * @timeout: the maximum amount of time to wait for the preroll sample
1301 * Get the last preroll sample in @appsink. This was the sample that caused the
1302 * appsink to preroll in the PAUSED state. This sample can be pulled many times
1303 * and remains available to the application even after EOS.
1305 * This function is typically used when dealing with a pipeline in the PAUSED
1306 * state. Calling this function after doing a seek will give the sample right
1307 * after the seek position.
1309 * Note that the preroll sample will also be returned as the first sample
1310 * when calling gst_app_sink_pull_sample().
1312 * If an EOS event was received before any buffers or the timeout expires,
1313 * this function returns %NULL. Use gst_app_sink_is_eos () to check for the EOS
1316 * This function blocks until a preroll sample or EOS is received, the appsink
1317 * element is set to the READY/NULL state, or the timeout expires.
1319 * Returns: (transfer full): a #GstSample or NULL when the appsink is stopped or EOS or the timeout expires.
1320 * Call gst_sample_unref() after usage.
1325 gst_app_sink_try_pull_preroll (GstAppSink * appsink, GstClockTime timeout)
1327 GstAppSinkPrivate *priv;
1328 GstSample *sample = NULL;
1329 gboolean timeout_valid;
1332 g_return_val_if_fail (GST_IS_APP_SINK (appsink), NULL);
1334 priv = appsink->priv;
1336 timeout_valid = GST_CLOCK_TIME_IS_VALID (timeout);
1340 g_get_monotonic_time () + timeout / (GST_SECOND / G_TIME_SPAN_SECOND);
1342 g_mutex_lock (&priv->mutex);
1345 GST_DEBUG_OBJECT (appsink, "trying to grab a buffer");
1349 if (priv->preroll != NULL)
1355 /* nothing to return, wait */
1356 GST_DEBUG_OBJECT (appsink, "waiting for the preroll buffer");
1357 if (timeout_valid) {
1358 if (!g_cond_wait_until (&priv->cond, &priv->mutex, end_time))
1361 g_cond_wait (&priv->cond, &priv->mutex);
1365 gst_sample_new (priv->preroll, priv->preroll_caps, &priv->preroll_segment,
1367 GST_DEBUG_OBJECT (appsink, "we have the preroll sample %p", sample);
1368 g_mutex_unlock (&priv->mutex);
1372 /* special conditions */
1375 GST_DEBUG_OBJECT (appsink, "timeout expired, return NULL");
1376 g_mutex_unlock (&priv->mutex);
1381 GST_DEBUG_OBJECT (appsink, "we are EOS, return NULL");
1382 g_mutex_unlock (&priv->mutex);
1387 GST_DEBUG_OBJECT (appsink, "we are stopped, return NULL");
1388 g_mutex_unlock (&priv->mutex);
1394 * gst_app_sink_try_pull_sample:
1395 * @appsink: a #GstAppSink
1396 * @timeout: the maximum amount of time to wait for a sample
1398 * This function blocks until a sample or EOS becomes available or the appsink
1399 * element is set to the READY/NULL state or the timeout expires.
1401 * This function will only return samples when the appsink is in the PLAYING
1402 * state. All rendered buffers will be put in a queue so that the application
1403 * can pull samples at its own rate. Note that when the application does not
1404 * pull samples fast enough, the queued buffers could consume a lot of memory,
1405 * especially when dealing with raw video frames.
1407 * If an EOS event was received before any buffers or the timeout expires,
1408 * this function returns %NULL. Use gst_app_sink_is_eos () to check for the EOS
1411 * Returns: (transfer full): a #GstSample or NULL when the appsink is stopped or EOS or the timeout expires.
1412 * Call gst_sample_unref() after usage.
1417 gst_app_sink_try_pull_sample (GstAppSink * appsink, GstClockTime timeout)
1419 GstAppSinkPrivate *priv;
1420 GstSample *sample = NULL;
1422 gboolean timeout_valid;
1425 g_return_val_if_fail (GST_IS_APP_SINK (appsink), NULL);
1427 timeout_valid = GST_CLOCK_TIME_IS_VALID (timeout);
1431 g_get_monotonic_time () + timeout / (GST_SECOND / G_TIME_SPAN_SECOND);
1433 priv = appsink->priv;
1435 g_mutex_lock (&priv->mutex);
1438 GST_DEBUG_OBJECT (appsink, "trying to grab a buffer");
1442 if (priv->num_buffers > 0)
1448 /* nothing to return, wait */
1449 GST_DEBUG_OBJECT (appsink, "waiting for a buffer");
1450 if (timeout_valid) {
1451 if (!g_cond_wait_until (&priv->cond, &priv->mutex, end_time))
1454 g_cond_wait (&priv->cond, &priv->mutex);
1457 buffer = dequeue_buffer (appsink);
1458 GST_DEBUG_OBJECT (appsink, "we have a buffer %p", buffer);
1459 sample = gst_sample_new (buffer, priv->last_caps, &priv->last_segment, NULL);
1460 gst_buffer_unref (buffer);
1462 g_cond_signal (&priv->cond);
1463 g_mutex_unlock (&priv->mutex);
1467 /* special conditions */
1470 GST_DEBUG_OBJECT (appsink, "timeout expired, return NULL");
1471 g_mutex_unlock (&priv->mutex);
1476 GST_DEBUG_OBJECT (appsink, "we are EOS, return NULL");
1477 g_mutex_unlock (&priv->mutex);
1482 GST_DEBUG_OBJECT (appsink, "we are stopped, return NULL");
1483 g_mutex_unlock (&priv->mutex);
1489 * gst_app_sink_set_callbacks: (skip)
1490 * @appsink: a #GstAppSink
1491 * @callbacks: the callbacks
1492 * @user_data: a user_data argument for the callbacks
1493 * @notify: a destroy notify function
1495 * Set callbacks which will be executed for each new preroll, new sample and eos.
1496 * This is an alternative to using the signals, it has lower overhead and is thus
1497 * less expensive, but also less flexible.
1499 * If callbacks are installed, no signals will be emitted for performance
1503 gst_app_sink_set_callbacks (GstAppSink * appsink,
1504 GstAppSinkCallbacks * callbacks, gpointer user_data, GDestroyNotify notify)
1506 GDestroyNotify old_notify;
1507 GstAppSinkPrivate *priv;
1509 g_return_if_fail (GST_IS_APP_SINK (appsink));
1510 g_return_if_fail (callbacks != NULL);
1512 priv = appsink->priv;
1514 GST_OBJECT_LOCK (appsink);
1515 old_notify = priv->notify;
1520 old_data = priv->user_data;
1522 priv->user_data = NULL;
1523 priv->notify = NULL;
1524 GST_OBJECT_UNLOCK (appsink);
1526 old_notify (old_data);
1528 GST_OBJECT_LOCK (appsink);
1530 priv->callbacks = *callbacks;
1531 priv->user_data = user_data;
1532 priv->notify = notify;
1533 GST_OBJECT_UNLOCK (appsink);
1536 /*** GSTURIHANDLER INTERFACE *************************************************/
1539 gst_app_sink_uri_get_type (GType type)
1541 return GST_URI_SINK;
1544 static const gchar *const *
1545 gst_app_sink_uri_get_protocols (GType type)
1547 static const gchar *protocols[] = { "appsink", NULL };
1553 gst_app_sink_uri_get_uri (GstURIHandler * handler)
1555 return g_strdup ("appsink");
1559 gst_app_sink_uri_set_uri (GstURIHandler * handler, const gchar * uri,
1562 /* GstURIHandler checks the protocol for us */
1567 gst_app_sink_uri_handler_init (gpointer g_iface, gpointer iface_data)
1569 GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
1571 iface->get_type = gst_app_sink_uri_get_type;
1572 iface->get_protocols = gst_app_sink_uri_get_protocols;
1573 iface->get_uri = gst_app_sink_uri_get_uri;
1574 iface->set_uri = gst_app_sink_uri_set_uri;