2007-03-11 00:48:26 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2007 David Schleef <ds@schleef.org>
|
gst-libs/gst/app/: Add marshal.list, make it compile and add to cvsignore.
Original commit message from CVS:
* gst-libs/gst/app/.cvsignore:
* gst-libs/gst/app/Makefile.am:
* gst-libs/gst/app/gstapp-marshal.list:
Add marshal.list, make it compile and add to cvsignore.
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_dispose),
(gst_app_sink_stop):
Small cleanups.
* gst-libs/gst/app/gstappsrc.c: (gst_app_src_class_init),
(gst_app_src_init), (gst_app_src_set_property),
(gst_app_src_get_property), (gst_app_src_unlock),
(gst_app_src_unlock_stop), (gst_app_src_start), (gst_app_src_stop),
(gst_app_src_create), (gst_app_src_set_caps),
(gst_app_src_get_caps), (gst_app_src_set_size),
(gst_app_src_get_size), (gst_app_src_set_seekable),
(gst_app_src_get_seekable), (gst_app_src_set_max_buffers),
(gst_app_src_get_max_buffers), (gst_app_src_push_buffer),
(gst_app_src_end_of_stream):
* gst-libs/gst/app/gstappsrc.h:
Beat appsrc in shape, add signals and actions.
Add some docs.
Add properties for caps, size, seekability and max-buffers.
Fix unlock/stop code.
2008-05-07 10:38:23 +00:00
|
|
|
* (C) 2008 Wim Taymans <wim.taymans@gmail.com>
|
2007-03-11 00:48:26 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 23:05:09 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2007-03-11 00:48:26 +00:00
|
|
|
*/
|
2009-01-05 23:04:57 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstappsink
|
2017-01-23 19:36:11 +00:00
|
|
|
* @title: GstAppSink
|
2011-12-01 15:48:49 +00:00
|
|
|
* @short_description: Easy way for applications to extract samples from a
|
2009-12-12 18:16:39 +00:00
|
|
|
* pipeline
|
2011-12-01 15:48:49 +00:00
|
|
|
* @see_also: #GstSample, #GstBaseSink, appsrc
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
*
|
|
|
|
* Appsink is a sink plugin that supports many different methods for making
|
2009-01-05 23:04:57 +00:00
|
|
|
* the application get a handle on the GStreamer data in a pipeline. Unlike
|
|
|
|
* most GStreamer elements, Appsink provides external API functions.
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
*
|
2008-12-17 13:51:46 +00:00
|
|
|
* appsink can be used by linking to the gstappsink.h header file to access the
|
|
|
|
* methods or by using the appsink action signals and properties.
|
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* The normal way of retrieving samples from appsink is by using the
|
|
|
|
* gst_app_sink_pull_sample() and gst_app_sink_pull_preroll() methods.
|
|
|
|
* These methods block until a sample becomes available in the sink or when the
|
2016-07-15 11:20:29 +00:00
|
|
|
* sink is shut down or reaches EOS. There are also timed variants of these
|
|
|
|
* methods, gst_app_sink_try_pull_sample() and gst_app_sink_try_pull_preroll(),
|
|
|
|
* which accept a timeout parameter to limit the amount of time to wait.
|
2008-12-17 13:51:46 +00:00
|
|
|
*
|
|
|
|
* Appsink will internally use a queue to collect buffers from the streaming
|
2011-12-01 15:48:49 +00:00
|
|
|
* thread. If the application is not pulling samples fast enough, this queue
|
2008-12-17 13:51:46 +00:00
|
|
|
* will consume a lot of memory over time. The "max-buffers" property can be
|
|
|
|
* used to limit the queue size. The "drop" property controls whether the
|
|
|
|
* streaming thread blocks or if older buffers are dropped when the maximum
|
|
|
|
* queue size is reached. Note that blocking the streaming thread can negatively
|
|
|
|
* affect real-time performance and should be avoided.
|
|
|
|
*
|
|
|
|
* If a blocking behaviour is not desirable, setting the "emit-signals" property
|
2011-12-01 15:48:49 +00:00
|
|
|
* to %TRUE will make appsink emit the "new-sample" and "new-preroll" signals
|
|
|
|
* when a sample can be pulled without blocking.
|
2008-12-17 13:51:46 +00:00
|
|
|
*
|
|
|
|
* The "caps" property on appsink can be used to control the formats that
|
|
|
|
* appsink can receive. This property can contain non-fixed caps, the format of
|
2011-12-01 15:48:49 +00:00
|
|
|
* the pulled samples can be obtained by getting the sample caps.
|
2008-12-17 13:51:46 +00:00
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* If one of the pull-preroll or pull-sample methods return %NULL, the appsink
|
2008-12-17 13:51:46 +00:00
|
|
|
* is stopped or in the EOS state. You can check for the EOS state with the
|
|
|
|
* "eos" property or with the gst_app_sink_is_eos() method.
|
|
|
|
*
|
|
|
|
* The eos signal can also be used to be informed when the EOS state is reached
|
|
|
|
* to avoid polling.
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
*/
|
|
|
|
|
2007-03-11 00:48:26 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2018-01-31 20:11:41 +00:00
|
|
|
#include <gst/base/base.h>
|
2007-03-11 00:48:26 +00:00
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "gstappsink.h"
|
|
|
|
|
2018-01-31 20:19:47 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
2018-05-02 15:11:58 +00:00
|
|
|
NOONE_WAITING = 0,
|
|
|
|
STREAM_WAITING = 1 << 0, /* streaming thread is waiting for application thread */
|
|
|
|
APP_WAITING = 1 << 1, /* application thread is waiting for streaming thread */
|
2018-01-31 20:19:47 +00:00
|
|
|
} GstAppSinkWaitStatus;
|
|
|
|
|
2020-02-12 11:11:43 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstAppSinkCallbacks callbacks;
|
|
|
|
gpointer user_data;
|
|
|
|
GDestroyNotify destroy_notify;
|
|
|
|
gint ref_count;
|
|
|
|
} Callbacks;
|
|
|
|
|
|
|
|
static Callbacks *
|
|
|
|
callbacks_ref (Callbacks * callbacks)
|
|
|
|
{
|
|
|
|
g_atomic_int_inc (&callbacks->ref_count);
|
|
|
|
|
|
|
|
return callbacks;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
callbacks_unref (Callbacks * callbacks)
|
|
|
|
{
|
|
|
|
if (!g_atomic_int_dec_and_test (&callbacks->ref_count))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (callbacks->destroy_notify)
|
|
|
|
callbacks->destroy_notify (callbacks->user_data);
|
|
|
|
|
|
|
|
g_free (callbacks);
|
|
|
|
}
|
|
|
|
|
gst-libs/gst/app/: Move private data into a private instance struct. Add padding to instance and class structures exp...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (_GstAppSinkPrivate),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_unlock_start), (gst_app_sink_unlock_stop),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_set_emit_signals),
(gst_app_sink_get_emit_signals), (gst_app_sink_set_max_buffers),
(gst_app_sink_get_max_buffers), (gst_app_sink_set_drop),
(gst_app_sink_get_drop), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer)::
* gst-libs/gst/app/gstappsink.h: (GstAppSinkPrivate), (_GstAppSink)::
* gst-libs/gst/app/gstappsrc.c: (_GstAppSrcPrivate),
(gst_app_src_class_init), (gst_app_src_init),
(gst_app_src_flush_queued), (gst_app_src_dispose),
(gst_app_src_finalize), (gst_app_src_set_property),
(gst_app_src_get_property), (gst_app_src_unlock),
(gst_app_src_unlock_stop), (gst_app_src_start), (gst_app_src_stop),
(gst_app_src_is_seekable), (gst_app_src_check_get_range),
(gst_app_src_query), (gst_app_src_do_seek), (gst_app_src_create),
(gst_app_src_set_caps), (gst_app_src_get_caps),
(gst_app_src_set_size), (gst_app_src_get_size),
(gst_app_src_set_stream_type), (gst_app_src_get_stream_type),
(gst_app_src_set_max_bytes), (gst_app_src_get_max_bytes),
(gst_app_src_set_latencies), (gst_app_src_set_latency),
(gst_app_src_get_latency), (gst_app_src_push_buffer_full),
(gst_app_src_push_buffer_action), (gst_app_src_end_of_stream)::
* gst-libs/gst/app/gstappsrc.h: (GstAppSrcPrivate)::
Move private data into a private instance struct. Add padding to
instance and class structures exposed in public headers. Add
Since markers to the gtk-doc blurbs (#566750).
2009-01-06 10:56:45 +00:00
|
|
|
struct _GstAppSinkPrivate
|
|
|
|
{
|
|
|
|
GstCaps *caps;
|
|
|
|
gboolean emit_signals;
|
2011-12-01 15:48:49 +00:00
|
|
|
guint num_buffers;
|
2021-02-19 12:32:48 +00:00
|
|
|
guint num_events;
|
gst-libs/gst/app/: Move private data into a private instance struct. Add padding to instance and class structures exp...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (_GstAppSinkPrivate),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_unlock_start), (gst_app_sink_unlock_stop),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_set_emit_signals),
(gst_app_sink_get_emit_signals), (gst_app_sink_set_max_buffers),
(gst_app_sink_get_max_buffers), (gst_app_sink_set_drop),
(gst_app_sink_get_drop), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer)::
* gst-libs/gst/app/gstappsink.h: (GstAppSinkPrivate), (_GstAppSink)::
* gst-libs/gst/app/gstappsrc.c: (_GstAppSrcPrivate),
(gst_app_src_class_init), (gst_app_src_init),
(gst_app_src_flush_queued), (gst_app_src_dispose),
(gst_app_src_finalize), (gst_app_src_set_property),
(gst_app_src_get_property), (gst_app_src_unlock),
(gst_app_src_unlock_stop), (gst_app_src_start), (gst_app_src_stop),
(gst_app_src_is_seekable), (gst_app_src_check_get_range),
(gst_app_src_query), (gst_app_src_do_seek), (gst_app_src_create),
(gst_app_src_set_caps), (gst_app_src_get_caps),
(gst_app_src_set_size), (gst_app_src_get_size),
(gst_app_src_set_stream_type), (gst_app_src_get_stream_type),
(gst_app_src_set_max_bytes), (gst_app_src_get_max_bytes),
(gst_app_src_set_latencies), (gst_app_src_set_latency),
(gst_app_src_get_latency), (gst_app_src_push_buffer_full),
(gst_app_src_push_buffer_action), (gst_app_src_end_of_stream)::
* gst-libs/gst/app/gstappsrc.h: (GstAppSrcPrivate)::
Move private data into a private instance struct. Add padding to
instance and class structures exposed in public headers. Add
Since markers to the gtk-doc blurbs (#566750).
2009-01-06 10:56:45 +00:00
|
|
|
guint max_buffers;
|
|
|
|
gboolean drop;
|
2015-10-15 14:38:16 +00:00
|
|
|
gboolean wait_on_eos;
|
2018-01-31 20:19:47 +00:00
|
|
|
GstAppSinkWaitStatus wait_status;
|
gst-libs/gst/app/: Move private data into a private instance struct. Add padding to instance and class structures exp...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (_GstAppSinkPrivate),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_unlock_start), (gst_app_sink_unlock_stop),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_set_emit_signals),
(gst_app_sink_get_emit_signals), (gst_app_sink_set_max_buffers),
(gst_app_sink_get_max_buffers), (gst_app_sink_set_drop),
(gst_app_sink_get_drop), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer)::
* gst-libs/gst/app/gstappsink.h: (GstAppSinkPrivate), (_GstAppSink)::
* gst-libs/gst/app/gstappsrc.c: (_GstAppSrcPrivate),
(gst_app_src_class_init), (gst_app_src_init),
(gst_app_src_flush_queued), (gst_app_src_dispose),
(gst_app_src_finalize), (gst_app_src_set_property),
(gst_app_src_get_property), (gst_app_src_unlock),
(gst_app_src_unlock_stop), (gst_app_src_start), (gst_app_src_stop),
(gst_app_src_is_seekable), (gst_app_src_check_get_range),
(gst_app_src_query), (gst_app_src_do_seek), (gst_app_src_create),
(gst_app_src_set_caps), (gst_app_src_get_caps),
(gst_app_src_set_size), (gst_app_src_get_size),
(gst_app_src_set_stream_type), (gst_app_src_get_stream_type),
(gst_app_src_set_max_bytes), (gst_app_src_get_max_bytes),
(gst_app_src_set_latencies), (gst_app_src_set_latency),
(gst_app_src_get_latency), (gst_app_src_push_buffer_full),
(gst_app_src_push_buffer_action), (gst_app_src_end_of_stream)::
* gst-libs/gst/app/gstappsrc.h: (GstAppSrcPrivate)::
Move private data into a private instance struct. Add padding to
instance and class structures exposed in public headers. Add
Since markers to the gtk-doc blurbs (#566750).
2009-01-06 10:56:45 +00:00
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
GCond cond;
|
|
|
|
GMutex mutex;
|
2018-01-31 20:11:41 +00:00
|
|
|
GstQueueArray *queue;
|
2017-09-13 13:06:43 +00:00
|
|
|
GstBuffer *preroll_buffer;
|
2011-12-01 15:48:49 +00:00
|
|
|
GstCaps *preroll_caps;
|
|
|
|
GstCaps *last_caps;
|
2015-06-18 10:30:24 +00:00
|
|
|
GstSegment preroll_segment;
|
2011-12-01 15:48:49 +00:00
|
|
|
GstSegment last_segment;
|
gst-libs/gst/app/: Move private data into a private instance struct. Add padding to instance and class structures exp...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (_GstAppSinkPrivate),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_unlock_start), (gst_app_sink_unlock_stop),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_set_emit_signals),
(gst_app_sink_get_emit_signals), (gst_app_sink_set_max_buffers),
(gst_app_sink_get_max_buffers), (gst_app_sink_set_drop),
(gst_app_sink_get_drop), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer)::
* gst-libs/gst/app/gstappsink.h: (GstAppSinkPrivate), (_GstAppSink)::
* gst-libs/gst/app/gstappsrc.c: (_GstAppSrcPrivate),
(gst_app_src_class_init), (gst_app_src_init),
(gst_app_src_flush_queued), (gst_app_src_dispose),
(gst_app_src_finalize), (gst_app_src_set_property),
(gst_app_src_get_property), (gst_app_src_unlock),
(gst_app_src_unlock_stop), (gst_app_src_start), (gst_app_src_stop),
(gst_app_src_is_seekable), (gst_app_src_check_get_range),
(gst_app_src_query), (gst_app_src_do_seek), (gst_app_src_create),
(gst_app_src_set_caps), (gst_app_src_get_caps),
(gst_app_src_set_size), (gst_app_src_get_size),
(gst_app_src_set_stream_type), (gst_app_src_get_stream_type),
(gst_app_src_set_max_bytes), (gst_app_src_get_max_bytes),
(gst_app_src_set_latencies), (gst_app_src_set_latency),
(gst_app_src_get_latency), (gst_app_src_push_buffer_full),
(gst_app_src_push_buffer_action), (gst_app_src_end_of_stream)::
* gst-libs/gst/app/gstappsrc.h: (GstAppSrcPrivate)::
Move private data into a private instance struct. Add padding to
instance and class structures exposed in public headers. Add
Since markers to the gtk-doc blurbs (#566750).
2009-01-06 10:56:45 +00:00
|
|
|
gboolean flushing;
|
2009-08-24 11:15:06 +00:00
|
|
|
gboolean unlock;
|
gst-libs/gst/app/: Move private data into a private instance struct. Add padding to instance and class structures exp...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (_GstAppSinkPrivate),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_unlock_start), (gst_app_sink_unlock_stop),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_set_emit_signals),
(gst_app_sink_get_emit_signals), (gst_app_sink_set_max_buffers),
(gst_app_sink_get_max_buffers), (gst_app_sink_set_drop),
(gst_app_sink_get_drop), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer)::
* gst-libs/gst/app/gstappsink.h: (GstAppSinkPrivate), (_GstAppSink)::
* gst-libs/gst/app/gstappsrc.c: (_GstAppSrcPrivate),
(gst_app_src_class_init), (gst_app_src_init),
(gst_app_src_flush_queued), (gst_app_src_dispose),
(gst_app_src_finalize), (gst_app_src_set_property),
(gst_app_src_get_property), (gst_app_src_unlock),
(gst_app_src_unlock_stop), (gst_app_src_start), (gst_app_src_stop),
(gst_app_src_is_seekable), (gst_app_src_check_get_range),
(gst_app_src_query), (gst_app_src_do_seek), (gst_app_src_create),
(gst_app_src_set_caps), (gst_app_src_get_caps),
(gst_app_src_set_size), (gst_app_src_get_size),
(gst_app_src_set_stream_type), (gst_app_src_get_stream_type),
(gst_app_src_set_max_bytes), (gst_app_src_get_max_bytes),
(gst_app_src_set_latencies), (gst_app_src_set_latency),
(gst_app_src_get_latency), (gst_app_src_push_buffer_full),
(gst_app_src_push_buffer_action), (gst_app_src_end_of_stream)::
* gst-libs/gst/app/gstappsrc.h: (GstAppSrcPrivate)::
Move private data into a private instance struct. Add padding to
instance and class structures exposed in public headers. Add
Since markers to the gtk-doc blurbs (#566750).
2009-01-06 10:56:45 +00:00
|
|
|
gboolean started;
|
|
|
|
gboolean is_eos;
|
2016-07-04 07:32:28 +00:00
|
|
|
gboolean buffer_lists_supported;
|
2009-02-19 09:44:31 +00:00
|
|
|
|
2020-02-12 11:11:43 +00:00
|
|
|
Callbacks *callbacks;
|
2018-04-10 22:57:43 +00:00
|
|
|
|
|
|
|
GstSample *sample;
|
gst-libs/gst/app/: Move private data into a private instance struct. Add padding to instance and class structures exp...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (_GstAppSinkPrivate),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_unlock_start), (gst_app_sink_unlock_stop),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_set_emit_signals),
(gst_app_sink_get_emit_signals), (gst_app_sink_set_max_buffers),
(gst_app_sink_get_max_buffers), (gst_app_sink_set_drop),
(gst_app_sink_get_drop), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer)::
* gst-libs/gst/app/gstappsink.h: (GstAppSinkPrivate), (_GstAppSink)::
* gst-libs/gst/app/gstappsrc.c: (_GstAppSrcPrivate),
(gst_app_src_class_init), (gst_app_src_init),
(gst_app_src_flush_queued), (gst_app_src_dispose),
(gst_app_src_finalize), (gst_app_src_set_property),
(gst_app_src_get_property), (gst_app_src_unlock),
(gst_app_src_unlock_stop), (gst_app_src_start), (gst_app_src_stop),
(gst_app_src_is_seekable), (gst_app_src_check_get_range),
(gst_app_src_query), (gst_app_src_do_seek), (gst_app_src_create),
(gst_app_src_set_caps), (gst_app_src_get_caps),
(gst_app_src_set_size), (gst_app_src_get_size),
(gst_app_src_set_stream_type), (gst_app_src_get_stream_type),
(gst_app_src_set_max_bytes), (gst_app_src_get_max_bytes),
(gst_app_src_set_latencies), (gst_app_src_set_latency),
(gst_app_src_get_latency), (gst_app_src_push_buffer_full),
(gst_app_src_push_buffer_action), (gst_app_src_end_of_stream)::
* gst-libs/gst/app/gstappsrc.h: (GstAppSrcPrivate)::
Move private data into a private instance struct. Add padding to
instance and class structures exposed in public headers. Add
Since markers to the gtk-doc blurbs (#566750).
2009-01-06 10:56:45 +00:00
|
|
|
};
|
2007-03-11 00:48:26 +00:00
|
|
|
|
2009-01-06 11:10:29 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (app_sink_debug);
|
2007-03-11 00:48:26 +00:00
|
|
|
#define GST_CAT_DEFAULT app_sink_debug
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
/* signals */
|
|
|
|
SIGNAL_EOS,
|
|
|
|
SIGNAL_NEW_PREROLL,
|
2011-12-01 15:48:49 +00:00
|
|
|
SIGNAL_NEW_SAMPLE,
|
2021-02-19 12:32:48 +00:00
|
|
|
SIGNAL_NEW_SERIALIZED_EVENT,
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
|
gst-libs/gst/app/: Add marshal.list, make it compile and add to cvsignore.
Original commit message from CVS:
* gst-libs/gst/app/.cvsignore:
* gst-libs/gst/app/Makefile.am:
* gst-libs/gst/app/gstapp-marshal.list:
Add marshal.list, make it compile and add to cvsignore.
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_dispose),
(gst_app_sink_stop):
Small cleanups.
* gst-libs/gst/app/gstappsrc.c: (gst_app_src_class_init),
(gst_app_src_init), (gst_app_src_set_property),
(gst_app_src_get_property), (gst_app_src_unlock),
(gst_app_src_unlock_stop), (gst_app_src_start), (gst_app_src_stop),
(gst_app_src_create), (gst_app_src_set_caps),
(gst_app_src_get_caps), (gst_app_src_set_size),
(gst_app_src_get_size), (gst_app_src_set_seekable),
(gst_app_src_get_seekable), (gst_app_src_set_max_buffers),
(gst_app_src_get_max_buffers), (gst_app_src_push_buffer),
(gst_app_src_end_of_stream):
* gst-libs/gst/app/gstappsrc.h:
Beat appsrc in shape, add signals and actions.
Add some docs.
Add properties for caps, size, seekability and max-buffers.
Fix unlock/stop code.
2008-05-07 10:38:23 +00:00
|
|
|
/* actions */
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
SIGNAL_PULL_PREROLL,
|
2011-12-01 15:48:49 +00:00
|
|
|
SIGNAL_PULL_SAMPLE,
|
2016-07-15 11:20:29 +00:00
|
|
|
SIGNAL_TRY_PULL_PREROLL,
|
|
|
|
SIGNAL_TRY_PULL_SAMPLE,
|
2021-02-19 12:32:48 +00:00
|
|
|
SIGNAL_TRY_PULL_OBJECT,
|
2023-03-16 06:38:56 +00:00
|
|
|
SIGNAL_PROPOSE_ALLOCATION,
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
#define DEFAULT_PROP_EOS TRUE
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
#define DEFAULT_PROP_EMIT_SIGNALS FALSE
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
#define DEFAULT_PROP_MAX_BUFFERS 0
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
#define DEFAULT_PROP_DROP FALSE
|
2015-10-15 14:38:16 +00:00
|
|
|
#define DEFAULT_PROP_WAIT_ON_EOS TRUE
|
2016-07-04 07:32:28 +00:00
|
|
|
#define DEFAULT_PROP_BUFFER_LIST FALSE
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_CAPS,
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
PROP_EOS,
|
|
|
|
PROP_EMIT_SIGNALS,
|
|
|
|
PROP_MAX_BUFFERS,
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
PROP_DROP,
|
2015-10-15 14:38:16 +00:00
|
|
|
PROP_WAIT_ON_EOS,
|
2016-07-04 07:32:28 +00:00
|
|
|
PROP_BUFFER_LIST,
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
PROP_LAST
|
2007-03-11 00:48:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static GstStaticPadTemplate gst_app_sink_template =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
2009-02-26 15:44:53 +00:00
|
|
|
static void gst_app_sink_uri_handler_init (gpointer g_iface,
|
|
|
|
gpointer iface_data);
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
static void gst_app_sink_dispose (GObject * object);
|
|
|
|
static void gst_app_sink_finalize (GObject * object);
|
|
|
|
|
2007-03-11 00:48:26 +00:00
|
|
|
static void gst_app_sink_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_app_sink_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
static gboolean gst_app_sink_unlock_start (GstBaseSink * bsink);
|
|
|
|
static gboolean gst_app_sink_unlock_stop (GstBaseSink * bsink);
|
2007-03-11 00:48:26 +00:00
|
|
|
static gboolean gst_app_sink_start (GstBaseSink * psink);
|
|
|
|
static gboolean gst_app_sink_stop (GstBaseSink * psink);
|
|
|
|
static gboolean gst_app_sink_event (GstBaseSink * sink, GstEvent * event);
|
2012-02-25 15:21:30 +00:00
|
|
|
static gboolean gst_app_sink_query (GstBaseSink * bsink, GstQuery * query);
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
static GstFlowReturn gst_app_sink_preroll (GstBaseSink * psink,
|
|
|
|
GstBuffer * buffer);
|
2016-07-04 07:32:28 +00:00
|
|
|
static GstFlowReturn gst_app_sink_render_common (GstBaseSink * psink,
|
|
|
|
GstMiniObject * data, gboolean is_list);
|
2007-03-11 00:48:26 +00:00
|
|
|
static GstFlowReturn gst_app_sink_render (GstBaseSink * psink,
|
|
|
|
GstBuffer * buffer);
|
2016-07-04 07:32:28 +00:00
|
|
|
static GstFlowReturn gst_app_sink_render_list (GstBaseSink * psink,
|
|
|
|
GstBufferList * list);
|
2011-12-01 15:48:49 +00:00
|
|
|
static gboolean gst_app_sink_setcaps (GstBaseSink * sink, GstCaps * caps);
|
2011-05-16 08:47:02 +00:00
|
|
|
static GstCaps *gst_app_sink_getcaps (GstBaseSink * psink, GstCaps * filter);
|
2023-03-16 06:38:56 +00:00
|
|
|
static gboolean gst_app_sink_propose_allocation (GstBaseSink * bsink,
|
|
|
|
GstQuery * query);
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
|
|
|
|
static guint gst_app_sink_signals[LAST_SIGNAL] = { 0 };
|
2007-03-11 00:48:26 +00:00
|
|
|
|
2011-04-19 08:47:15 +00:00
|
|
|
#define gst_app_sink_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstAppSink, gst_app_sink, GST_TYPE_BASE_SINK,
|
2018-06-23 19:33:16 +00:00
|
|
|
G_ADD_PRIVATE (GstAppSink)
|
2011-04-19 08:47:15 +00:00
|
|
|
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
|
|
|
|
gst_app_sink_uri_handler_init));
|
2007-03-11 00:48:26 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_app_sink_class_init (GstAppSinkClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class = (GObjectClass *) klass;
|
2011-04-19 08:47:15 +00:00
|
|
|
GstElementClass *element_class = (GstElementClass *) klass;
|
2007-03-11 00:48:26 +00:00
|
|
|
GstBaseSinkClass *basesink_class = (GstBaseSinkClass *) klass;
|
|
|
|
|
2011-04-19 08:47:15 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (app_sink_debug, "appsink", 0, "appsink element");
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
gobject_class->dispose = gst_app_sink_dispose;
|
|
|
|
gobject_class->finalize = gst_app_sink_finalize;
|
|
|
|
|
2007-03-11 00:48:26 +00:00
|
|
|
gobject_class->set_property = gst_app_sink_set_property;
|
|
|
|
gobject_class->get_property = gst_app_sink_get_property;
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_CAPS,
|
|
|
|
g_param_spec_boxed ("caps", "Caps",
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
"The allowed caps for the sink pad", GST_TYPE_CAPS,
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_EOS,
|
|
|
|
g_param_spec_boolean ("eos", "EOS",
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
"Check if the sink is EOS or not started", DEFAULT_PROP_EOS,
|
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_EMIT_SIGNALS,
|
|
|
|
g_param_spec_boolean ("emit-signals", "Emit signals",
|
2013-03-11 22:46:19 +00:00
|
|
|
"Emit new-preroll and new-sample signals",
|
2011-01-26 02:32:32 +00:00
|
|
|
DEFAULT_PROP_EMIT_SIGNALS,
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_MAX_BUFFERS,
|
|
|
|
g_param_spec_uint ("max-buffers", "Max Buffers",
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
"The maximum number of buffers to queue internally (0 = unlimited)",
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
0, G_MAXUINT, DEFAULT_PROP_MAX_BUFFERS,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_DROP,
|
|
|
|
g_param_spec_boolean ("drop", "Drop",
|
|
|
|
"Drop old buffers when the buffer queue is filled", DEFAULT_PROP_DROP,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
2016-07-04 07:32:28 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_BUFFER_LIST,
|
|
|
|
g_param_spec_boolean ("buffer-list", "Buffer List",
|
|
|
|
"Use buffer lists", DEFAULT_PROP_BUFFER_LIST,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2015-10-15 14:38:16 +00:00
|
|
|
/**
|
|
|
|
* GstAppSink::wait-on-eos:
|
|
|
|
*
|
|
|
|
* Wait for all buffers to be processed after receiving an EOS.
|
|
|
|
*
|
|
|
|
* In cases where it is uncertain if an @appsink will have a consumer for its buffers
|
|
|
|
* when it receives an EOS, set to %FALSE to ensure that the @appsink will not hang.
|
|
|
|
*
|
|
|
|
* Since: 1.8
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_WAIT_ON_EOS,
|
|
|
|
g_param_spec_boolean ("wait-on-eos", "Wait on EOS",
|
|
|
|
"Wait for all buffers to be processed after receiving an EOS",
|
|
|
|
DEFAULT_PROP_WAIT_ON_EOS,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
/**
|
|
|
|
* GstAppSink::eos:
|
2011-09-13 19:10:43 +00:00
|
|
|
* @appsink: the appsink element that emitted the signal
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
*
|
2011-09-13 19:10:43 +00:00
|
|
|
* Signal that the end-of-stream has been reached. This signal is emitted from
|
2015-09-18 15:48:49 +00:00
|
|
|
* the streaming thread.
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
*/
|
|
|
|
gst_app_sink_signals[SIGNAL_EOS] =
|
|
|
|
g_signal_new ("eos", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GstAppSinkClass, eos),
|
2019-08-26 05:54:48 +00:00
|
|
|
NULL, NULL, NULL, G_TYPE_NONE, 0, G_TYPE_NONE);
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
/**
|
|
|
|
* GstAppSink::new-preroll:
|
2011-09-13 19:10:43 +00:00
|
|
|
* @appsink: the appsink element that emitted the signal
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* Signal that a new preroll sample is available.
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
*
|
2015-09-18 15:48:49 +00:00
|
|
|
* This signal is emitted from the streaming thread and only when the
|
2011-05-23 12:02:27 +00:00
|
|
|
* "emit-signals" property is %TRUE.
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* The new preroll sample can be retrieved with the "pull-preroll" action
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
* signal or gst_app_sink_pull_preroll() either from this signal callback
|
|
|
|
* or from any other thread.
|
|
|
|
*
|
2011-09-13 19:10:43 +00:00
|
|
|
* Note that this signal is only emitted when the "emit-signals" property is
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
* set to %TRUE, which it is not by default for performance reasons.
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
*/
|
|
|
|
gst_app_sink_signals[SIGNAL_NEW_PREROLL] =
|
|
|
|
g_signal_new ("new-preroll", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GstAppSinkClass, new_preroll),
|
2016-05-15 13:37:41 +00:00
|
|
|
NULL, NULL, NULL, GST_TYPE_FLOW_RETURN, 0, G_TYPE_NONE);
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
/**
|
2011-12-01 15:48:49 +00:00
|
|
|
* GstAppSink::new-sample:
|
2018-05-22 12:59:58 +00:00
|
|
|
* @appsink: the appsink element that emitted the signal
|
2009-06-29 10:14:43 +00:00
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* Signal that a new sample is available.
|
2009-06-29 10:14:43 +00:00
|
|
|
*
|
2015-09-18 15:48:49 +00:00
|
|
|
* This signal is emitted from the streaming thread and only when the
|
2011-05-23 12:02:27 +00:00
|
|
|
* "emit-signals" property is %TRUE.
|
2009-06-29 10:14:43 +00:00
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* The new sample can be retrieved with the "pull-sample" action
|
|
|
|
* signal or gst_app_sink_pull_sample() either from this signal callback
|
2009-06-29 10:14:43 +00:00
|
|
|
* or from any other thread.
|
|
|
|
*
|
2011-09-13 19:10:43 +00:00
|
|
|
* Note that this signal is only emitted when the "emit-signals" property is
|
2009-06-29 10:14:43 +00:00
|
|
|
* set to %TRUE, which it is not by default for performance reasons.
|
|
|
|
*/
|
2011-12-01 15:48:49 +00:00
|
|
|
gst_app_sink_signals[SIGNAL_NEW_SAMPLE] =
|
|
|
|
g_signal_new ("new-sample", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GstAppSinkClass, new_sample),
|
2016-05-15 13:37:41 +00:00
|
|
|
NULL, NULL, NULL, GST_TYPE_FLOW_RETURN, 0, G_TYPE_NONE);
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
|
2023-03-16 06:38:56 +00:00
|
|
|
/**
|
|
|
|
* GstAppSink::propose-allocation:
|
|
|
|
* @appsink: the appsink element that emitted the signal
|
|
|
|
* @query: the allocation query
|
|
|
|
*
|
|
|
|
* Signal that a new propose_allocation query is available.
|
|
|
|
*
|
|
|
|
* This signal is emitted from the streaming thread and only when the
|
|
|
|
* "emit-signals" property is %TRUE.
|
|
|
|
*
|
|
|
|
* Since: 1.24
|
|
|
|
*/
|
|
|
|
gst_app_sink_signals[SIGNAL_PROPOSE_ALLOCATION] =
|
2023-04-06 11:19:28 +00:00
|
|
|
g_signal_new_class_handler ("propose-allocation",
|
|
|
|
G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, NULL, NULL, NULL, NULL,
|
|
|
|
G_TYPE_BOOLEAN, 1, GST_TYPE_QUERY | G_SIGNAL_TYPE_STATIC_SCOPE);
|
2021-02-19 12:32:48 +00:00
|
|
|
/**
|
|
|
|
* GstAppSink::new-serialized-event:
|
|
|
|
* @appsink: the appsink element that emitted the signal
|
|
|
|
*
|
|
|
|
* Signal that a new downstream serialized event is available.
|
|
|
|
*
|
|
|
|
* This signal is emitted from the streaming thread and only when the
|
|
|
|
* "emit-signals" property is %TRUE.
|
|
|
|
*
|
|
|
|
* The new event can be retrieved with the "try-pull-object" action
|
|
|
|
* signal or gst_app_sink_pull_object() either from this signal callback
|
|
|
|
* or from any other thread.
|
|
|
|
*
|
|
|
|
* EOS will not be notified using this signal, use #GstAppSink::eos instead.
|
|
|
|
* EOS cannot be pulled either, use gst_app_sink_is_eos() to check for it.
|
|
|
|
*
|
|
|
|
* Note that this signal is only emitted when the "emit-signals" property is
|
|
|
|
* set to %TRUE, which it is not by default for performance reasons.
|
|
|
|
*
|
|
|
|
* The callback should return %TRUE if the event has been handled, which will
|
|
|
|
* skip basesink handling of the event, %FALSE otherwise.
|
|
|
|
*
|
|
|
|
* Since: 1.20
|
|
|
|
*/
|
|
|
|
gst_app_sink_signals[SIGNAL_NEW_SERIALIZED_EVENT] =
|
|
|
|
g_signal_new ("new-serialized-event", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_BOOLEAN, 0, G_TYPE_NONE);
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
/**
|
|
|
|
* GstAppSink::pull-preroll:
|
|
|
|
* @appsink: the appsink element to emit this signal on
|
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* Get the last preroll sample in @appsink. This was the sample that caused the
|
2017-08-29 08:47:51 +00:00
|
|
|
* appsink to preroll in the PAUSED state.
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
*
|
|
|
|
* This function is typically used when dealing with a pipeline in the PAUSED
|
2011-12-01 15:48:49 +00:00
|
|
|
* state. Calling this function after doing a seek will give the sample right
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
* after the seek position.
|
|
|
|
*
|
2017-08-29 08:47:51 +00:00
|
|
|
* Calling this function will clear the internal reference to the preroll
|
|
|
|
* buffer.
|
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* Note that the preroll sample will also be returned as the first sample
|
|
|
|
* when calling gst_app_sink_pull_sample() or the "pull-sample" action signal.
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
*
|
|
|
|
* If an EOS event was received before any buffers, this function returns
|
2011-05-23 12:02:27 +00:00
|
|
|
* %NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* This function blocks until a preroll sample or EOS is received or the appsink
|
2011-05-23 12:02:27 +00:00
|
|
|
* element is set to the READY/NULL state.
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
*
|
2023-05-14 12:29:23 +00:00
|
|
|
* Returns: (nullable) (transfer full): a #GstSample or %NULL when the appsink is stopped or EOS.
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
*/
|
|
|
|
gst_app_sink_signals[SIGNAL_PULL_PREROLL] =
|
|
|
|
g_signal_new ("pull-preroll", G_TYPE_FROM_CLASS (klass),
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstAppSinkClass,
|
2016-05-15 13:37:41 +00:00
|
|
|
pull_preroll), NULL, NULL, NULL, GST_TYPE_SAMPLE, 0, G_TYPE_NONE);
|
2009-06-29 10:14:43 +00:00
|
|
|
/**
|
2011-12-01 15:48:49 +00:00
|
|
|
* GstAppSink::pull-sample:
|
2009-06-29 10:14:43 +00:00
|
|
|
* @appsink: the appsink element to emit this signal on
|
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* This function blocks until a sample or EOS becomes available or the appsink
|
2011-05-23 12:02:27 +00:00
|
|
|
* element is set to the READY/NULL state.
|
2009-06-29 10:14:43 +00:00
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* This function will only return samples when the appsink is in the PLAYING
|
|
|
|
* state. All rendered samples will be put in a queue so that the application
|
|
|
|
* can pull samples at its own rate.
|
2009-06-29 10:14:43 +00:00
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* Note that when the application does not pull samples fast enough, the
|
|
|
|
* queued samples could consume a lot of memory, especially when dealing with
|
2009-06-29 10:14:43 +00:00
|
|
|
* raw video frames. It's possible to control the behaviour of the queue with
|
|
|
|
* the "drop" and "max-buffers" properties.
|
|
|
|
*
|
|
|
|
* If an EOS event was received before any buffers, this function returns
|
2011-05-23 12:02:27 +00:00
|
|
|
* %NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
|
2009-06-29 10:14:43 +00:00
|
|
|
*
|
2023-05-14 12:29:23 +00:00
|
|
|
* Returns: (nullable) (transfer full): a #GstSample or %NULL when the appsink is stopped or EOS.
|
2009-06-29 10:14:43 +00:00
|
|
|
*/
|
2011-12-01 15:48:49 +00:00
|
|
|
gst_app_sink_signals[SIGNAL_PULL_SAMPLE] =
|
|
|
|
g_signal_new ("pull-sample", G_TYPE_FROM_CLASS (klass),
|
2009-06-29 10:14:43 +00:00
|
|
|
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstAppSinkClass,
|
2016-05-15 13:37:41 +00:00
|
|
|
pull_sample), NULL, NULL, NULL, GST_TYPE_SAMPLE, 0, G_TYPE_NONE);
|
2021-02-19 12:32:48 +00:00
|
|
|
|
2016-07-15 11:20:29 +00:00
|
|
|
/**
|
|
|
|
* GstAppSink::try-pull-preroll:
|
|
|
|
* @appsink: the appsink element to emit this signal on
|
|
|
|
* @timeout: the maximum amount of time to wait for the preroll sample
|
|
|
|
*
|
|
|
|
* Get the last preroll sample in @appsink. This was the sample that caused the
|
2017-08-29 08:47:51 +00:00
|
|
|
* appsink to preroll in the PAUSED state.
|
2016-07-15 11:20:29 +00:00
|
|
|
*
|
|
|
|
* This function is typically used when dealing with a pipeline in the PAUSED
|
|
|
|
* state. Calling this function after doing a seek will give the sample right
|
|
|
|
* after the seek position.
|
|
|
|
*
|
2017-08-29 08:47:51 +00:00
|
|
|
* Calling this function will clear the internal reference to the preroll
|
|
|
|
* buffer.
|
|
|
|
*
|
2016-07-15 11:20:29 +00:00
|
|
|
* Note that the preroll sample will also be returned as the first sample
|
|
|
|
* when calling gst_app_sink_pull_sample() or the "pull-sample" action signal.
|
|
|
|
*
|
|
|
|
* If an EOS event was received before any buffers or the timeout expires,
|
|
|
|
* this function returns %NULL. Use gst_app_sink_is_eos () to check for the EOS
|
|
|
|
* condition.
|
|
|
|
*
|
|
|
|
* This function blocks until a preroll sample or EOS is received, the appsink
|
|
|
|
* element is set to the READY/NULL state, or the timeout expires.
|
|
|
|
*
|
2023-05-14 12:29:23 +00:00
|
|
|
* Returns: (nullable) (transfer full): a #GstSample or %NULL when the appsink
|
|
|
|
* is stopped or EOS or the timeout expires.
|
2016-07-15 11:20:29 +00:00
|
|
|
*
|
|
|
|
* Since: 1.10
|
|
|
|
*/
|
|
|
|
gst_app_sink_signals[SIGNAL_TRY_PULL_PREROLL] =
|
|
|
|
g_signal_new ("try-pull-preroll", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
|
|
|
G_STRUCT_OFFSET (GstAppSinkClass, try_pull_preroll), NULL, NULL, NULL,
|
|
|
|
GST_TYPE_SAMPLE, 1, GST_TYPE_CLOCK_TIME);
|
|
|
|
/**
|
|
|
|
* GstAppSink::try-pull-sample:
|
|
|
|
* @appsink: the appsink element to emit this signal on
|
|
|
|
* @timeout: the maximum amount of time to wait for a sample
|
|
|
|
*
|
|
|
|
* This function blocks until a sample or EOS becomes available or the appsink
|
|
|
|
* element is set to the READY/NULL state or the timeout expires.
|
|
|
|
*
|
|
|
|
* This function will only return samples when the appsink is in the PLAYING
|
|
|
|
* state. All rendered samples will be put in a queue so that the application
|
|
|
|
* can pull samples at its own rate.
|
|
|
|
*
|
|
|
|
* Note that when the application does not pull samples fast enough, the
|
|
|
|
* queued samples could consume a lot of memory, especially when dealing with
|
|
|
|
* raw video frames. It's possible to control the behaviour of the queue with
|
|
|
|
* the "drop" and "max-buffers" properties.
|
|
|
|
*
|
|
|
|
* If an EOS event was received before any buffers or the timeout expires,
|
|
|
|
* this function returns %NULL. Use gst_app_sink_is_eos () to check
|
|
|
|
* for the EOS condition.
|
|
|
|
*
|
2022-10-14 19:08:07 +00:00
|
|
|
* Returns: (nullable): a #GstSample or NULL when the appsink is stopped or EOS or the timeout expires.
|
2016-07-15 11:20:29 +00:00
|
|
|
*
|
|
|
|
* Since: 1.10
|
|
|
|
*/
|
|
|
|
gst_app_sink_signals[SIGNAL_TRY_PULL_SAMPLE] =
|
|
|
|
g_signal_new ("try-pull-sample", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
|
|
|
G_STRUCT_OFFSET (GstAppSinkClass, try_pull_sample), NULL, NULL, NULL,
|
|
|
|
GST_TYPE_SAMPLE, 1, GST_TYPE_CLOCK_TIME);
|
2007-03-11 00:48:26 +00:00
|
|
|
|
2021-02-19 12:32:48 +00:00
|
|
|
/**
|
|
|
|
* GstAppSink::try-pull-object:
|
|
|
|
* @appsink: the appsink element to emit this signal on
|
|
|
|
* @timeout: the maximum amount of time to wait for a sample
|
|
|
|
*
|
|
|
|
* This function blocks until a sample or an event becomes available or the appsink
|
|
|
|
* element is set to the READY/NULL state or the timeout expires.
|
|
|
|
*
|
|
|
|
* This function will only return samples when the appsink is in the PLAYING
|
|
|
|
* state. All rendered samples and events will be put in a queue so that the application
|
|
|
|
* can pull them at its own rate.
|
|
|
|
* Events can be pulled when the appsink is in the READY, PAUSED or PLAYING state.
|
|
|
|
*
|
|
|
|
* Note that when the application does not pull samples fast enough, the
|
|
|
|
* queued samples could consume a lot of memory, especially when dealing with
|
|
|
|
* raw video frames. It's possible to control the behaviour of the queue with
|
|
|
|
* the "drop" and "max-buffers" properties.
|
|
|
|
*
|
|
|
|
* This function will only pull serialized events, excluding
|
|
|
|
* the EOS event for which this functions returns
|
|
|
|
* %NULL. Use gst_app_sink_is_eos() to check for the EOS condition.
|
|
|
|
*
|
|
|
|
* This signal is a variant of #GstAppSink::try-pull-sample: that can be used
|
|
|
|
* to handle incoming events as well as samples.
|
|
|
|
*
|
|
|
|
* Note that future releases may extend this API to return other object types
|
|
|
|
* so make sure that your code is checking for the actual type it is handling.
|
|
|
|
*
|
2022-10-14 19:08:07 +00:00
|
|
|
* Returns: (nullable) (transfer full): a #GstSample or a #GstEvent or NULL when the appsink is stopped or EOS or the timeout expires.
|
2021-02-19 12:32:48 +00:00
|
|
|
*
|
|
|
|
* Since: 1.20
|
|
|
|
*/
|
|
|
|
gst_app_sink_signals[SIGNAL_TRY_PULL_OBJECT] =
|
|
|
|
g_signal_new ("try-pull-object", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
|
|
|
G_STRUCT_OFFSET (GstAppSinkClass, try_pull_object), NULL, NULL, NULL,
|
|
|
|
GST_TYPE_MINI_OBJECT, 1, GST_TYPE_CLOCK_TIME);
|
|
|
|
|
2012-10-17 15:54:14 +00:00
|
|
|
gst_element_class_set_static_metadata (element_class, "AppSink",
|
2011-04-19 08:47:15 +00:00
|
|
|
"Generic/Sink", "Allow the application to get access to raw buffer",
|
|
|
|
"David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>");
|
|
|
|
|
2016-03-03 07:46:24 +00:00
|
|
|
gst_element_class_add_static_pad_template (element_class,
|
|
|
|
&gst_app_sink_template);
|
2011-04-19 08:47:15 +00:00
|
|
|
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
basesink_class->unlock = gst_app_sink_unlock_start;
|
|
|
|
basesink_class->unlock_stop = gst_app_sink_unlock_stop;
|
2007-03-11 00:48:26 +00:00
|
|
|
basesink_class->start = gst_app_sink_start;
|
|
|
|
basesink_class->stop = gst_app_sink_stop;
|
|
|
|
basesink_class->event = gst_app_sink_event;
|
2007-08-16 17:11:48 +00:00
|
|
|
basesink_class->preroll = gst_app_sink_preroll;
|
2007-03-11 00:48:26 +00:00
|
|
|
basesink_class->render = gst_app_sink_render;
|
2016-07-04 07:32:28 +00:00
|
|
|
basesink_class->render_list = gst_app_sink_render_list;
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
basesink_class->get_caps = gst_app_sink_getcaps;
|
2011-12-01 15:48:49 +00:00
|
|
|
basesink_class->set_caps = gst_app_sink_setcaps;
|
2012-02-25 15:21:30 +00:00
|
|
|
basesink_class->query = gst_app_sink_query;
|
2023-03-16 06:38:56 +00:00
|
|
|
basesink_class->propose_allocation = gst_app_sink_propose_allocation;
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
|
|
|
|
klass->pull_preroll = gst_app_sink_pull_preroll;
|
2011-12-01 15:48:49 +00:00
|
|
|
klass->pull_sample = gst_app_sink_pull_sample;
|
2016-07-15 11:20:29 +00:00
|
|
|
klass->try_pull_preroll = gst_app_sink_try_pull_preroll;
|
|
|
|
klass->try_pull_sample = gst_app_sink_try_pull_sample;
|
2021-02-19 12:32:48 +00:00
|
|
|
klass->try_pull_object = gst_app_sink_try_pull_object;
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-04-19 08:47:15 +00:00
|
|
|
gst_app_sink_init (GstAppSink * appsink)
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
{
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSinkPrivate *priv;
|
|
|
|
|
2018-06-23 19:33:16 +00:00
|
|
|
priv = appsink->priv = gst_app_sink_get_instance_private (appsink);
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_init (&priv->mutex);
|
|
|
|
g_cond_init (&priv->cond);
|
2018-01-31 20:11:41 +00:00
|
|
|
priv->queue = gst_queue_array_new (16);
|
2018-04-10 22:57:43 +00:00
|
|
|
priv->sample = gst_sample_new (NULL, NULL, NULL, NULL);
|
gst-libs/gst/app/: Move private data into a private instance struct. Add padding to instance and class structures exp...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (_GstAppSinkPrivate),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_unlock_start), (gst_app_sink_unlock_stop),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_set_emit_signals),
(gst_app_sink_get_emit_signals), (gst_app_sink_set_max_buffers),
(gst_app_sink_get_max_buffers), (gst_app_sink_set_drop),
(gst_app_sink_get_drop), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer)::
* gst-libs/gst/app/gstappsink.h: (GstAppSinkPrivate), (_GstAppSink)::
* gst-libs/gst/app/gstappsrc.c: (_GstAppSrcPrivate),
(gst_app_src_class_init), (gst_app_src_init),
(gst_app_src_flush_queued), (gst_app_src_dispose),
(gst_app_src_finalize), (gst_app_src_set_property),
(gst_app_src_get_property), (gst_app_src_unlock),
(gst_app_src_unlock_stop), (gst_app_src_start), (gst_app_src_stop),
(gst_app_src_is_seekable), (gst_app_src_check_get_range),
(gst_app_src_query), (gst_app_src_do_seek), (gst_app_src_create),
(gst_app_src_set_caps), (gst_app_src_get_caps),
(gst_app_src_set_size), (gst_app_src_get_size),
(gst_app_src_set_stream_type), (gst_app_src_get_stream_type),
(gst_app_src_set_max_bytes), (gst_app_src_get_max_bytes),
(gst_app_src_set_latencies), (gst_app_src_set_latency),
(gst_app_src_get_latency), (gst_app_src_push_buffer_full),
(gst_app_src_push_buffer_action), (gst_app_src_end_of_stream)::
* gst-libs/gst/app/gstappsrc.h: (GstAppSrcPrivate)::
Move private data into a private instance struct. Add padding to
instance and class structures exposed in public headers. Add
Since markers to the gtk-doc blurbs (#566750).
2009-01-06 10:56:45 +00:00
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
priv->emit_signals = DEFAULT_PROP_EMIT_SIGNALS;
|
|
|
|
priv->max_buffers = DEFAULT_PROP_MAX_BUFFERS;
|
|
|
|
priv->drop = DEFAULT_PROP_DROP;
|
2015-10-15 14:38:16 +00:00
|
|
|
priv->wait_on_eos = DEFAULT_PROP_WAIT_ON_EOS;
|
2016-07-04 07:32:28 +00:00
|
|
|
priv->buffer_lists_supported = DEFAULT_PROP_BUFFER_LIST;
|
2018-01-31 20:19:47 +00:00
|
|
|
priv->wait_status = NOONE_WAITING;
|
2007-03-11 00:48:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_app_sink_dispose (GObject * obj)
|
|
|
|
{
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSink *appsink = GST_APP_SINK_CAST (obj);
|
|
|
|
GstAppSinkPrivate *priv = appsink->priv;
|
2009-06-17 09:12:08 +00:00
|
|
|
GstMiniObject *queue_obj;
|
2020-02-12 11:11:43 +00:00
|
|
|
Callbacks *callbacks = NULL;
|
2007-03-11 00:48:26 +00:00
|
|
|
|
gst-libs/gst/app/: Add marshal.list, make it compile and add to cvsignore.
Original commit message from CVS:
* gst-libs/gst/app/.cvsignore:
* gst-libs/gst/app/Makefile.am:
* gst-libs/gst/app/gstapp-marshal.list:
Add marshal.list, make it compile and add to cvsignore.
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_dispose),
(gst_app_sink_stop):
Small cleanups.
* gst-libs/gst/app/gstappsrc.c: (gst_app_src_class_init),
(gst_app_src_init), (gst_app_src_set_property),
(gst_app_src_get_property), (gst_app_src_unlock),
(gst_app_src_unlock_stop), (gst_app_src_start), (gst_app_src_stop),
(gst_app_src_create), (gst_app_src_set_caps),
(gst_app_src_get_caps), (gst_app_src_set_size),
(gst_app_src_get_size), (gst_app_src_set_seekable),
(gst_app_src_get_seekable), (gst_app_src_set_max_buffers),
(gst_app_src_get_max_buffers), (gst_app_src_push_buffer),
(gst_app_src_end_of_stream):
* gst-libs/gst/app/gstappsrc.h:
Beat appsrc in shape, add signals and actions.
Add some docs.
Add properties for caps, size, seekability and max-buffers.
Fix unlock/stop code.
2008-05-07 10:38:23 +00:00
|
|
|
GST_OBJECT_LOCK (appsink);
|
2010-02-01 17:55:39 +00:00
|
|
|
if (priv->caps) {
|
|
|
|
gst_caps_unref (priv->caps);
|
|
|
|
priv->caps = NULL;
|
2007-03-11 00:48:26 +00:00
|
|
|
}
|
gst-libs/gst/app/: Add marshal.list, make it compile and add to cvsignore.
Original commit message from CVS:
* gst-libs/gst/app/.cvsignore:
* gst-libs/gst/app/Makefile.am:
* gst-libs/gst/app/gstapp-marshal.list:
Add marshal.list, make it compile and add to cvsignore.
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_dispose),
(gst_app_sink_stop):
Small cleanups.
* gst-libs/gst/app/gstappsrc.c: (gst_app_src_class_init),
(gst_app_src_init), (gst_app_src_set_property),
(gst_app_src_get_property), (gst_app_src_unlock),
(gst_app_src_unlock_stop), (gst_app_src_start), (gst_app_src_stop),
(gst_app_src_create), (gst_app_src_set_caps),
(gst_app_src_get_caps), (gst_app_src_set_size),
(gst_app_src_get_size), (gst_app_src_set_seekable),
(gst_app_src_get_seekable), (gst_app_src_set_max_buffers),
(gst_app_src_get_max_buffers), (gst_app_src_push_buffer),
(gst_app_src_end_of_stream):
* gst-libs/gst/app/gstappsrc.h:
Beat appsrc in shape, add signals and actions.
Add some docs.
Add properties for caps, size, seekability and max-buffers.
Fix unlock/stop code.
2008-05-07 10:38:23 +00:00
|
|
|
GST_OBJECT_UNLOCK (appsink);
|
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
2020-02-12 11:11:43 +00:00
|
|
|
if (priv->callbacks)
|
|
|
|
callbacks = g_steal_pointer (&priv->callbacks);
|
2018-01-31 20:11:41 +00:00
|
|
|
while ((queue_obj = gst_queue_array_pop_head (priv->queue)))
|
2009-06-17 09:12:08 +00:00
|
|
|
gst_mini_object_unref (queue_obj);
|
2017-09-13 13:06:43 +00:00
|
|
|
gst_buffer_replace (&priv->preroll_buffer, NULL);
|
2011-12-01 15:48:49 +00:00
|
|
|
gst_caps_replace (&priv->preroll_caps, NULL);
|
|
|
|
gst_caps_replace (&priv->last_caps, NULL);
|
2018-04-10 22:57:43 +00:00
|
|
|
if (priv->sample) {
|
|
|
|
gst_sample_unref (priv->sample);
|
|
|
|
priv->sample = NULL;
|
|
|
|
}
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
2007-03-11 00:48:26 +00:00
|
|
|
|
2020-02-12 11:11:43 +00:00
|
|
|
g_clear_pointer (&callbacks, callbacks_unref);
|
|
|
|
|
2007-03-11 00:48:26 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
gst_app_sink_finalize (GObject * obj)
|
2007-03-11 00:48:26 +00:00
|
|
|
{
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSink *appsink = GST_APP_SINK_CAST (obj);
|
|
|
|
GstAppSinkPrivate *priv = appsink->priv;
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_clear (&priv->mutex);
|
|
|
|
g_cond_clear (&priv->cond);
|
2018-01-31 20:11:41 +00:00
|
|
|
gst_queue_array_free (priv->queue);
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
2007-03-11 00:48:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_app_sink_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSink *appsink = GST_APP_SINK_CAST (object);
|
2007-03-11 00:48:26 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
case PROP_CAPS:
|
|
|
|
gst_app_sink_set_caps (appsink, gst_value_get_caps (value));
|
|
|
|
break;
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
case PROP_EMIT_SIGNALS:
|
|
|
|
gst_app_sink_set_emit_signals (appsink, g_value_get_boolean (value));
|
|
|
|
break;
|
|
|
|
case PROP_MAX_BUFFERS:
|
|
|
|
gst_app_sink_set_max_buffers (appsink, g_value_get_uint (value));
|
|
|
|
break;
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
case PROP_DROP:
|
|
|
|
gst_app_sink_set_drop (appsink, g_value_get_boolean (value));
|
|
|
|
break;
|
2016-07-04 07:32:28 +00:00
|
|
|
case PROP_BUFFER_LIST:
|
|
|
|
gst_app_sink_set_buffer_list_support (appsink,
|
|
|
|
g_value_get_boolean (value));
|
|
|
|
break;
|
2015-10-15 14:38:16 +00:00
|
|
|
case PROP_WAIT_ON_EOS:
|
|
|
|
gst_app_sink_set_wait_on_eos (appsink, g_value_get_boolean (value));
|
|
|
|
break;
|
2007-03-11 00:48:26 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_app_sink_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
|
|
|
{
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSink *appsink = GST_APP_SINK_CAST (object);
|
2007-03-11 00:48:26 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
case PROP_CAPS:
|
|
|
|
{
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
caps = gst_app_sink_get_caps (appsink);
|
|
|
|
gst_value_set_caps (value, caps);
|
|
|
|
if (caps)
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case PROP_EOS:
|
|
|
|
g_value_set_boolean (value, gst_app_sink_is_eos (appsink));
|
|
|
|
break;
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
case PROP_EMIT_SIGNALS:
|
|
|
|
g_value_set_boolean (value, gst_app_sink_get_emit_signals (appsink));
|
|
|
|
break;
|
|
|
|
case PROP_MAX_BUFFERS:
|
|
|
|
g_value_set_uint (value, gst_app_sink_get_max_buffers (appsink));
|
|
|
|
break;
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
case PROP_DROP:
|
|
|
|
g_value_set_boolean (value, gst_app_sink_get_drop (appsink));
|
|
|
|
break;
|
2016-07-04 07:32:28 +00:00
|
|
|
case PROP_BUFFER_LIST:
|
|
|
|
g_value_set_boolean (value,
|
|
|
|
gst_app_sink_get_buffer_list_support (appsink));
|
|
|
|
break;
|
2015-10-15 14:38:16 +00:00
|
|
|
case PROP_WAIT_ON_EOS:
|
|
|
|
g_value_set_boolean (value, gst_app_sink_get_wait_on_eos (appsink));
|
|
|
|
break;
|
2007-03-11 00:48:26 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
static gboolean
|
|
|
|
gst_app_sink_unlock_start (GstBaseSink * bsink)
|
|
|
|
{
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSink *appsink = GST_APP_SINK_CAST (bsink);
|
|
|
|
GstAppSinkPrivate *priv = appsink->priv;
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "unlock start");
|
2010-02-01 17:55:39 +00:00
|
|
|
priv->unlock = TRUE;
|
2012-09-09 23:34:35 +00:00
|
|
|
g_cond_signal (&priv->cond);
|
|
|
|
g_mutex_unlock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_app_sink_unlock_stop (GstBaseSink * bsink)
|
|
|
|
{
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSink *appsink = GST_APP_SINK_CAST (bsink);
|
|
|
|
GstAppSinkPrivate *priv = appsink->priv;
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "unlock stop");
|
2010-02-01 17:55:39 +00:00
|
|
|
priv->unlock = FALSE;
|
2012-09-09 23:34:35 +00:00
|
|
|
g_cond_signal (&priv->cond);
|
|
|
|
g_mutex_unlock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
static void
|
|
|
|
gst_app_sink_flush_unlocked (GstAppSink * appsink)
|
|
|
|
{
|
2009-06-17 09:12:08 +00:00
|
|
|
GstMiniObject *obj;
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSinkPrivate *priv = appsink->priv;
|
2007-08-14 17:47:34 +00:00
|
|
|
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "flush stop appsink");
|
2010-02-01 17:55:39 +00:00
|
|
|
priv->is_eos = FALSE;
|
2017-09-13 13:06:43 +00:00
|
|
|
gst_buffer_replace (&priv->preroll_buffer, NULL);
|
2018-01-31 20:11:41 +00:00
|
|
|
while ((obj = gst_queue_array_pop_head (priv->queue)))
|
2009-06-17 09:12:08 +00:00
|
|
|
gst_mini_object_unref (obj);
|
2011-12-01 15:48:49 +00:00
|
|
|
priv->num_buffers = 0;
|
2021-02-19 12:32:48 +00:00
|
|
|
priv->num_events = 0;
|
appsink: Fix race condition on caps handling
Background:
Whenever a caps event is received by appsink, the caps are stored in the
same internal queue as buffers. Only when enough buffers have been
popped from the queue to reach the caps, `priv->sample` gets its caps
updated to match, so that they are correct for the following buffers.
Note that as far as upstream elements are concerned, the caps of appsink
are updated immediately when the CAPS event is sent. Samples pulled from
appsink retain the old caps until a later buffer -- one that was sent by
upstream elements after the new caps -- is pulled.
The race condition:
When a flush is received, appsink clears the entire internal queue. The
caps of `priv->sample` are not updated as part of this process, and
instead remain as those of the sample that was last pulled by the user.
This leaves open a race condition where:
1. Upstream sends a new caps event, and possibly some buffers for the
new caps.
2. Upstream sends a flush (possibly from a different thread).
3. Upstream sends a new buffer for the new caps. Since as far as
upstream is concerned, appsink caps are the new caps already, no new
CAPS event is sent.
4. The appsink user pulls a sample, having not pulled before enough
samples to reach the buffers sent in step 1.
Bug: the pulled sample has the old caps instead of the new caps.
Fixing the race condition:
To avoid this problem, when a buffer is received after a flush,
`priv->sample`'s caps should be updated with the current caps before the
buffer is added to the internal queue.
Interestingly, before this patch, appsink already had code for this, in
gst_app_sink_render_common():
/* queue holding caps event might have been FLUSHed,
* but caps state still present in pad caps */
if (G_UNLIKELY (!priv->last_caps &&
gst_pad_has_current_caps (GST_BASE_SINK_PAD (psink)))) {
priv->last_caps = gst_pad_get_current_caps (GST_BASE_SINK_PAD (psink));
gst_sample_set_caps (priv->sample, priv->last_caps);
GST_DEBUG_OBJECT (appsink, "activating pad caps %" GST_PTR_FORMAT,
priv->last_caps);
}
This code assumes `priv->last_caps` is reset when a flush is received,
which makes sense, but unfortunately, there was no code in the flush
code path resetting it.
This patch adds such code, therefore fixing the race condition. A unit
test demonstrating the bug and testing its behavior with the fix has
also been added.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2413>
2022-05-13 11:31:55 +00:00
|
|
|
gst_caps_replace (&priv->last_caps, NULL);
|
2012-09-09 23:34:35 +00:00
|
|
|
g_cond_signal (&priv->cond);
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
}
|
|
|
|
|
2007-03-11 00:48:26 +00:00
|
|
|
static gboolean
|
|
|
|
gst_app_sink_start (GstBaseSink * psink)
|
|
|
|
{
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSink *appsink = GST_APP_SINK_CAST (psink);
|
|
|
|
GstAppSinkPrivate *priv = appsink->priv;
|
2007-03-11 00:48:26 +00:00
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "starting");
|
2018-01-31 20:19:47 +00:00
|
|
|
priv->wait_status = NOONE_WAITING;
|
2010-12-10 17:57:56 +00:00
|
|
|
priv->flushing = FALSE;
|
2010-02-01 17:55:39 +00:00
|
|
|
priv->started = TRUE;
|
2015-06-18 10:30:24 +00:00
|
|
|
gst_segment_init (&priv->preroll_segment, GST_FORMAT_TIME);
|
2011-12-01 15:48:49 +00:00
|
|
|
gst_segment_init (&priv->last_segment, GST_FORMAT_TIME);
|
2018-04-10 22:57:43 +00:00
|
|
|
priv->sample = gst_sample_make_writable (priv->sample);
|
|
|
|
gst_sample_set_buffer (priv->sample, NULL);
|
|
|
|
gst_sample_set_buffer_list (priv->sample, NULL);
|
|
|
|
gst_sample_set_caps (priv->sample, NULL);
|
|
|
|
gst_sample_set_segment (priv->sample, NULL);
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
2007-03-11 00:48:26 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_app_sink_stop (GstBaseSink * psink)
|
|
|
|
{
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSink *appsink = GST_APP_SINK_CAST (psink);
|
|
|
|
GstAppSinkPrivate *priv = appsink->priv;
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "stopping");
|
2010-02-01 17:55:39 +00:00
|
|
|
priv->flushing = TRUE;
|
|
|
|
priv->started = FALSE;
|
2018-01-31 20:19:47 +00:00
|
|
|
priv->wait_status = NOONE_WAITING;
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
gst_app_sink_flush_unlocked (appsink);
|
2017-09-13 13:06:43 +00:00
|
|
|
gst_buffer_replace (&priv->preroll_buffer, NULL);
|
2011-12-01 15:48:49 +00:00
|
|
|
gst_caps_replace (&priv->preroll_caps, NULL);
|
|
|
|
gst_caps_replace (&priv->last_caps, NULL);
|
2015-08-14 16:43:03 +00:00
|
|
|
gst_segment_init (&priv->preroll_segment, GST_FORMAT_UNDEFINED);
|
|
|
|
gst_segment_init (&priv->last_segment, GST_FORMAT_UNDEFINED);
|
2023-06-09 13:08:36 +00:00
|
|
|
priv->sample = gst_sample_make_writable (priv->sample);
|
|
|
|
gst_sample_set_buffer (priv->sample, NULL);
|
|
|
|
gst_sample_set_buffer_list (priv->sample, NULL);
|
|
|
|
gst_sample_set_caps (priv->sample, NULL);
|
|
|
|
gst_sample_set_segment (priv->sample, NULL);
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
2011-12-01 15:48:49 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_app_sink_setcaps (GstBaseSink * sink, GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstAppSink *appsink = GST_APP_SINK_CAST (sink);
|
|
|
|
GstAppSinkPrivate *priv = appsink->priv;
|
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
2011-12-01 15:48:49 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "receiving CAPS");
|
2018-01-31 20:11:41 +00:00
|
|
|
gst_queue_array_push_tail (priv->queue, gst_event_new_caps (caps));
|
2021-02-19 12:32:48 +00:00
|
|
|
priv->num_events++;
|
2017-09-13 13:06:43 +00:00
|
|
|
if (!priv->preroll_buffer)
|
2015-08-14 16:35:22 +00:00
|
|
|
gst_caps_replace (&priv->preroll_caps, caps);
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
2007-03-11 00:48:26 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_app_sink_event (GstBaseSink * sink, GstEvent * event)
|
|
|
|
{
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSink *appsink = GST_APP_SINK_CAST (sink);
|
|
|
|
GstAppSinkPrivate *priv = appsink->priv;
|
2007-03-11 00:48:26 +00:00
|
|
|
|
2021-02-19 12:32:48 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "%" GST_PTR_FORMAT, event);
|
|
|
|
|
2007-03-11 00:48:26 +00:00
|
|
|
switch (event->type) {
|
2011-12-01 15:48:49 +00:00
|
|
|
case GST_EVENT_SEGMENT:
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
2011-12-01 15:48:49 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "receiving SEGMENT");
|
2017-09-13 13:06:43 +00:00
|
|
|
if (!priv->preroll_buffer)
|
2015-06-18 10:30:24 +00:00
|
|
|
gst_event_copy_segment (event, &priv->preroll_segment);
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
2011-12-01 15:48:49 +00:00
|
|
|
break;
|
2015-01-20 18:14:21 +00:00
|
|
|
case GST_EVENT_EOS:{
|
|
|
|
gboolean emit = TRUE;
|
2020-02-12 11:11:43 +00:00
|
|
|
Callbacks *callbacks = NULL;
|
2015-01-20 18:14:21 +00:00
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "receiving EOS");
|
2010-02-01 17:55:39 +00:00
|
|
|
priv->is_eos = TRUE;
|
2012-09-09 23:34:35 +00:00
|
|
|
g_cond_signal (&priv->cond);
|
|
|
|
g_mutex_unlock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
|
2015-01-20 18:14:21 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
|
|
|
/* wait until all buffers are consumed or we're flushing.
|
|
|
|
* Otherwise we might signal EOS before all buffers are
|
|
|
|
* consumed, which is a bit confusing for the application
|
|
|
|
*/
|
2018-01-31 20:19:47 +00:00
|
|
|
while (priv->num_buffers > 0 && !priv->flushing && priv->wait_on_eos) {
|
2018-05-02 15:35:23 +00:00
|
|
|
if (priv->unlock) {
|
|
|
|
/* we are asked to unlock, call the wait_preroll method */
|
|
|
|
g_mutex_unlock (&priv->mutex);
|
|
|
|
if (gst_base_sink_wait_preroll (sink) != GST_FLOW_OK) {
|
|
|
|
/* Directly go out of here */
|
|
|
|
gst_event_unref (event);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we are allowed to continue now */
|
|
|
|
g_mutex_lock (&priv->mutex);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2018-05-02 15:11:58 +00:00
|
|
|
priv->wait_status |= STREAM_WAITING;
|
2015-01-20 18:14:21 +00:00
|
|
|
g_cond_wait (&priv->cond, &priv->mutex);
|
2018-05-02 15:11:58 +00:00
|
|
|
priv->wait_status &= ~STREAM_WAITING;
|
2018-01-31 20:19:47 +00:00
|
|
|
}
|
2015-01-20 18:14:21 +00:00
|
|
|
if (priv->flushing)
|
|
|
|
emit = FALSE;
|
2020-02-12 11:11:43 +00:00
|
|
|
|
|
|
|
if (emit && priv->callbacks)
|
|
|
|
callbacks = callbacks_ref (priv->callbacks);
|
2015-01-20 18:14:21 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
|
|
|
|
|
|
|
if (emit) {
|
|
|
|
/* emit EOS now */
|
2020-02-12 11:11:43 +00:00
|
|
|
if (callbacks && callbacks->callbacks.eos)
|
|
|
|
callbacks->callbacks.eos (appsink, callbacks->user_data);
|
2015-01-20 18:14:21 +00:00
|
|
|
else
|
|
|
|
g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_EOS], 0);
|
2020-02-12 11:11:43 +00:00
|
|
|
|
|
|
|
g_clear_pointer (&callbacks, callbacks_unref);
|
2015-01-20 18:14:21 +00:00
|
|
|
}
|
2009-02-26 15:44:53 +00:00
|
|
|
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
break;
|
2015-01-20 18:14:21 +00:00
|
|
|
}
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
case GST_EVENT_FLUSH_START:
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
/* we don't have to do anything here, the base class will call unlock
|
|
|
|
* which will make sure we exit the _render method */
|
|
|
|
GST_DEBUG_OBJECT (appsink, "received FLUSH_START");
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
break;
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "received FLUSH_STOP");
|
|
|
|
gst_app_sink_flush_unlocked (appsink);
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
2007-03-11 00:48:26 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2021-02-19 12:32:48 +00:00
|
|
|
|
|
|
|
if (GST_EVENT_TYPE (event) != GST_EVENT_EOS
|
|
|
|
&& GST_EVENT_IS_SERIALIZED (event)) {
|
|
|
|
gboolean emit;
|
|
|
|
Callbacks *callbacks = NULL;
|
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
g_mutex_lock (&priv->mutex);
|
|
|
|
|
|
|
|
emit = priv->emit_signals;
|
|
|
|
if (priv->callbacks)
|
|
|
|
callbacks = callbacks_ref (priv->callbacks);
|
|
|
|
|
|
|
|
gst_queue_array_push_tail (priv->queue, gst_event_ref (event));
|
|
|
|
priv->num_events++;
|
|
|
|
|
|
|
|
g_mutex_unlock (&priv->mutex);
|
|
|
|
|
|
|
|
if (callbacks && callbacks->callbacks.new_event) {
|
|
|
|
ret = callbacks->callbacks.new_event (appsink, callbacks->user_data);
|
|
|
|
} else {
|
|
|
|
ret = FALSE;
|
|
|
|
if (emit)
|
|
|
|
g_signal_emit (appsink,
|
|
|
|
gst_app_sink_signals[SIGNAL_NEW_SERIALIZED_EVENT], 0, &ret);
|
|
|
|
}
|
|
|
|
g_clear_pointer (&callbacks, callbacks_unref);
|
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
gst_event_unref (event);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-02 21:24:43 +00:00
|
|
|
return GST_BASE_SINK_CLASS (parent_class)->event (sink, event);
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
}
|
2007-03-11 00:48:26 +00:00
|
|
|
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_app_sink_preroll (GstBaseSink * psink, GstBuffer * buffer)
|
|
|
|
{
|
2012-09-14 11:31:36 +00:00
|
|
|
GstFlowReturn res;
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSink *appsink = GST_APP_SINK_CAST (psink);
|
|
|
|
GstAppSinkPrivate *priv = appsink->priv;
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
gboolean emit;
|
2020-02-12 11:11:43 +00:00
|
|
|
Callbacks *callbacks = NULL;
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
2010-02-01 17:55:39 +00:00
|
|
|
if (priv->flushing)
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
goto flushing;
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "setting preroll buffer %p", buffer);
|
2017-09-13 13:06:43 +00:00
|
|
|
gst_buffer_replace (&priv->preroll_buffer, buffer);
|
2009-04-09 21:46:17 +00:00
|
|
|
|
2018-05-02 15:11:58 +00:00
|
|
|
if ((priv->wait_status & APP_WAITING))
|
2018-01-31 20:19:47 +00:00
|
|
|
g_cond_signal (&priv->cond);
|
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
emit = priv->emit_signals;
|
2020-02-12 11:11:43 +00:00
|
|
|
if (priv->callbacks)
|
|
|
|
callbacks = callbacks_ref (priv->callbacks);
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
|
2020-02-12 11:11:43 +00:00
|
|
|
if (callbacks && callbacks->callbacks.new_preroll) {
|
|
|
|
res = callbacks->callbacks.new_preroll (appsink, callbacks->user_data);
|
2012-09-14 11:31:36 +00:00
|
|
|
} else {
|
|
|
|
res = GST_FLOW_OK;
|
|
|
|
if (emit)
|
|
|
|
g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_NEW_PREROLL], 0,
|
|
|
|
&res);
|
|
|
|
}
|
2009-02-19 09:44:31 +00:00
|
|
|
|
2020-02-12 11:11:43 +00:00
|
|
|
g_clear_pointer (&callbacks, callbacks_unref);
|
|
|
|
|
2009-04-09 21:46:17 +00:00
|
|
|
return res;
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
|
|
|
|
flushing:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (appsink, "we are flushing");
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
2012-02-08 14:17:49 +00:00
|
|
|
return GST_FLOW_FLUSHING;
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
}
|
2007-03-11 00:48:26 +00:00
|
|
|
}
|
|
|
|
|
2016-07-04 07:32:28 +00:00
|
|
|
static GstMiniObject *
|
2021-02-19 13:45:08 +00:00
|
|
|
dequeue_object (GstAppSink * appsink)
|
2011-12-01 15:48:49 +00:00
|
|
|
{
|
|
|
|
GstAppSinkPrivate *priv = appsink->priv;
|
2016-07-04 07:32:28 +00:00
|
|
|
GstMiniObject *obj;
|
2011-12-01 15:48:49 +00:00
|
|
|
|
2021-02-19 13:45:08 +00:00
|
|
|
obj = gst_queue_array_pop_head (priv->queue);
|
|
|
|
|
|
|
|
if (GST_IS_BUFFER (obj) || GST_IS_BUFFER_LIST (obj)) {
|
|
|
|
GST_DEBUG_OBJECT (appsink, "dequeued buffer/list %p", obj);
|
|
|
|
priv->num_buffers--;
|
|
|
|
} else if (GST_IS_EVENT (obj)) {
|
|
|
|
GstEvent *event = GST_EVENT_CAST (obj);
|
|
|
|
|
2021-02-19 12:32:48 +00:00
|
|
|
priv->num_events--;
|
|
|
|
|
2021-02-19 13:45:08 +00:00
|
|
|
switch (GST_EVENT_TYPE (obj)) {
|
|
|
|
case GST_EVENT_CAPS:
|
|
|
|
{
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
gst_event_parse_caps (event, &caps);
|
|
|
|
GST_DEBUG_OBJECT (appsink, "activating caps %" GST_PTR_FORMAT, caps);
|
|
|
|
gst_caps_replace (&priv->last_caps, caps);
|
|
|
|
priv->sample = gst_sample_make_writable (priv->sample);
|
|
|
|
gst_sample_set_caps (priv->sample, priv->last_caps);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_EVENT_SEGMENT:
|
|
|
|
gst_event_copy_segment (event, &priv->last_segment);
|
|
|
|
priv->sample = gst_sample_make_writable (priv->sample);
|
|
|
|
gst_sample_set_segment (priv->sample, &priv->last_segment);
|
|
|
|
GST_DEBUG_OBJECT (appsink, "activated segment %" GST_SEGMENT_FORMAT,
|
|
|
|
&priv->last_segment);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstMiniObject *
|
|
|
|
dequeue_buffer (GstAppSink * appsink)
|
|
|
|
{
|
|
|
|
GstMiniObject *obj;
|
|
|
|
|
2011-12-01 15:48:49 +00:00
|
|
|
do {
|
2021-02-19 13:45:08 +00:00
|
|
|
obj = dequeue_object (appsink);
|
2011-12-01 15:48:49 +00:00
|
|
|
|
2016-07-04 07:32:28 +00:00
|
|
|
if (GST_IS_BUFFER (obj) || GST_IS_BUFFER_LIST (obj)) {
|
2011-12-01 15:48:49 +00:00
|
|
|
break;
|
|
|
|
}
|
2021-02-19 13:45:08 +00:00
|
|
|
|
|
|
|
gst_mini_object_unref (obj);
|
2011-12-01 15:48:49 +00:00
|
|
|
} while (TRUE);
|
|
|
|
|
2016-07-04 07:32:28 +00:00
|
|
|
return obj;
|
2011-12-01 15:48:49 +00:00
|
|
|
}
|
|
|
|
|
2007-03-11 00:48:26 +00:00
|
|
|
static GstFlowReturn
|
2016-07-04 07:32:28 +00:00
|
|
|
gst_app_sink_render_common (GstBaseSink * psink, GstMiniObject * data,
|
|
|
|
gboolean is_list)
|
2007-03-11 00:48:26 +00:00
|
|
|
{
|
2009-08-24 11:15:06 +00:00
|
|
|
GstFlowReturn ret;
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSink *appsink = GST_APP_SINK_CAST (psink);
|
|
|
|
GstAppSinkPrivate *priv = appsink->priv;
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
gboolean emit;
|
2020-02-12 11:11:43 +00:00
|
|
|
Callbacks *callbacks = NULL;
|
2007-03-11 00:48:26 +00:00
|
|
|
|
2009-08-24 11:15:06 +00:00
|
|
|
restart:
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
2010-02-01 17:55:39 +00:00
|
|
|
if (priv->flushing)
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
goto flushing;
|
|
|
|
|
2012-03-28 14:45:03 +00:00
|
|
|
/* queue holding caps event might have been FLUSHed,
|
|
|
|
* but caps state still present in pad caps */
|
|
|
|
if (G_UNLIKELY (!priv->last_caps &&
|
|
|
|
gst_pad_has_current_caps (GST_BASE_SINK_PAD (psink)))) {
|
|
|
|
priv->last_caps = gst_pad_get_current_caps (GST_BASE_SINK_PAD (psink));
|
2023-07-07 13:01:33 +00:00
|
|
|
priv->sample = gst_sample_make_writable (priv->sample);
|
2018-04-10 22:57:43 +00:00
|
|
|
gst_sample_set_caps (priv->sample, priv->last_caps);
|
2012-03-28 14:45:03 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "activating pad caps %" GST_PTR_FORMAT,
|
|
|
|
priv->last_caps);
|
|
|
|
}
|
|
|
|
|
2016-07-04 07:32:28 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "pushing render buffer/list %p on queue (%d)",
|
|
|
|
data, priv->num_buffers);
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
|
2011-12-01 15:48:49 +00:00
|
|
|
while (priv->max_buffers > 0 && priv->num_buffers >= priv->max_buffers) {
|
2010-02-01 17:55:39 +00:00
|
|
|
if (priv->drop) {
|
2016-07-04 07:32:28 +00:00
|
|
|
GstMiniObject *old;
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
|
2016-07-04 07:32:28 +00:00
|
|
|
/* we need to drop the oldest buffer/list and try again */
|
2011-12-01 15:48:49 +00:00
|
|
|
if ((old = dequeue_buffer (appsink))) {
|
2016-07-04 07:32:28 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "dropping old buffer/list %p", old);
|
|
|
|
gst_mini_object_unref (old);
|
2011-12-01 15:48:49 +00:00
|
|
|
}
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (appsink, "waiting for free space, length %d >= %d",
|
2011-12-01 15:48:49 +00:00
|
|
|
priv->num_buffers, priv->max_buffers);
|
2009-08-24 11:15:06 +00:00
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
if (priv->unlock) {
|
2009-08-24 11:15:06 +00:00
|
|
|
/* we are asked to unlock, call the wait_preroll method */
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
2009-08-24 11:15:06 +00:00
|
|
|
if ((ret = gst_base_sink_wait_preroll (psink)) != GST_FLOW_OK)
|
|
|
|
goto stopping;
|
|
|
|
|
|
|
|
/* we are allowed to continue now */
|
|
|
|
goto restart;
|
|
|
|
}
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
/* wait for a buffer to be removed or flush */
|
2018-05-02 15:11:58 +00:00
|
|
|
priv->wait_status |= STREAM_WAITING;
|
2012-09-09 23:34:35 +00:00
|
|
|
g_cond_wait (&priv->cond, &priv->mutex);
|
2018-05-02 15:11:58 +00:00
|
|
|
priv->wait_status &= ~STREAM_WAITING;
|
2018-01-31 20:19:47 +00:00
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
if (priv->flushing)
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
goto flushing;
|
|
|
|
}
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
}
|
2016-07-04 07:32:28 +00:00
|
|
|
/* we need to ref the buffer/list when pushing it in the queue */
|
2018-01-31 20:11:41 +00:00
|
|
|
gst_queue_array_push_tail (priv->queue, gst_mini_object_ref (data));
|
2011-12-01 15:48:49 +00:00
|
|
|
priv->num_buffers++;
|
2018-01-31 20:19:47 +00:00
|
|
|
|
2018-05-02 15:11:58 +00:00
|
|
|
if ((priv->wait_status & APP_WAITING))
|
2018-01-31 20:19:47 +00:00
|
|
|
g_cond_signal (&priv->cond);
|
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
emit = priv->emit_signals;
|
2020-02-12 11:11:43 +00:00
|
|
|
if (priv->callbacks)
|
|
|
|
callbacks = callbacks_ref (priv->callbacks);
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
2007-03-11 00:48:26 +00:00
|
|
|
|
2020-02-12 11:11:43 +00:00
|
|
|
if (callbacks && callbacks->callbacks.new_sample) {
|
|
|
|
ret = callbacks->callbacks.new_sample (appsink, callbacks->user_data);
|
2012-09-14 11:31:36 +00:00
|
|
|
} else {
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
if (emit)
|
|
|
|
g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_NEW_SAMPLE], 0, &ret);
|
|
|
|
}
|
2020-02-12 11:11:43 +00:00
|
|
|
g_clear_pointer (&callbacks, callbacks_unref);
|
|
|
|
|
2012-09-14 11:31:36 +00:00
|
|
|
return ret;
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
flushing:
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
{
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "we are flushing");
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
2012-02-08 14:17:49 +00:00
|
|
|
return GST_FLOW_FLUSHING;
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
}
|
2009-08-24 11:15:06 +00:00
|
|
|
stopping:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (appsink, "we are stopping");
|
|
|
|
return ret;
|
|
|
|
}
|
2007-03-11 00:48:26 +00:00
|
|
|
}
|
|
|
|
|
2016-07-04 07:32:28 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_app_sink_render (GstBaseSink * psink, GstBuffer * buffer)
|
|
|
|
{
|
|
|
|
return gst_app_sink_render_common (psink, GST_MINI_OBJECT_CAST (buffer),
|
|
|
|
FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_app_sink_render_list (GstBaseSink * sink, GstBufferList * list)
|
|
|
|
{
|
|
|
|
GstFlowReturn flow;
|
|
|
|
GstAppSink *appsink;
|
|
|
|
GstBuffer *buffer;
|
|
|
|
guint i, len;
|
|
|
|
|
|
|
|
appsink = GST_APP_SINK_CAST (sink);
|
|
|
|
|
|
|
|
if (appsink->priv->buffer_lists_supported)
|
|
|
|
return gst_app_sink_render_common (sink, GST_MINI_OBJECT_CAST (list), TRUE);
|
|
|
|
|
|
|
|
/* The application doesn't support buffer lists, extract individual buffers
|
|
|
|
* then and push them one-by-one */
|
|
|
|
GST_INFO_OBJECT (sink, "chaining each group in list as a merged buffer");
|
|
|
|
|
|
|
|
len = gst_buffer_list_length (list);
|
|
|
|
|
|
|
|
flow = GST_FLOW_OK;
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
buffer = gst_buffer_list_get (list, i);
|
|
|
|
flow = gst_app_sink_render (sink, buffer);
|
|
|
|
if (flow != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return flow;
|
|
|
|
}
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
static GstCaps *
|
2011-05-16 08:47:02 +00:00
|
|
|
gst_app_sink_getcaps (GstBaseSink * psink, GstCaps * filter)
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
{
|
|
|
|
GstCaps *caps;
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSink *appsink = GST_APP_SINK_CAST (psink);
|
|
|
|
GstAppSinkPrivate *priv = appsink->priv;
|
2007-03-11 00:48:26 +00:00
|
|
|
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
GST_OBJECT_LOCK (appsink);
|
2011-05-16 08:47:02 +00:00
|
|
|
if ((caps = priv->caps)) {
|
|
|
|
if (filter)
|
|
|
|
caps = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
else
|
|
|
|
gst_caps_ref (caps);
|
|
|
|
}
|
2007-09-12 08:38:21 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "got caps %" GST_PTR_FORMAT, caps);
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
GST_OBJECT_UNLOCK (appsink);
|
2007-03-11 00:48:26 +00:00
|
|
|
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
return caps;
|
|
|
|
}
|
2007-03-11 00:48:26 +00:00
|
|
|
|
2012-02-25 15:21:30 +00:00
|
|
|
static gboolean
|
|
|
|
gst_app_sink_query (GstBaseSink * bsink, GstQuery * query)
|
|
|
|
{
|
2017-08-24 09:02:31 +00:00
|
|
|
GstAppSink *appsink = GST_APP_SINK_CAST (bsink);
|
|
|
|
GstAppSinkPrivate *priv = appsink->priv;
|
2012-02-25 15:21:30 +00:00
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
2017-08-24 09:02:31 +00:00
|
|
|
case GST_QUERY_DRAIN:
|
|
|
|
{
|
|
|
|
g_mutex_lock (&priv->mutex);
|
|
|
|
GST_DEBUG_OBJECT (appsink, "waiting buffers to be consumed");
|
2018-01-31 20:19:47 +00:00
|
|
|
while (priv->num_buffers > 0 || priv->preroll_buffer) {
|
2018-05-02 15:39:31 +00:00
|
|
|
if (priv->unlock) {
|
|
|
|
/* we are asked to unlock, call the wait_preroll method */
|
|
|
|
g_mutex_unlock (&priv->mutex);
|
|
|
|
if (gst_base_sink_wait_preroll (bsink) != GST_FLOW_OK) {
|
|
|
|
/* Directly go out of here */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we are allowed to continue now */
|
|
|
|
g_mutex_lock (&priv->mutex);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2018-05-02 15:11:58 +00:00
|
|
|
priv->wait_status |= STREAM_WAITING;
|
2017-08-24 09:02:31 +00:00
|
|
|
g_cond_wait (&priv->cond, &priv->mutex);
|
2018-05-02 15:11:58 +00:00
|
|
|
priv->wait_status &= ~STREAM_WAITING;
|
2018-05-02 15:39:31 +00:00
|
|
|
|
|
|
|
if (priv->flushing)
|
|
|
|
break;
|
2018-01-31 20:19:47 +00:00
|
|
|
}
|
2017-08-24 09:02:31 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
|
|
|
ret = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
|
|
|
|
break;
|
|
|
|
}
|
2012-02-25 15:21:30 +00:00
|
|
|
case GST_QUERY_SEEKING:{
|
|
|
|
GstFormat fmt;
|
|
|
|
|
|
|
|
/* we don't supporting seeking */
|
|
|
|
gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
|
|
|
|
gst_query_set_seeking (query, fmt, FALSE, 0, -1);
|
|
|
|
ret = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
ret = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-03-11 00:48:26 +00:00
|
|
|
/* external API */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_app_sink_set_caps:
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
* @appsink: a #GstAppSink
|
2020-10-17 09:35:16 +00:00
|
|
|
* @caps: (nullable): caps to set
|
2007-03-11 00:48:26 +00:00
|
|
|
*
|
|
|
|
* Set the capabilities on the appsink element. This function takes
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
* a copy of the caps structure. After calling this method, the sink will only
|
2015-09-15 14:26:44 +00:00
|
|
|
* accept caps that match @caps. If @caps is non-fixed, or incomplete,
|
|
|
|
* you must check the caps on the samples to get the actual used caps.
|
2007-03-11 00:48:26 +00:00
|
|
|
*/
|
|
|
|
void
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
gst_app_sink_set_caps (GstAppSink * appsink, const GstCaps * caps)
|
2007-03-11 00:48:26 +00:00
|
|
|
{
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
GstCaps *old;
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSinkPrivate *priv;
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
|
2007-03-11 00:48:26 +00:00
|
|
|
g_return_if_fail (GST_IS_APP_SINK (appsink));
|
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
priv = appsink->priv;
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
GST_OBJECT_LOCK (appsink);
|
2007-09-12 08:38:21 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "setting caps to %" GST_PTR_FORMAT, caps);
|
2010-02-01 17:55:39 +00:00
|
|
|
if ((old = priv->caps) != caps) {
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
if (caps)
|
2010-02-01 17:55:39 +00:00
|
|
|
priv->caps = gst_caps_copy (caps);
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
else
|
2010-02-01 17:55:39 +00:00
|
|
|
priv->caps = NULL;
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
if (old)
|
|
|
|
gst_caps_unref (old);
|
|
|
|
}
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
GST_OBJECT_UNLOCK (appsink);
|
2007-03-11 00:48:26 +00:00
|
|
|
}
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
/**
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
* gst_app_sink_get_caps:
|
|
|
|
* @appsink: a #GstAppSink
|
|
|
|
*
|
|
|
|
* Get the configured caps on @appsink.
|
|
|
|
*
|
2022-10-14 19:08:07 +00:00
|
|
|
* Returns: (nullable) (transfer full): the #GstCaps accepted by the sink. gst_caps_unref() after usage.
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
*/
|
|
|
|
GstCaps *
|
|
|
|
gst_app_sink_get_caps (GstAppSink * appsink)
|
|
|
|
{
|
|
|
|
GstCaps *caps;
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSinkPrivate *priv;
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_APP_SINK (appsink), NULL);
|
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
priv = appsink->priv;
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
GST_OBJECT_LOCK (appsink);
|
2010-02-01 17:55:39 +00:00
|
|
|
if ((caps = priv->caps))
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
gst_caps_ref (caps);
|
|
|
|
GST_DEBUG_OBJECT (appsink, "getting caps of %" GST_PTR_FORMAT, caps);
|
|
|
|
GST_OBJECT_UNLOCK (appsink);
|
|
|
|
|
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_app_sink_is_eos:
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
* @appsink: a #GstAppSink
|
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* Check if @appsink is EOS, which is when no more samples can be pulled because
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
* an EOS event was received.
|
|
|
|
*
|
|
|
|
* This function also returns %TRUE when the appsink is not in the PAUSED or
|
|
|
|
* PLAYING state.
|
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* Returns: %TRUE if no more samples can be pulled and the appsink is EOS.
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
*/
|
2007-03-11 00:48:26 +00:00
|
|
|
gboolean
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
gst_app_sink_is_eos (GstAppSink * appsink)
|
2007-03-11 00:48:26 +00:00
|
|
|
{
|
|
|
|
gboolean ret;
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSinkPrivate *priv;
|
2007-03-11 00:48:26 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_APP_SINK (appsink), FALSE);
|
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
priv = appsink->priv;
|
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
2010-02-01 17:55:39 +00:00
|
|
|
if (!priv->started)
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
goto not_started;
|
|
|
|
|
2011-12-01 15:48:49 +00:00
|
|
|
if (priv->is_eos && priv->num_buffers == 0) {
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "we are EOS and the queue is empty");
|
2007-03-11 00:48:26 +00:00
|
|
|
ret = TRUE;
|
|
|
|
} else {
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "we are not yet EOS");
|
2007-03-11 00:48:26 +00:00
|
|
|
ret = FALSE;
|
|
|
|
}
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
2007-03-11 00:48:26 +00:00
|
|
|
|
|
|
|
return ret;
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
|
|
|
|
not_started:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (appsink, "we are stopped, return TRUE");
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2007-03-11 00:48:26 +00:00
|
|
|
}
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
/**
|
|
|
|
* gst_app_sink_set_emit_signals:
|
|
|
|
* @appsink: a #GstAppSink
|
|
|
|
* @emit: the new state
|
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* Make appsink emit the "new-preroll" and "new-sample" signals. This option is
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
* by default disabled because signal emission is expensive and unneeded when
|
|
|
|
* the application prefers to operate in pull mode.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_app_sink_set_emit_signals (GstAppSink * appsink, gboolean emit)
|
|
|
|
{
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSinkPrivate *priv;
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
g_return_if_fail (GST_IS_APP_SINK (appsink));
|
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
priv = appsink->priv;
|
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
2010-02-01 17:55:39 +00:00
|
|
|
priv->emit_signals = emit;
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_app_sink_get_emit_signals:
|
|
|
|
* @appsink: a #GstAppSink
|
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* Check if appsink will emit the "new-preroll" and "new-sample" signals.
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
*
|
2019-08-29 17:42:39 +00:00
|
|
|
* Returns: %TRUE if @appsink is emitting the "new-preroll" and "new-sample"
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
* signals.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_app_sink_get_emit_signals (GstAppSink * appsink)
|
|
|
|
{
|
|
|
|
gboolean result;
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSinkPrivate *priv;
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_APP_SINK (appsink), FALSE);
|
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
priv = appsink->priv;
|
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
2010-02-01 17:55:39 +00:00
|
|
|
result = priv->emit_signals;
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_app_sink_set_max_buffers:
|
|
|
|
* @appsink: a #GstAppSink
|
|
|
|
* @max: the maximum number of buffers to queue
|
|
|
|
*
|
|
|
|
* Set the maximum amount of buffers that can be queued in @appsink. After this
|
|
|
|
* amount of buffers are queued in appsink, any more buffers will block upstream
|
2011-12-01 15:48:49 +00:00
|
|
|
* elements until a sample is pulled from @appsink.
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_app_sink_set_max_buffers (GstAppSink * appsink, guint max)
|
|
|
|
{
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSinkPrivate *priv;
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
g_return_if_fail (GST_IS_APP_SINK (appsink));
|
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
priv = appsink->priv;
|
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
2010-02-01 17:55:39 +00:00
|
|
|
if (max != priv->max_buffers) {
|
|
|
|
priv->max_buffers = max;
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
/* signal the change */
|
2012-09-09 23:34:35 +00:00
|
|
|
g_cond_signal (&priv->cond);
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
}
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_app_sink_get_max_buffers:
|
|
|
|
* @appsink: a #GstAppSink
|
|
|
|
*
|
|
|
|
* Get the maximum amount of buffers that can be queued in @appsink.
|
|
|
|
*
|
|
|
|
* Returns: The maximum amount of buffers that can be queued.
|
|
|
|
*/
|
|
|
|
guint
|
|
|
|
gst_app_sink_get_max_buffers (GstAppSink * appsink)
|
|
|
|
{
|
|
|
|
guint result;
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSinkPrivate *priv;
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_APP_SINK (appsink), 0);
|
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
priv = appsink->priv;
|
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
2010-02-01 17:55:39 +00:00
|
|
|
result = priv->max_buffers;
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Add more docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_emit_signals), (gst_app_sink_get_emit_signals),
(gst_app_sink_set_max_buffers), (gst_app_sink_get_max_buffers),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add more docs.
Add signals for when preroll and render buffers are available.
Add property to control signal emission.
Add property to control the max queue size.
2008-04-25 18:18:47 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
/**
|
|
|
|
* gst_app_sink_set_drop:
|
|
|
|
* @appsink: a #GstAppSink
|
2009-01-05 23:04:57 +00:00
|
|
|
* @drop: the new state
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
*
|
|
|
|
* Instruct @appsink to drop old buffers when the maximum amount of queued
|
|
|
|
* buffers is reached.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_app_sink_set_drop (GstAppSink * appsink, gboolean drop)
|
|
|
|
{
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSinkPrivate *priv;
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
g_return_if_fail (GST_IS_APP_SINK (appsink));
|
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
priv = appsink->priv;
|
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
2010-02-01 17:55:39 +00:00
|
|
|
if (priv->drop != drop) {
|
|
|
|
priv->drop = drop;
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
/* signal the change */
|
2012-09-09 23:34:35 +00:00
|
|
|
g_cond_signal (&priv->cond);
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
}
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_app_sink_get_drop:
|
|
|
|
* @appsink: a #GstAppSink
|
|
|
|
*
|
|
|
|
* Check if @appsink will drop old buffers when the maximum amount of queued
|
|
|
|
* buffers is reached.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if @appsink is dropping old buffers when the queue is
|
|
|
|
* filled.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_app_sink_get_drop (GstAppSink * appsink)
|
|
|
|
{
|
|
|
|
gboolean result;
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSinkPrivate *priv;
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_APP_SINK (appsink), FALSE);
|
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
priv = appsink->priv;
|
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
2010-02-01 17:55:39 +00:00
|
|
|
result = priv->drop;
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Start some docs.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_class_init),
(gst_app_sink_init), (gst_app_sink_set_property),
(gst_app_sink_get_property), (gst_app_sink_unlock_start),
(gst_app_sink_unlock_stop), (gst_app_sink_flush_unlocked),
(gst_app_sink_start), (gst_app_sink_stop), (gst_app_sink_event),
(gst_app_sink_preroll), (gst_app_sink_render),
(gst_app_sink_set_caps), (gst_app_sink_set_drop),
(gst_app_sink_get_drop):
* gst-libs/gst/app/gstappsink.h:
Start some docs.
Add property to drop buffers when the queue is filled
Fix unlocking and flushing when the queues are filled.
2008-05-05 10:27:45 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2016-07-04 07:32:28 +00:00
|
|
|
/**
|
|
|
|
* gst_app_sink_set_buffer_list_support:
|
|
|
|
* @appsink: a #GstAppSink
|
2016-11-15 18:32:50 +00:00
|
|
|
* @enable_lists: enable or disable buffer list support
|
2016-07-04 07:32:28 +00:00
|
|
|
*
|
|
|
|
* Instruct @appsink to enable or disable buffer list support.
|
|
|
|
*
|
2016-11-15 18:32:50 +00:00
|
|
|
* For backwards-compatibility reasons applications need to opt in
|
|
|
|
* to indicate that they will be able to handle buffer lists.
|
|
|
|
*
|
|
|
|
* Since: 1.12
|
2016-07-04 07:32:28 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_app_sink_set_buffer_list_support (GstAppSink * appsink,
|
2016-11-15 18:32:50 +00:00
|
|
|
gboolean enable_lists)
|
2016-07-04 07:32:28 +00:00
|
|
|
{
|
|
|
|
GstAppSinkPrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_APP_SINK (appsink));
|
|
|
|
|
|
|
|
priv = appsink->priv;
|
|
|
|
|
|
|
|
g_mutex_lock (&priv->mutex);
|
2016-11-15 18:32:50 +00:00
|
|
|
if (priv->buffer_lists_supported != enable_lists) {
|
|
|
|
priv->buffer_lists_supported = enable_lists;
|
2016-07-04 07:32:28 +00:00
|
|
|
}
|
|
|
|
g_mutex_unlock (&priv->mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_app_sink_get_buffer_list_support:
|
|
|
|
* @appsink: a #GstAppSink
|
|
|
|
*
|
|
|
|
* Check if @appsink supports buffer lists.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if @appsink supports buffer lists.
|
|
|
|
*
|
2016-11-15 18:32:50 +00:00
|
|
|
* Since: 1.12
|
2016-07-04 07:32:28 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_app_sink_get_buffer_list_support (GstAppSink * appsink)
|
|
|
|
{
|
|
|
|
gboolean result;
|
|
|
|
GstAppSinkPrivate *priv;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_APP_SINK (appsink), FALSE);
|
|
|
|
|
|
|
|
priv = appsink->priv;
|
|
|
|
|
|
|
|
g_mutex_lock (&priv->mutex);
|
|
|
|
result = priv->buffer_lists_supported;
|
|
|
|
g_mutex_unlock (&priv->mutex);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2015-10-15 14:38:16 +00:00
|
|
|
/**
|
|
|
|
* gst_app_sink_set_wait_on_eos:
|
|
|
|
* @appsink: a #GstAppSink
|
|
|
|
* @wait: the new state
|
|
|
|
*
|
|
|
|
* Instruct @appsink to wait for all buffers to be consumed when an EOS is received.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_app_sink_set_wait_on_eos (GstAppSink * appsink, gboolean wait)
|
|
|
|
{
|
|
|
|
GstAppSinkPrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_APP_SINK (appsink));
|
|
|
|
|
|
|
|
priv = appsink->priv;
|
|
|
|
|
|
|
|
g_mutex_lock (&priv->mutex);
|
|
|
|
if (priv->wait_on_eos != wait) {
|
|
|
|
priv->wait_on_eos = wait;
|
|
|
|
/* signal the change */
|
|
|
|
g_cond_signal (&priv->cond);
|
|
|
|
}
|
|
|
|
g_mutex_unlock (&priv->mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_app_sink_get_wait_on_eos:
|
|
|
|
* @appsink: a #GstAppSink
|
|
|
|
*
|
|
|
|
* Check if @appsink will wait for all buffers to be consumed when an EOS is
|
|
|
|
* received.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if @appsink will wait for all buffers to be consumed when an
|
|
|
|
* EOS is received.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_app_sink_get_wait_on_eos (GstAppSink * appsink)
|
|
|
|
{
|
|
|
|
gboolean result;
|
|
|
|
GstAppSinkPrivate *priv;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_APP_SINK (appsink), FALSE);
|
|
|
|
|
|
|
|
priv = appsink->priv;
|
|
|
|
|
|
|
|
g_mutex_lock (&priv->mutex);
|
|
|
|
result = priv->wait_on_eos;
|
|
|
|
g_mutex_unlock (&priv->mutex);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
/**
|
|
|
|
* gst_app_sink_pull_preroll:
|
|
|
|
* @appsink: a #GstAppSink
|
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* Get the last preroll sample in @appsink. This was the sample that caused the
|
2017-08-29 08:47:51 +00:00
|
|
|
* appsink to preroll in the PAUSED state.
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
*
|
|
|
|
* This function is typically used when dealing with a pipeline in the PAUSED
|
2011-12-01 15:48:49 +00:00
|
|
|
* state. Calling this function after doing a seek will give the sample right
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
* after the seek position.
|
|
|
|
*
|
2017-08-29 08:47:51 +00:00
|
|
|
* Calling this function will clear the internal reference to the preroll
|
|
|
|
* buffer.
|
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* Note that the preroll sample will also be returned as the first sample
|
|
|
|
* when calling gst_app_sink_pull_sample().
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
*
|
gst-libs/gst/app/gstappsink.*: Add properties, signals and actions to access the element even without linking to the ...
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_marshal_OBJECT__VOID),
(gst_app_sink_class_init), (gst_app_sink_init),
(gst_app_sink_dispose), (gst_app_sink_finalize),
(gst_app_sink_set_property), (gst_app_sink_get_property),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_event), (gst_app_sink_getcaps),
(gst_app_sink_set_caps), (gst_app_sink_get_caps),
(gst_app_sink_is_eos), (gst_app_sink_pull_preroll),
(gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Add properties, signals and actions to access the element even without
linking to the library.
Fix some method names and signatures.
2007-09-20 13:59:50 +00:00
|
|
|
* If an EOS event was received before any buffers, this function returns
|
2011-05-23 12:02:27 +00:00
|
|
|
* %NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* This function blocks until a preroll sample or EOS is received or the appsink
|
2011-05-23 12:02:27 +00:00
|
|
|
* element is set to the READY/NULL state.
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
*
|
2021-06-15 20:22:55 +00:00
|
|
|
* Returns: (transfer full) (nullable): a #GstSample or NULL when the appsink is stopped or EOS.
|
2014-10-20 13:31:29 +00:00
|
|
|
* Call gst_sample_unref() after usage.
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
*/
|
2011-12-01 15:48:49 +00:00
|
|
|
GstSample *
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
gst_app_sink_pull_preroll (GstAppSink * appsink)
|
|
|
|
{
|
2016-07-15 11:20:29 +00:00
|
|
|
return gst_app_sink_try_pull_preroll (appsink, GST_CLOCK_TIME_NONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_app_sink_pull_sample:
|
|
|
|
* @appsink: a #GstAppSink
|
|
|
|
*
|
|
|
|
* This function blocks until a sample or EOS becomes available or the appsink
|
|
|
|
* element is set to the READY/NULL state.
|
|
|
|
*
|
|
|
|
* This function will only return samples when the appsink is in the PLAYING
|
|
|
|
* state. All rendered buffers will be put in a queue so that the application
|
|
|
|
* can pull samples at its own rate. Note that when the application does not
|
|
|
|
* pull samples fast enough, the queued buffers could consume a lot of memory,
|
|
|
|
* especially when dealing with raw video frames.
|
|
|
|
*
|
|
|
|
* If an EOS event was received before any buffers, this function returns
|
|
|
|
* %NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
|
|
|
|
*
|
2021-06-15 20:22:55 +00:00
|
|
|
* Returns: (transfer full) (nullable): a #GstSample or NULL when the appsink is stopped or EOS.
|
2016-07-15 11:20:29 +00:00
|
|
|
* Call gst_sample_unref() after usage.
|
|
|
|
*/
|
|
|
|
GstSample *
|
|
|
|
gst_app_sink_pull_sample (GstAppSink * appsink)
|
|
|
|
{
|
|
|
|
return gst_app_sink_try_pull_sample (appsink, GST_CLOCK_TIME_NONE);
|
|
|
|
}
|
|
|
|
|
2021-02-19 12:32:48 +00:00
|
|
|
/**
|
|
|
|
* gst_app_sink_pull_object: (skip)
|
|
|
|
* @appsink: a #GstAppSink
|
|
|
|
*
|
|
|
|
* This function blocks until a sample or an event becomes available or the appsink
|
|
|
|
* element is set to the READY/NULL state.
|
|
|
|
*
|
|
|
|
* This function will only return samples when the appsink is in the PLAYING
|
|
|
|
* state. All rendered buffers and events will be put in a queue so that the application
|
|
|
|
* can pull them at its own rate. Note that when the application does not
|
|
|
|
* pull samples fast enough, the queued buffers could consume a lot of memory,
|
|
|
|
* especially when dealing with raw video frames.
|
|
|
|
* Events can be pulled when the appsink is in the READY, PAUSED or PLAYING state.
|
|
|
|
*
|
|
|
|
* This function will only pull serialized events, excluding
|
|
|
|
* the EOS event for which this functions returns
|
|
|
|
* %NULL. Use gst_app_sink_is_eos() to check for the EOS condition.
|
|
|
|
*
|
|
|
|
* This method is a variant of gst_app_sink_pull_sample() that can be used
|
|
|
|
* to handle incoming events events as well as samples.
|
|
|
|
*
|
|
|
|
* Note that future releases may extend this API to return other object types
|
|
|
|
* so make sure that your code is checking for the actual type it is handling.
|
|
|
|
*
|
2022-10-14 19:08:07 +00:00
|
|
|
* Returns: (transfer full) (nullable): a #GstSample, or a #GstEvent or NULL when the appsink is stopped or EOS.
|
2021-02-19 12:32:48 +00:00
|
|
|
* Call gst_mini_object_unref() after usage.
|
|
|
|
*
|
|
|
|
* Since: 1.20
|
|
|
|
*/
|
|
|
|
GstMiniObject *
|
|
|
|
gst_app_sink_pull_object (GstAppSink * appsink)
|
|
|
|
{
|
|
|
|
return gst_app_sink_try_pull_object (appsink, GST_CLOCK_TIME_NONE);
|
|
|
|
}
|
|
|
|
|
2016-07-15 11:20:29 +00:00
|
|
|
/**
|
|
|
|
* gst_app_sink_try_pull_preroll:
|
|
|
|
* @appsink: a #GstAppSink
|
|
|
|
* @timeout: the maximum amount of time to wait for the preroll sample
|
|
|
|
*
|
|
|
|
* Get the last preroll sample in @appsink. This was the sample that caused the
|
2017-08-29 08:47:51 +00:00
|
|
|
* appsink to preroll in the PAUSED state.
|
2016-07-15 11:20:29 +00:00
|
|
|
*
|
|
|
|
* This function is typically used when dealing with a pipeline in the PAUSED
|
|
|
|
* state. Calling this function after doing a seek will give the sample right
|
|
|
|
* after the seek position.
|
|
|
|
*
|
2017-08-29 08:47:51 +00:00
|
|
|
* Calling this function will clear the internal reference to the preroll
|
|
|
|
* buffer.
|
|
|
|
*
|
2016-07-15 11:20:29 +00:00
|
|
|
* Note that the preroll sample will also be returned as the first sample
|
|
|
|
* when calling gst_app_sink_pull_sample().
|
|
|
|
*
|
|
|
|
* If an EOS event was received before any buffers or the timeout expires,
|
|
|
|
* this function returns %NULL. Use gst_app_sink_is_eos () to check for the EOS
|
|
|
|
* condition.
|
|
|
|
*
|
|
|
|
* This function blocks until a preroll sample or EOS is received, the appsink
|
|
|
|
* element is set to the READY/NULL state, or the timeout expires.
|
|
|
|
*
|
2021-06-15 20:22:55 +00:00
|
|
|
* Returns: (transfer full) (nullable): a #GstSample or NULL when the appsink is stopped or EOS or the timeout expires.
|
2016-07-15 11:20:29 +00:00
|
|
|
* Call gst_sample_unref() after usage.
|
|
|
|
*
|
|
|
|
* Since: 1.10
|
|
|
|
*/
|
|
|
|
GstSample *
|
|
|
|
gst_app_sink_try_pull_preroll (GstAppSink * appsink, GstClockTime timeout)
|
|
|
|
{
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSinkPrivate *priv;
|
2016-07-15 11:20:29 +00:00
|
|
|
GstSample *sample = NULL;
|
|
|
|
gboolean timeout_valid;
|
|
|
|
gint64 end_time;
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_APP_SINK (appsink), NULL);
|
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
priv = appsink->priv;
|
|
|
|
|
2016-07-15 11:20:29 +00:00
|
|
|
timeout_valid = GST_CLOCK_TIME_IS_VALID (timeout);
|
|
|
|
|
|
|
|
if (timeout_valid)
|
|
|
|
end_time =
|
|
|
|
g_get_monotonic_time () + timeout / (GST_SECOND / G_TIME_SPAN_SECOND);
|
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
|
|
|
|
while (TRUE) {
|
|
|
|
GST_DEBUG_OBJECT (appsink, "trying to grab a buffer");
|
2010-02-01 17:55:39 +00:00
|
|
|
if (!priv->started)
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
goto not_started;
|
|
|
|
|
2017-09-13 13:06:43 +00:00
|
|
|
if (priv->preroll_buffer != NULL)
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
break;
|
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
if (priv->is_eos)
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
goto eos;
|
|
|
|
|
|
|
|
/* nothing to return, wait */
|
|
|
|
GST_DEBUG_OBJECT (appsink, "waiting for the preroll buffer");
|
2018-05-02 15:11:58 +00:00
|
|
|
priv->wait_status |= APP_WAITING;
|
2016-07-15 11:20:29 +00:00
|
|
|
if (timeout_valid) {
|
|
|
|
if (!g_cond_wait_until (&priv->cond, &priv->mutex, end_time))
|
|
|
|
goto expired;
|
|
|
|
} else {
|
|
|
|
g_cond_wait (&priv->cond, &priv->mutex);
|
|
|
|
}
|
2018-05-02 15:11:58 +00:00
|
|
|
priv->wait_status &= ~APP_WAITING;
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
}
|
2011-12-01 15:48:49 +00:00
|
|
|
sample =
|
2017-09-13 13:06:43 +00:00
|
|
|
gst_sample_new (priv->preroll_buffer, priv->preroll_caps,
|
|
|
|
&priv->preroll_segment, NULL);
|
2017-08-29 08:47:51 +00:00
|
|
|
gst_buffer_replace (&priv->preroll_buffer, NULL);
|
2011-12-01 15:48:49 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "we have the preroll sample %p", sample);
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
|
2011-12-01 15:48:49 +00:00
|
|
|
return sample;
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
|
|
|
|
/* special conditions */
|
2016-07-15 11:20:29 +00:00
|
|
|
expired:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (appsink, "timeout expired, return NULL");
|
2018-05-02 15:11:58 +00:00
|
|
|
priv->wait_status &= ~APP_WAITING;
|
2016-07-15 11:20:29 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
|
|
|
return NULL;
|
|
|
|
}
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
eos:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (appsink, "we are EOS, return NULL");
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
not_started:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (appsink, "we are stopped, return NULL");
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-07-15 11:20:29 +00:00
|
|
|
* gst_app_sink_try_pull_sample:
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
* @appsink: a #GstAppSink
|
2016-07-15 11:20:29 +00:00
|
|
|
* @timeout: the maximum amount of time to wait for a sample
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* This function blocks until a sample or EOS becomes available or the appsink
|
2016-07-15 11:20:29 +00:00
|
|
|
* element is set to the READY/NULL state or the timeout expires.
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* This function will only return samples when the appsink is in the PLAYING
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
* state. All rendered buffers will be put in a queue so that the application
|
2011-12-01 15:48:49 +00:00
|
|
|
* can pull samples at its own rate. Note that when the application does not
|
|
|
|
* pull samples fast enough, the queued buffers could consume a lot of memory,
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
* especially when dealing with raw video frames.
|
|
|
|
*
|
2016-07-15 11:20:29 +00:00
|
|
|
* If an EOS event was received before any buffers or the timeout expires,
|
|
|
|
* this function returns %NULL. Use gst_app_sink_is_eos () to check for the EOS
|
|
|
|
* condition.
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
*
|
2021-06-15 20:22:55 +00:00
|
|
|
* Returns: (transfer full) (nullable): a #GstSample or NULL when the appsink is stopped or EOS or the timeout expires.
|
|
|
|
* Call gst_sample_unref() after usage.
|
2016-07-15 11:20:29 +00:00
|
|
|
*
|
|
|
|
* Since: 1.10
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
*/
|
2011-12-01 15:48:49 +00:00
|
|
|
GstSample *
|
2016-07-15 11:20:29 +00:00
|
|
|
gst_app_sink_try_pull_sample (GstAppSink * appsink, GstClockTime timeout)
|
2021-02-19 12:32:48 +00:00
|
|
|
{
|
|
|
|
while (TRUE) {
|
|
|
|
GstMiniObject *obj;
|
|
|
|
|
|
|
|
obj = gst_app_sink_try_pull_object (appsink, timeout);
|
|
|
|
|
|
|
|
if (!obj) {
|
|
|
|
return NULL;
|
|
|
|
} else if (GST_IS_SAMPLE (obj)) {
|
|
|
|
return GST_SAMPLE_CAST (obj);
|
|
|
|
} else {
|
|
|
|
gst_mini_object_unref (obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_app_sink_try_pull_object: (skip)
|
|
|
|
* @appsink: a #GstAppSink
|
|
|
|
* @timeout: the maximum amount of time to wait for a sample
|
|
|
|
*
|
|
|
|
* This function blocks until a sample or an event or EOS becomes available or the appsink
|
|
|
|
* element is set to the READY/NULL state or the timeout expires.
|
|
|
|
*
|
|
|
|
* This function will only return samples when the appsink is in the PLAYING
|
|
|
|
* state. All rendered buffers and events will be put in a queue so that the application
|
|
|
|
* can pull them at its own rate. Note that when the application does not
|
|
|
|
* pull samples fast enough, the queued buffers could consume a lot of memory,
|
|
|
|
* especially when dealing with raw video frames.
|
|
|
|
* Events can be pulled when the appsink is in the READY, PAUSED or PLAYING state.
|
|
|
|
*
|
|
|
|
* This function will only pull serialized events, excluding
|
|
|
|
* the EOS event for which this functions returns
|
|
|
|
* %NULL. Use gst_app_sink_is_eos() to check for the EOS condition.
|
|
|
|
*
|
|
|
|
* This method is a variant of gst_app_sink_try_pull_sample() that can be used
|
|
|
|
* to handle incoming events events as well as samples.
|
|
|
|
*
|
|
|
|
* Note that future releases may extend this API to return other object types
|
|
|
|
* so make sure that your code is checking for the actual type it is handling.
|
|
|
|
*
|
2022-10-14 19:08:07 +00:00
|
|
|
* Returns: (transfer full) (nullable): a #GstSample, or #GstEvent or NULL when the appsink is stopped or EOS or the timeout expires.
|
2021-02-19 12:32:48 +00:00
|
|
|
* Call gst_mini_object_unref() after usage.
|
|
|
|
*
|
|
|
|
* Since: 1.20
|
|
|
|
*/
|
|
|
|
GstMiniObject *
|
|
|
|
gst_app_sink_try_pull_object (GstAppSink * appsink, GstClockTime timeout)
|
2007-03-11 00:48:26 +00:00
|
|
|
{
|
2016-07-15 11:20:29 +00:00
|
|
|
GstAppSinkPrivate *priv;
|
2021-02-19 12:32:48 +00:00
|
|
|
GstMiniObject *obj = NULL, *ret;
|
2016-07-15 11:20:29 +00:00
|
|
|
gboolean timeout_valid;
|
|
|
|
gint64 end_time;
|
gst-libs/gst/app/gstappsink.*: Make love to appsink.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_base_init),
(gst_app_sink_class_init), (gst_app_sink_dispose),
(gst_app_sink_flush_unlocked), (gst_app_sink_start),
(gst_app_sink_stop), (gst_app_sink_event), (gst_app_sink_preroll),
(gst_app_sink_render), (gst_app_sink_get_caps),
(gst_app_sink_set_caps), (gst_app_sink_end_of_stream),
(gst_app_sink_pull_preroll), (gst_app_sink_pull_buffer):
* gst-libs/gst/app/gstappsink.h:
Make love to appsink.
Make it support pulling of the preroll buffer.
Add docs and debug statements.
Fix some races wrt to EOS handling and stopping.
Implement getcaps.
Implement FLUSHING.
API: gst_app_sink_pull_preroll()
2007-08-14 17:38:05 +00:00
|
|
|
|
2011-12-01 15:48:49 +00:00
|
|
|
g_return_val_if_fail (GST_IS_APP_SINK (appsink), NULL);
|
|
|
|
|
2016-07-15 11:20:29 +00:00
|
|
|
timeout_valid = GST_CLOCK_TIME_IS_VALID (timeout);
|
|
|
|
|
|
|
|
if (timeout_valid)
|
|
|
|
end_time =
|
|
|
|
g_get_monotonic_time () + timeout / (GST_SECOND / G_TIME_SPAN_SECOND);
|
|
|
|
|
2011-12-01 15:48:49 +00:00
|
|
|
priv = appsink->priv;
|
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
2017-09-18 16:06:32 +00:00
|
|
|
gst_buffer_replace (&priv->preroll_buffer, NULL);
|
2011-12-01 15:48:49 +00:00
|
|
|
|
|
|
|
while (TRUE) {
|
2021-02-19 12:32:48 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "trying to grab an object");
|
2011-12-01 15:48:49 +00:00
|
|
|
if (!priv->started)
|
|
|
|
goto not_started;
|
|
|
|
|
2021-02-19 12:32:48 +00:00
|
|
|
if (priv->num_buffers > 0 || priv->num_events > 0)
|
2011-12-01 15:48:49 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
if (priv->is_eos)
|
|
|
|
goto eos;
|
|
|
|
|
|
|
|
/* nothing to return, wait */
|
2021-02-19 12:32:48 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "waiting for an object");
|
2018-05-02 15:11:58 +00:00
|
|
|
priv->wait_status |= APP_WAITING;
|
2016-07-15 11:20:29 +00:00
|
|
|
if (timeout_valid) {
|
|
|
|
if (!g_cond_wait_until (&priv->cond, &priv->mutex, end_time))
|
|
|
|
goto expired;
|
|
|
|
} else {
|
|
|
|
g_cond_wait (&priv->cond, &priv->mutex);
|
|
|
|
}
|
2018-05-02 15:11:58 +00:00
|
|
|
priv->wait_status &= ~APP_WAITING;
|
2011-12-01 15:48:49 +00:00
|
|
|
}
|
2016-07-04 07:32:28 +00:00
|
|
|
|
2021-02-19 12:32:48 +00:00
|
|
|
obj = dequeue_object (appsink);
|
|
|
|
|
|
|
|
/* convert buffer and buffer list to sample */
|
2016-07-04 07:32:28 +00:00
|
|
|
if (GST_IS_BUFFER (obj)) {
|
|
|
|
GST_DEBUG_OBJECT (appsink, "we have a buffer %p", obj);
|
2018-04-10 22:57:43 +00:00
|
|
|
priv->sample = gst_sample_make_writable (priv->sample);
|
|
|
|
gst_sample_set_buffer_list (priv->sample, NULL);
|
|
|
|
gst_sample_set_buffer (priv->sample, GST_BUFFER_CAST (obj));
|
2021-02-19 12:32:48 +00:00
|
|
|
ret = GST_MINI_OBJECT_CAST (gst_sample_ref (priv->sample));
|
|
|
|
gst_mini_object_unref (obj);
|
|
|
|
} else if (GST_IS_BUFFER_LIST (obj)) {
|
2016-07-04 07:32:28 +00:00
|
|
|
GST_DEBUG_OBJECT (appsink, "we have a list %p", obj);
|
2018-04-10 22:57:43 +00:00
|
|
|
priv->sample = gst_sample_make_writable (priv->sample);
|
|
|
|
gst_sample_set_buffer (priv->sample, NULL);
|
|
|
|
gst_sample_set_buffer_list (priv->sample, GST_BUFFER_LIST_CAST (obj));
|
2021-02-19 12:32:48 +00:00
|
|
|
ret = GST_MINI_OBJECT_CAST (gst_sample_ref (priv->sample));
|
|
|
|
gst_mini_object_unref (obj);
|
|
|
|
} else {
|
|
|
|
ret = obj;
|
2016-07-04 07:32:28 +00:00
|
|
|
}
|
2011-12-01 15:48:49 +00:00
|
|
|
|
2018-05-02 15:11:58 +00:00
|
|
|
if ((priv->wait_status & STREAM_WAITING))
|
2018-01-31 20:19:47 +00:00
|
|
|
g_cond_signal (&priv->cond);
|
|
|
|
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
2011-12-01 15:48:49 +00:00
|
|
|
|
2021-02-19 12:32:48 +00:00
|
|
|
return ret;
|
2011-12-01 15:48:49 +00:00
|
|
|
|
|
|
|
/* special conditions */
|
2016-07-15 11:20:29 +00:00
|
|
|
expired:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (appsink, "timeout expired, return NULL");
|
2018-05-02 15:11:58 +00:00
|
|
|
priv->wait_status &= ~APP_WAITING;
|
2016-07-15 11:20:29 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
|
|
|
return NULL;
|
|
|
|
}
|
2011-12-01 15:48:49 +00:00
|
|
|
eos:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (appsink, "we are EOS, return NULL");
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
2011-12-01 15:48:49 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
not_started:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (appsink, "we are stopped, return NULL");
|
2012-09-09 23:34:35 +00:00
|
|
|
g_mutex_unlock (&priv->mutex);
|
2011-12-01 15:48:49 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2007-03-11 00:48:26 +00:00
|
|
|
}
|
2009-02-19 09:44:31 +00:00
|
|
|
|
|
|
|
/**
|
2012-06-29 22:46:46 +00:00
|
|
|
* gst_app_sink_set_callbacks: (skip)
|
2009-02-19 09:44:31 +00:00
|
|
|
* @appsink: a #GstAppSink
|
|
|
|
* @callbacks: the callbacks
|
|
|
|
* @user_data: a user_data argument for the callbacks
|
|
|
|
* @notify: a destroy notify function
|
|
|
|
*
|
2011-12-01 15:48:49 +00:00
|
|
|
* Set callbacks which will be executed for each new preroll, new sample and eos.
|
2009-02-19 09:44:31 +00:00
|
|
|
* This is an alternative to using the signals, it has lower overhead and is thus
|
|
|
|
* less expensive, but also less flexible.
|
|
|
|
*
|
2011-09-13 19:10:43 +00:00
|
|
|
* If callbacks are installed, no signals will be emitted for performance
|
2009-02-26 15:44:53 +00:00
|
|
|
* reasons.
|
2020-02-12 11:11:43 +00:00
|
|
|
*
|
|
|
|
* Before 1.16.3 it was not possible to change the callbacks in a thread-safe
|
|
|
|
* way.
|
2009-02-19 09:44:31 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_app_sink_set_callbacks (GstAppSink * appsink,
|
|
|
|
GstAppSinkCallbacks * callbacks, gpointer user_data, GDestroyNotify notify)
|
|
|
|
{
|
2020-02-12 11:11:43 +00:00
|
|
|
Callbacks *old_callbacks, *new_callbacks = NULL;
|
2010-02-01 17:55:39 +00:00
|
|
|
GstAppSinkPrivate *priv;
|
2009-02-19 09:44:31 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_APP_SINK (appsink));
|
|
|
|
g_return_if_fail (callbacks != NULL);
|
|
|
|
|
2010-02-01 17:55:39 +00:00
|
|
|
priv = appsink->priv;
|
|
|
|
|
2020-02-12 11:11:43 +00:00
|
|
|
if (callbacks) {
|
|
|
|
new_callbacks = g_new0 (Callbacks, 1);
|
|
|
|
new_callbacks->callbacks = *callbacks;
|
|
|
|
new_callbacks->user_data = user_data;
|
|
|
|
new_callbacks->destroy_notify = notify;
|
|
|
|
new_callbacks->ref_count = 1;
|
|
|
|
}
|
2009-02-19 09:44:31 +00:00
|
|
|
|
2020-02-12 11:11:43 +00:00
|
|
|
g_mutex_lock (&priv->mutex);
|
|
|
|
old_callbacks = g_steal_pointer (&priv->callbacks);
|
|
|
|
priv->callbacks = g_steal_pointer (&new_callbacks);
|
|
|
|
g_mutex_unlock (&priv->mutex);
|
2009-02-19 09:44:31 +00:00
|
|
|
|
2020-02-12 11:11:43 +00:00
|
|
|
g_clear_pointer (&old_callbacks, callbacks_unref);
|
2009-02-19 09:44:31 +00:00
|
|
|
}
|
2009-02-26 15:44:53 +00:00
|
|
|
|
|
|
|
/*** GSTURIHANDLER INTERFACE *************************************************/
|
|
|
|
|
|
|
|
static GstURIType
|
2011-06-22 14:38:48 +00:00
|
|
|
gst_app_sink_uri_get_type (GType type)
|
2009-02-26 15:44:53 +00:00
|
|
|
{
|
|
|
|
return GST_URI_SINK;
|
|
|
|
}
|
|
|
|
|
2011-11-13 23:44:23 +00:00
|
|
|
static const gchar *const *
|
2011-06-22 14:38:48 +00:00
|
|
|
gst_app_sink_uri_get_protocols (GType type)
|
2009-02-26 15:44:53 +00:00
|
|
|
{
|
2011-11-13 23:44:23 +00:00
|
|
|
static const gchar *protocols[] = { "appsink", NULL };
|
2009-02-26 15:44:53 +00:00
|
|
|
|
|
|
|
return protocols;
|
|
|
|
}
|
|
|
|
|
2011-11-13 18:22:06 +00:00
|
|
|
static gchar *
|
2009-02-26 15:44:53 +00:00
|
|
|
gst_app_sink_uri_get_uri (GstURIHandler * handler)
|
|
|
|
{
|
2011-11-13 18:22:06 +00:00
|
|
|
return g_strdup ("appsink");
|
2009-02-26 15:44:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-11-13 18:22:06 +00:00
|
|
|
gst_app_sink_uri_set_uri (GstURIHandler * handler, const gchar * uri,
|
|
|
|
GError ** error)
|
2009-02-26 15:44:53 +00:00
|
|
|
{
|
2011-11-13 18:22:06 +00:00
|
|
|
/* GstURIHandler checks the protocol for us */
|
|
|
|
return TRUE;
|
2009-02-26 15:44:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_app_sink_uri_handler_init (gpointer g_iface, gpointer iface_data)
|
|
|
|
{
|
|
|
|
GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
|
|
|
|
|
|
|
|
iface->get_type = gst_app_sink_uri_get_type;
|
|
|
|
iface->get_protocols = gst_app_sink_uri_get_protocols;
|
|
|
|
iface->get_uri = gst_app_sink_uri_get_uri;
|
|
|
|
iface->set_uri = gst_app_sink_uri_set_uri;
|
2011-11-13 23:44:23 +00:00
|
|
|
|
2009-02-26 15:44:53 +00:00
|
|
|
}
|
2023-03-16 06:38:56 +00:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_app_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|
|
|
{
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
GstAppSink *appsink = GST_APP_SINK_CAST (bsink);
|
|
|
|
GstAppSinkPrivate *priv = appsink->priv;
|
|
|
|
Callbacks *callbacks = NULL;
|
|
|
|
gboolean emit;
|
|
|
|
|
|
|
|
g_mutex_lock (&priv->mutex);
|
|
|
|
emit = priv->emit_signals;
|
|
|
|
if (priv->callbacks)
|
|
|
|
callbacks = callbacks_ref (priv->callbacks);
|
|
|
|
g_mutex_unlock (&priv->mutex);
|
|
|
|
|
|
|
|
if (callbacks && callbacks->callbacks.propose_allocation) {
|
|
|
|
ret =
|
|
|
|
callbacks->callbacks.propose_allocation (appsink, query,
|
|
|
|
callbacks->user_data);
|
|
|
|
} else if (emit) {
|
|
|
|
g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_PROPOSE_ALLOCATION], 0,
|
|
|
|
query, &ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_clear_pointer (&callbacks, callbacks_unref);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|