2005-03-28 14:54:33 +00:00
|
|
|
/* GStreamer
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
* Copyright (C) 2005-2007 Wim Taymans <wim.taymans@gmail.com>
|
2005-03-28 14:54:33 +00:00
|
|
|
*
|
2005-11-09 10:06:30 +00:00
|
|
|
* gstbasesink.c: Base class for sink elements
|
2005-03-28 14:54:33 +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 20:44:48 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2005-03-28 14:54:33 +00:00
|
|
|
*/
|
|
|
|
|
2005-08-03 13:30:18 +00:00
|
|
|
/**
|
2012-09-24 14:31:34 +00:00
|
|
|
* SECTION:gstbasesink
|
2005-08-03 13:30:18 +00:00
|
|
|
* @short_description: Base class for sink elements
|
2009-11-27 14:39:37 +00:00
|
|
|
* @see_also: #GstBaseTransform, #GstBaseSrc
|
2005-08-03 13:30:18 +00:00
|
|
|
*
|
libs/gst/: Documentation updates.
Original commit message from CVS:
* libs/gst/base/gstadapter.c:
* libs/gst/base/gstadapter.h:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_position):
* libs/gst/base/gstbasesink.h:
* libs/gst/base/gstbasesrc.c: (gst_base_src_class_init),
(gst_base_src_default_query), (gst_base_src_default_do_seek),
(gst_base_src_do_seek), (gst_base_src_perform_seek),
(gst_base_src_send_event), (gst_base_src_update_length),
(gst_base_src_get_range), (gst_base_src_loop),
(gst_base_src_start):
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasetransform.h:
* libs/gst/base/gstcollectpads.h:
* libs/gst/base/gstpushsrc.c:
* libs/gst/base/gstpushsrc.h:
* libs/gst/dataprotocol/dataprotocol.c:
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.h:
Documentation updates.
2005-12-18 16:04:41 +00:00
|
|
|
* #GstBaseSink is the base class for sink elements in GStreamer, such as
|
2005-11-09 10:06:30 +00:00
|
|
|
* xvimagesink or filesink. It is a layer on top of #GstElement that provides a
|
2006-05-03 16:42:08 +00:00
|
|
|
* simplified interface to plugin writers. #GstBaseSink handles many details
|
|
|
|
* for you, for example: preroll, clock synchronization, state changes,
|
|
|
|
* activation in push or pull mode, and queries.
|
|
|
|
*
|
|
|
|
* In most cases, when writing sink elements, there is no need to implement
|
|
|
|
* class methods from #GstElement or to set functions on pads, because the
|
2006-04-04 14:58:50 +00:00
|
|
|
* #GstBaseSink infrastructure should be sufficient.
|
|
|
|
*
|
2006-05-03 16:42:08 +00:00
|
|
|
* #GstBaseSink provides support for exactly one sink pad, which should be
|
2006-09-27 13:19:55 +00:00
|
|
|
* named "sink". A sink implementation (subclass of #GstBaseSink) should
|
2011-04-16 13:24:01 +00:00
|
|
|
* install a pad template in its class_init function, like so:
|
2014-06-05 20:27:28 +00:00
|
|
|
* |[<!-- language="C" -->
|
2005-11-09 10:06:30 +00:00
|
|
|
* static void
|
2011-04-16 13:24:01 +00:00
|
|
|
* my_element_class_init (GstMyElementClass *klass)
|
2005-11-09 10:06:30 +00:00
|
|
|
* {
|
2011-04-16 13:24:01 +00:00
|
|
|
* GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
2009-08-24 15:56:32 +00:00
|
|
|
*
|
2005-11-09 10:06:30 +00:00
|
|
|
* // sinktemplate should be a #GstStaticPadTemplate with direction
|
2014-06-05 19:38:20 +00:00
|
|
|
* // %GST_PAD_SINK and name "sink"
|
2016-03-03 05:15:00 +00:00
|
|
|
* gst_element_class_add_static_pad_template (gstelement_class, &sinktemplate);
|
2012-09-26 14:26:48 +00:00
|
|
|
*
|
|
|
|
* gst_element_class_set_static_metadata (gstelement_class,
|
|
|
|
* "Sink name",
|
|
|
|
* "Sink",
|
|
|
|
* "My Sink element",
|
2012-09-26 22:32:35 +00:00
|
|
|
* "The author <my.sink@my.email>");
|
2005-11-09 10:06:30 +00:00
|
|
|
* }
|
2009-11-27 14:39:37 +00:00
|
|
|
* ]|
|
2005-11-09 10:06:30 +00:00
|
|
|
*
|
libs/gst/: Documentation updates.
Original commit message from CVS:
* libs/gst/base/gstadapter.c:
* libs/gst/base/gstadapter.h:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_position):
* libs/gst/base/gstbasesink.h:
* libs/gst/base/gstbasesrc.c: (gst_base_src_class_init),
(gst_base_src_default_query), (gst_base_src_default_do_seek),
(gst_base_src_do_seek), (gst_base_src_perform_seek),
(gst_base_src_send_event), (gst_base_src_update_length),
(gst_base_src_get_range), (gst_base_src_loop),
(gst_base_src_start):
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasetransform.h:
* libs/gst/base/gstcollectpads.h:
* libs/gst/base/gstpushsrc.c:
* libs/gst/base/gstpushsrc.h:
* libs/gst/dataprotocol/dataprotocol.c:
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.h:
Documentation updates.
2005-12-18 16:04:41 +00:00
|
|
|
* #GstBaseSink will handle the prerolling correctly. This means that it will
|
2014-06-05 19:38:20 +00:00
|
|
|
* return %GST_STATE_CHANGE_ASYNC from a state change to PAUSED until the first
|
2006-05-03 16:42:08 +00:00
|
|
|
* buffer arrives in this element. The base class will call the
|
2009-11-27 14:39:37 +00:00
|
|
|
* #GstBaseSinkClass.preroll() vmethod with this preroll buffer and will then
|
|
|
|
* commit the state change to the next asynchronously pending state.
|
2005-11-09 10:06:30 +00:00
|
|
|
*
|
2006-05-03 16:42:08 +00:00
|
|
|
* When the element is set to PLAYING, #GstBaseSink will synchronise on the
|
2009-11-27 14:39:37 +00:00
|
|
|
* clock using the times returned from #GstBaseSinkClass.get_times(). If this
|
2014-06-05 19:38:20 +00:00
|
|
|
* function returns %GST_CLOCK_TIME_NONE for the start time, no synchronisation
|
2009-11-27 14:39:37 +00:00
|
|
|
* will be done. Synchronisation can be disabled entirely by setting the object
|
|
|
|
* #GstBaseSink:sync property to %FALSE.
|
2005-11-09 10:06:30 +00:00
|
|
|
*
|
2009-11-27 14:39:37 +00:00
|
|
|
* After synchronisation the virtual method #GstBaseSinkClass.render() will be
|
|
|
|
* called. Subclasses should minimally implement this method.
|
2005-11-09 10:06:30 +00:00
|
|
|
*
|
2012-07-10 09:46:41 +00:00
|
|
|
* Subclasses that synchronise on the clock in the #GstBaseSinkClass.render()
|
|
|
|
* method are supported as well. These classes typically receive a buffer in
|
|
|
|
* the render method and can then potentially block on the clock while
|
|
|
|
* rendering. A typical example is an audiosink.
|
|
|
|
* These subclasses can use gst_base_sink_wait_preroll() to perform the
|
|
|
|
* blocking wait.
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
*
|
2006-05-03 16:42:08 +00:00
|
|
|
* Upon receiving the EOS event in the PLAYING state, #GstBaseSink will wait
|
|
|
|
* for the clock to reach the time indicated by the stop time of the last
|
2009-11-27 14:39:37 +00:00
|
|
|
* #GstBaseSinkClass.get_times() call before posting an EOS message. When the
|
|
|
|
* element receives EOS in PAUSED, preroll completes, the event is queued and an
|
|
|
|
* EOS message is posted when going to PLAYING.
|
2006-05-03 16:42:08 +00:00
|
|
|
*
|
2014-06-05 19:38:20 +00:00
|
|
|
* #GstBaseSink will internally use the %GST_EVENT_SEGMENT events to schedule
|
libs/gst/: Documentation updates.
Original commit message from CVS:
* libs/gst/base/gstadapter.c:
* libs/gst/base/gstadapter.h:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_position):
* libs/gst/base/gstbasesink.h:
* libs/gst/base/gstbasesrc.c: (gst_base_src_class_init),
(gst_base_src_default_query), (gst_base_src_default_do_seek),
(gst_base_src_do_seek), (gst_base_src_perform_seek),
(gst_base_src_send_event), (gst_base_src_update_length),
(gst_base_src_get_range), (gst_base_src_loop),
(gst_base_src_start):
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasetransform.h:
* libs/gst/base/gstcollectpads.h:
* libs/gst/base/gstpushsrc.c:
* libs/gst/base/gstpushsrc.h:
* libs/gst/dataprotocol/dataprotocol.c:
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/net/gstnetclientclock.h:
* libs/gst/net/gstnettimeprovider.h:
Documentation updates.
2005-12-18 16:04:41 +00:00
|
|
|
* synchronisation and clipping of buffers. Buffers that fall completely outside
|
2006-05-03 16:42:08 +00:00
|
|
|
* of the current segment are dropped. Buffers that fall partially in the
|
|
|
|
* segment are rendered (and prerolled). Subclasses should do any subbuffer
|
2006-04-04 14:58:50 +00:00
|
|
|
* clipping themselves when needed.
|
2006-05-03 16:42:08 +00:00
|
|
|
*
|
|
|
|
* #GstBaseSink will by default report the current playback position in
|
2014-06-05 19:38:20 +00:00
|
|
|
* %GST_FORMAT_TIME based on the current clock time and segment information.
|
2006-05-03 16:42:08 +00:00
|
|
|
* If no clock has been set on the element, the query will be forwarded
|
2006-04-04 14:58:50 +00:00
|
|
|
* upstream.
|
2005-11-09 10:06:30 +00:00
|
|
|
*
|
2009-11-27 14:39:37 +00:00
|
|
|
* The #GstBaseSinkClass.set_caps() function will be called when the subclass
|
|
|
|
* should configure itself to process a specific media type.
|
|
|
|
*
|
|
|
|
* The #GstBaseSinkClass.start() and #GstBaseSinkClass.stop() virtual methods
|
|
|
|
* will be called when resources should be allocated. Any
|
|
|
|
* #GstBaseSinkClass.preroll(), #GstBaseSinkClass.render() and
|
|
|
|
* #GstBaseSinkClass.set_caps() function will be called between the
|
|
|
|
* #GstBaseSinkClass.start() and #GstBaseSinkClass.stop() calls.
|
|
|
|
*
|
|
|
|
* The #GstBaseSinkClass.event() virtual method will be called when an event is
|
2013-12-07 14:38:19 +00:00
|
|
|
* received by #GstBaseSink. Normally this method should only be overridden by
|
2009-11-27 14:39:37 +00:00
|
|
|
* very specific elements (such as file sinks) which need to handle the
|
|
|
|
* newsegment event specially.
|
|
|
|
*
|
|
|
|
* The #GstBaseSinkClass.unlock() method is called when the elements should
|
|
|
|
* unblock any blocking operations they perform in the
|
|
|
|
* #GstBaseSinkClass.render() method. This is mostly useful when the
|
|
|
|
* #GstBaseSinkClass.render() method performs a blocking write on a file
|
|
|
|
* descriptor, for example.
|
|
|
|
*
|
|
|
|
* The #GstBaseSink:max-lateness property affects how the sink deals with
|
|
|
|
* buffers that arrive too late in the sink. A buffer arrives too late in the
|
|
|
|
* sink when the presentation time (as a combination of the last segment, buffer
|
2006-05-03 16:42:08 +00:00
|
|
|
* timestamp and element base_time) plus the duration is before the current
|
|
|
|
* time of the clock.
|
2006-04-04 14:58:50 +00:00
|
|
|
* If the frame is later than max-lateness, the sink will drop the buffer
|
2006-05-03 16:42:08 +00:00
|
|
|
* without calling the render method.
|
2009-11-27 14:39:37 +00:00
|
|
|
* This feature is disabled if sync is disabled, the
|
|
|
|
* #GstBaseSinkClass.get_times() method does not return a valid start time or
|
|
|
|
* max-lateness is set to -1 (the default).
|
2006-05-03 16:42:08 +00:00
|
|
|
* Subclasses can use gst_base_sink_set_max_lateness() to configure the
|
2006-04-04 14:58:50 +00:00
|
|
|
* max-lateness value.
|
2006-03-07 16:21:02 +00:00
|
|
|
*
|
2009-11-27 14:39:37 +00:00
|
|
|
* The #GstBaseSink:qos property will enable the quality-of-service features of
|
|
|
|
* the basesink which gather statistics about the real-time performance of the
|
|
|
|
* clock synchronisation. For each buffer received in the sink, statistics are
|
2007-04-28 11:29:54 +00:00
|
|
|
* gathered and a QOS event is sent upstream with these numbers. This
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
* information can then be used by upstream elements to reduce their processing
|
|
|
|
* rate, for example.
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
*
|
2012-07-10 09:46:41 +00:00
|
|
|
* The #GstBaseSink:async property can be used to instruct the sink to never
|
|
|
|
* perform an ASYNC state change. This feature is mostly usable when dealing
|
|
|
|
* with non-synchronized streams or sparse streams.
|
2005-08-03 13:30:18 +00:00
|
|
|
*/
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2010-01-20 01:09:55 +00:00
|
|
|
#include <gst/gst_private.h>
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
#include "gstbasesink.h"
|
2005-10-23 09:08:44 +00:00
|
|
|
#include <gst/gst-i18n-lib.h>
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-06-28 12:01:49 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_base_sink_debug);
|
|
|
|
#define GST_CAT_DEFAULT gst_base_sink_debug
|
2005-03-28 14:54:33 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
#define GST_BASE_SINK_GET_PRIVATE(obj) \
|
|
|
|
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BASE_SINK, GstBaseSinkPrivate))
|
|
|
|
|
2009-05-19 17:45:06 +00:00
|
|
|
#define GST_FLOW_STEP GST_FLOW_CUSTOM_ERROR
|
|
|
|
|
2009-05-11 16:56:56 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2009-05-14 17:29:08 +00:00
|
|
|
gboolean valid; /* if this info is valid */
|
|
|
|
guint32 seqnum; /* the seqnum of the STEP event */
|
|
|
|
GstFormat format; /* the format of the amount */
|
|
|
|
guint64 amount; /* the total amount of data to skip */
|
2009-05-15 13:25:06 +00:00
|
|
|
guint64 position; /* the position in the stepped data */
|
2009-05-14 17:29:08 +00:00
|
|
|
guint64 duration; /* the duration in time of the skipped data */
|
|
|
|
guint64 start; /* running_time of the start */
|
|
|
|
gdouble rate; /* rate of skipping */
|
2009-06-04 10:34:47 +00:00
|
|
|
gdouble start_rate; /* rate before skipping */
|
2009-06-09 10:06:35 +00:00
|
|
|
guint64 start_start; /* start position skipping */
|
2009-06-09 08:25:34 +00:00
|
|
|
guint64 start_stop; /* stop position skipping */
|
2009-05-18 13:48:20 +00:00
|
|
|
gboolean flush; /* if this was a flushing step */
|
2009-05-14 17:29:08 +00:00
|
|
|
gboolean intermediate; /* if this is an intermediate step */
|
|
|
|
gboolean need_preroll; /* if we need preroll after this step */
|
2009-05-11 16:56:56 +00:00
|
|
|
} GstStepInfo;
|
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
struct _GstBaseSinkPrivate
|
|
|
|
{
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
gint qos_enabled; /* ATOMIC */
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
gboolean async_enabled;
|
2007-08-30 17:50:54 +00:00
|
|
|
GstClockTimeDiff ts_offset;
|
2008-06-20 08:54:45 +00:00
|
|
|
GstClockTime render_delay;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
/* start, stop of current buffer, stream time, used to report position */
|
|
|
|
GstClockTime current_sstart;
|
|
|
|
GstClockTime current_sstop;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
/* start, stop and jitter of current buffer, running time */
|
|
|
|
GstClockTime current_rstart;
|
|
|
|
GstClockTime current_rstop;
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
GstClockTimeDiff current_jitter;
|
2011-02-14 13:00:38 +00:00
|
|
|
/* the running time of the previous buffer */
|
|
|
|
GstClockTime prev_rstart;
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
|
2006-05-08 09:16:01 +00:00
|
|
|
/* EOS sync time in running time */
|
|
|
|
GstClockTime eos_rtime;
|
|
|
|
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
/* last buffer that arrived in time, running time */
|
2011-02-14 11:21:39 +00:00
|
|
|
GstClockTime last_render_time;
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
/* when the last buffer left the sink, running time */
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
GstClockTime last_left;
|
|
|
|
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
/* running averages go here these are done on running time */
|
2016-09-12 15:41:16 +00:00
|
|
|
GstClockTime avg_pt, avg_in_diff;
|
|
|
|
gdouble avg_rate; /* average with infinite window */
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
|
|
|
|
/* number of rendered and dropped frames */
|
|
|
|
guint64 rendered;
|
|
|
|
guint64 dropped;
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
|
|
|
|
/* latency stuff */
|
|
|
|
GstClockTime latency;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
2007-04-05 10:10:08 +00:00
|
|
|
/* if we already commited the state */
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
gboolean commited;
|
2011-07-04 10:58:54 +00:00
|
|
|
/* state change to playing ongoing */
|
|
|
|
gboolean to_playing;
|
2007-04-05 10:10:08 +00:00
|
|
|
|
|
|
|
/* when we received EOS */
|
|
|
|
gboolean received_eos;
|
2007-09-14 15:52:27 +00:00
|
|
|
|
|
|
|
/* when we are prerolled and able to report latency */
|
|
|
|
gboolean have_latency;
|
2007-10-30 18:30:13 +00:00
|
|
|
|
|
|
|
/* the last buffer we prerolled or rendered. Useful for making snapshots */
|
2011-12-01 15:46:06 +00:00
|
|
|
gint enable_last_sample; /* atomic */
|
2007-10-30 18:30:13 +00:00
|
|
|
GstBuffer *last_buffer;
|
2011-12-01 15:46:06 +00:00
|
|
|
GstCaps *last_caps;
|
2015-06-22 11:02:55 +00:00
|
|
|
GstBufferList *last_buffer_list;
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
|
2011-12-01 15:46:06 +00:00
|
|
|
/* negotiated caps */
|
|
|
|
GstCaps *caps;
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
|
2008-11-04 15:56:55 +00:00
|
|
|
/* blocksize for pulling */
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
guint blocksize;
|
2008-10-20 15:18:14 +00:00
|
|
|
|
|
|
|
gboolean discont;
|
2008-11-04 15:56:55 +00:00
|
|
|
|
|
|
|
/* seqnum of the stream */
|
|
|
|
guint32 seqnum;
|
2009-02-03 14:27:34 +00:00
|
|
|
|
|
|
|
gboolean call_preroll;
|
2009-05-19 17:45:06 +00:00
|
|
|
gboolean step_unlock;
|
2009-05-11 16:56:56 +00:00
|
|
|
|
2009-05-14 17:29:08 +00:00
|
|
|
/* we have a pending and a current step operation */
|
|
|
|
GstStepInfo current_step;
|
|
|
|
GstStepInfo pending_step;
|
2010-10-20 15:41:28 +00:00
|
|
|
|
|
|
|
/* Cached GstClockID */
|
|
|
|
GstClockID cached_clock_id;
|
2011-02-10 12:42:05 +00:00
|
|
|
|
2011-02-10 13:50:04 +00:00
|
|
|
/* for throttling and QoS */
|
|
|
|
GstClockTime earliest_in_time;
|
2011-02-10 12:42:05 +00:00
|
|
|
GstClockTime throttle_time;
|
2012-11-09 15:50:50 +00:00
|
|
|
|
|
|
|
/* for rate control */
|
|
|
|
guint64 max_bitrate;
|
|
|
|
GstClockTime rc_time;
|
|
|
|
GstClockTime rc_next;
|
|
|
|
gsize rc_accumulated;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
};
|
|
|
|
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
#define DO_RUNNING_AVG(avg,val,size) (((val) + ((size)-1) * (avg)) / (size))
|
|
|
|
|
2006-04-28 13:25:58 +00:00
|
|
|
/* generic running average, this has a neutral window size */
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
#define UPDATE_RUNNING_AVG(avg,val) DO_RUNNING_AVG(avg,val,8)
|
|
|
|
|
2006-04-28 13:25:58 +00:00
|
|
|
/* the windows for these running averages are experimentally obtained.
|
2013-12-07 14:40:32 +00:00
|
|
|
* positive values get averaged more while negative values use a small
|
2006-04-28 13:25:58 +00:00
|
|
|
* window so we can react faster to badness. */
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
#define UPDATE_RUNNING_AVG_P(avg,val) DO_RUNNING_AVG(avg,val,16)
|
|
|
|
#define UPDATE_RUNNING_AVG_N(avg,val) DO_RUNNING_AVG(avg,val,4)
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
|
2007-06-21 22:37:27 +00:00
|
|
|
/* BaseSink properties */
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-08-26 14:21:43 +00:00
|
|
|
#define DEFAULT_CAN_ACTIVATE_PULL FALSE /* fixme: enable me */
|
|
|
|
#define DEFAULT_CAN_ACTIVATE_PUSH TRUE
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2009-08-24 15:56:32 +00:00
|
|
|
#define DEFAULT_SYNC TRUE
|
|
|
|
#define DEFAULT_MAX_LATENESS -1
|
|
|
|
#define DEFAULT_QOS FALSE
|
|
|
|
#define DEFAULT_ASYNC TRUE
|
|
|
|
#define DEFAULT_TS_OFFSET 0
|
|
|
|
#define DEFAULT_BLOCKSIZE 4096
|
|
|
|
#define DEFAULT_RENDER_DELAY 0
|
2011-12-01 15:46:06 +00:00
|
|
|
#define DEFAULT_ENABLE_LAST_SAMPLE TRUE
|
2011-02-10 12:42:05 +00:00
|
|
|
#define DEFAULT_THROTTLE_TIME 0
|
2012-11-09 15:50:50 +00:00
|
|
|
#define DEFAULT_MAX_BITRATE 0
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2006-03-06 16:02:37 +00:00
|
|
|
PROP_SYNC,
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
PROP_MAX_LATENESS,
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
PROP_QOS,
|
2007-08-30 17:50:54 +00:00
|
|
|
PROP_ASYNC,
|
2007-10-30 18:30:13 +00:00
|
|
|
PROP_TS_OFFSET,
|
2011-12-01 15:46:06 +00:00
|
|
|
PROP_ENABLE_LAST_SAMPLE,
|
|
|
|
PROP_LAST_SAMPLE,
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
PROP_BLOCKSIZE,
|
2008-12-15 12:47:59 +00:00
|
|
|
PROP_RENDER_DELAY,
|
2011-02-10 12:42:05 +00:00
|
|
|
PROP_THROTTLE_TIME,
|
2012-11-09 15:50:50 +00:00
|
|
|
PROP_MAX_BITRATE,
|
2007-10-30 18:30:13 +00:00
|
|
|
PROP_LAST
|
2005-03-28 14:54:33 +00:00
|
|
|
};
|
|
|
|
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
static GstElementClass *parent_class = NULL;
|
|
|
|
|
2005-06-28 12:01:49 +00:00
|
|
|
static void gst_base_sink_class_init (GstBaseSinkClass * klass);
|
|
|
|
static void gst_base_sink_init (GstBaseSink * trans, gpointer g_class);
|
|
|
|
static void gst_base_sink_finalize (GObject * object);
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
|
|
|
|
GType
|
2005-06-28 12:01:49 +00:00
|
|
|
gst_base_sink_get_type (void)
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
{
|
2009-04-04 08:59:39 +00:00
|
|
|
static volatile gsize base_sink_type = 0;
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
|
2009-04-04 08:59:39 +00:00
|
|
|
if (g_once_init_enter (&base_sink_type)) {
|
|
|
|
GType _type;
|
2005-06-28 12:01:49 +00:00
|
|
|
static const GTypeInfo base_sink_info = {
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
sizeof (GstBaseSinkClass),
|
Don't use base_init where not absolutely necessary. For example it's not necessary anymore for adding pad templates o...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_get_type), (gst_bin_class_init):
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_class_init):
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_type),
(gst_base_sink_class_init):
* libs/gst/base/gstbasesrc.c: (gst_base_src_get_type),
(gst_base_src_class_init):
* libs/gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_class_init):
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_base_init),
(gst_collect_pads_class_init):
* libs/gst/base/gstdataqueue.c: (gst_data_queue_get_type):
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_base_init),
(gst_net_time_provider_class_init):
* plugins/elements/gstcapsfilter.c: (gst_capsfilter_base_init),
(gst_capsfilter_class_init):
* plugins/elements/gstfakesink.c: (gst_fake_sink_base_init),
(gst_fake_sink_class_init):
* plugins/elements/gstfakesrc.c: (gst_fake_src_base_init),
(gst_fake_src_class_init):
* plugins/elements/gstfdsink.c: (gst_fd_sink_base_init),
(gst_fd_sink_class_init):
* plugins/elements/gstfdsrc.c: (gst_fd_src_base_init),
(gst_fd_src_class_init):
* plugins/elements/gstfilesink.c: (gst_file_sink_base_init),
(gst_file_sink_class_init):
* plugins/elements/gstfilesrc.c: (gst_file_src_base_init),
(gst_file_src_class_init):
* plugins/elements/gstidentity.c: (gst_identity_base_init),
(gst_identity_class_init):
* plugins/elements/gstmultiqueue.c: (gst_multi_queue_base_init),
(gst_multi_queue_class_init):
* plugins/elements/gstqueue.c: (gst_queue_base_init),
(gst_queue_class_init):
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_class_init):
* plugins/elements/gsttypefindelement.c:
(gst_type_find_element_base_init),
(gst_type_find_element_class_init):
Don't use base_init where not absolutely necessary. For example it's
not necessary anymore for adding pad templates or setting element
details.
Leave empty base_init functions in several places as GST_BOILERPLATE
still defines and uses them.
2008-02-03 12:04:37 +00:00
|
|
|
NULL,
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
NULL,
|
2005-06-28 12:01:49 +00:00
|
|
|
(GClassInitFunc) gst_base_sink_class_init,
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
sizeof (GstBaseSink),
|
|
|
|
0,
|
2005-06-28 12:01:49 +00:00
|
|
|
(GInstanceInitFunc) gst_base_sink_init,
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
};
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2009-04-04 08:59:39 +00:00
|
|
|
_type = g_type_register_static (GST_TYPE_ELEMENT,
|
2005-06-28 12:01:49 +00:00
|
|
|
"GstBaseSink", &base_sink_info, G_TYPE_FLAG_ABSTRACT);
|
2009-04-04 08:59:39 +00:00
|
|
|
g_once_init_leave (&base_sink_type, _type);
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
}
|
2005-06-28 12:01:49 +00:00
|
|
|
return base_sink_type;
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-06-28 12:01:49 +00:00
|
|
|
static void gst_base_sink_set_property (GObject * object, guint prop_id,
|
2005-03-28 14:54:33 +00:00
|
|
|
const GValue * value, GParamSpec * pspec);
|
2005-06-28 12:01:49 +00:00
|
|
|
static void gst_base_sink_get_property (GObject * object, guint prop_id,
|
2005-03-28 14:54:33 +00:00
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
2005-09-22 18:07:22 +00:00
|
|
|
static gboolean gst_base_sink_send_event (GstElement * element,
|
|
|
|
GstEvent * event);
|
2011-07-26 10:21:38 +00:00
|
|
|
static gboolean default_element_query (GstElement * element, GstQuery * query);
|
2005-09-22 18:07:22 +00:00
|
|
|
|
2011-12-02 22:13:23 +00:00
|
|
|
static GstCaps *gst_base_sink_default_get_caps (GstBaseSink * sink,
|
|
|
|
GstCaps * caps);
|
|
|
|
static gboolean gst_base_sink_default_set_caps (GstBaseSink * sink,
|
|
|
|
GstCaps * caps);
|
|
|
|
static void gst_base_sink_default_get_times (GstBaseSink * basesink,
|
|
|
|
GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
static gboolean gst_base_sink_set_flushing (GstBaseSink * basesink,
|
|
|
|
GstPad * pad, gboolean flushing);
|
libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate): (gst_base_transform_init, gst_base_transform_sink_activa...
Original commit message from CVS:
2007-01-12 Andy Wingo <wingo@pobox.com>
* libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate):
(gst_base_transform_init, gst_base_transform_sink_activate_push)
(gst_base_transform_src_activate_pull):
Track the activation mode.
(gst_base_transform_setcaps): In pull mode, when activating the
src pad, after activating the sink pad, activate the sink pad's
peer, as discussed in part-negotiation.txt.
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasesrc.c (gst_base_src_fixate): Add fixate
vmethod, as in basesink.
* libs/gst/base/gstbasesink.h: Reformat docs, add fixate vmethod.
* libs/gst/base/gstbasesink.c (gst_base_sink_pad_setcaps): In pull
mode, first proxy the setcaps to the peer pad.
(gst_base_sink_pad_fixate): Add a fixate function that calls the
new fixate vmethod.
(gst_base_sink_default_activate_pull): Rename from
gst_base_sink_activate_pull.
(gst_base_sink_negotiate_pull): New function, performs negotiation
in pull mode before calling ::activate_pull().
(gst_base_sink_pad_activate_pull): Actually call the activate_pull
vmethod instead of the default implementation. I have no idea how
this worked before. Negotiate before calling activate_pull.
2007-01-12 15:56:00 +00:00
|
|
|
static gboolean gst_base_sink_default_activate_pull (GstBaseSink * basesink,
|
2007-01-06 17:18:03 +00:00
|
|
|
gboolean active);
|
2008-10-20 15:18:14 +00:00
|
|
|
static gboolean gst_base_sink_default_do_seek (GstBaseSink * sink,
|
|
|
|
GstSegment * segment);
|
|
|
|
static gboolean gst_base_sink_default_prepare_seek_segment (GstBaseSink * sink,
|
|
|
|
GstEvent * event, GstSegment * segment);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-09-02 15:42:00 +00:00
|
|
|
static GstStateChangeReturn gst_base_sink_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2011-11-16 16:22:56 +00:00
|
|
|
static gboolean gst_base_sink_sink_query (GstPad * pad, GstObject * parent,
|
|
|
|
GstQuery * query);
|
2011-11-17 11:40:45 +00:00
|
|
|
static GstFlowReturn gst_base_sink_chain (GstPad * pad, GstObject * parent,
|
|
|
|
GstBuffer * buffer);
|
|
|
|
static GstFlowReturn gst_base_sink_chain_list (GstPad * pad, GstObject * parent,
|
2009-06-16 11:32:37 +00:00
|
|
|
GstBufferList * list);
|
|
|
|
|
2005-06-28 12:01:49 +00:00
|
|
|
static void gst_base_sink_loop (GstPad * pad);
|
2011-11-18 12:46:46 +00:00
|
|
|
static gboolean gst_base_sink_pad_activate (GstPad * pad, GstObject * parent);
|
2011-11-21 12:29:05 +00:00
|
|
|
static gboolean gst_base_sink_pad_activate_mode (GstPad * pad,
|
|
|
|
GstObject * parent, GstPadMode mode, gboolean active);
|
2011-12-02 21:20:08 +00:00
|
|
|
static gboolean gst_base_sink_default_event (GstBaseSink * basesink,
|
|
|
|
GstEvent * event);
|
2012-08-31 18:31:45 +00:00
|
|
|
static GstFlowReturn gst_base_sink_default_wait_event (GstBaseSink * basesink,
|
2011-12-02 21:20:08 +00:00
|
|
|
GstEvent * event);
|
2011-11-17 11:40:45 +00:00
|
|
|
static gboolean gst_base_sink_event (GstPad * pad, GstObject * parent,
|
|
|
|
GstEvent * event);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2011-12-02 22:13:23 +00:00
|
|
|
static gboolean gst_base_sink_default_query (GstBaseSink * sink,
|
|
|
|
GstQuery * query);
|
2011-07-26 10:21:38 +00:00
|
|
|
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
static gboolean gst_base_sink_negotiate_pull (GstBaseSink * basesink);
|
2012-03-11 17:57:44 +00:00
|
|
|
static GstCaps *gst_base_sink_default_fixate (GstBaseSink * bsink,
|
|
|
|
GstCaps * caps);
|
|
|
|
static GstCaps *gst_base_sink_fixate (GstBaseSink * bsink, GstCaps * caps);
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
/* check if an object was too late */
|
|
|
|
static gboolean gst_base_sink_is_too_late (GstBaseSink * basesink,
|
2011-02-10 13:53:34 +00:00
|
|
|
GstMiniObject * obj, GstClockTime rstart, GstClockTime rstop,
|
2013-04-19 08:24:06 +00:00
|
|
|
GstClockReturn status, GstClockTimeDiff jitter, gboolean render);
|
2006-03-14 11:18:07 +00:00
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
static void
|
2005-06-28 12:01:49 +00:00
|
|
|
gst_base_sink_class_init (GstBaseSinkClass * klass)
|
2005-03-28 14:54:33 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
2006-05-11 18:10:34 +00:00
|
|
|
gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
gstelement_class = GST_ELEMENT_CLASS (klass);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
Don't use base_init where not absolutely necessary. For example it's not necessary anymore for adding pad templates o...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_get_type), (gst_bin_class_init):
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_class_init):
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_type),
(gst_base_sink_class_init):
* libs/gst/base/gstbasesrc.c: (gst_base_src_get_type),
(gst_base_src_class_init):
* libs/gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_class_init):
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_base_init),
(gst_collect_pads_class_init):
* libs/gst/base/gstdataqueue.c: (gst_data_queue_get_type):
* libs/gst/net/gstnettimeprovider.c:
(gst_net_time_provider_base_init),
(gst_net_time_provider_class_init):
* plugins/elements/gstcapsfilter.c: (gst_capsfilter_base_init),
(gst_capsfilter_class_init):
* plugins/elements/gstfakesink.c: (gst_fake_sink_base_init),
(gst_fake_sink_class_init):
* plugins/elements/gstfakesrc.c: (gst_fake_src_base_init),
(gst_fake_src_class_init):
* plugins/elements/gstfdsink.c: (gst_fd_sink_base_init),
(gst_fd_sink_class_init):
* plugins/elements/gstfdsrc.c: (gst_fd_src_base_init),
(gst_fd_src_class_init):
* plugins/elements/gstfilesink.c: (gst_file_sink_base_init),
(gst_file_sink_class_init):
* plugins/elements/gstfilesrc.c: (gst_file_src_base_init),
(gst_file_src_class_init):
* plugins/elements/gstidentity.c: (gst_identity_base_init),
(gst_identity_class_init):
* plugins/elements/gstmultiqueue.c: (gst_multi_queue_base_init),
(gst_multi_queue_class_init):
* plugins/elements/gstqueue.c: (gst_queue_base_init),
(gst_queue_class_init):
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_class_init):
* plugins/elements/gsttypefindelement.c:
(gst_type_find_element_base_init),
(gst_type_find_element_class_init):
Don't use base_init where not absolutely necessary. For example it's
not necessary anymore for adding pad templates or setting element
details.
Leave empty base_init functions in several places as GST_BOILERPLATE
still defines and uses them.
2008-02-03 12:04:37 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_base_sink_debug, "basesink", 0,
|
|
|
|
"basesink element");
|
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
g_type_class_add_private (klass, sizeof (GstBaseSinkPrivate));
|
|
|
|
|
2006-04-08 20:57:31 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
|
2009-10-28 00:29:30 +00:00
|
|
|
gobject_class->finalize = gst_base_sink_finalize;
|
|
|
|
gobject_class->set_property = gst_base_sink_set_property;
|
|
|
|
gobject_class->get_property = gst_base_sink_get_property;
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_SYNC,
|
2005-09-20 12:05:47 +00:00
|
|
|
g_param_spec_boolean ("sync", "Sync", "Sync on the clock", DEFAULT_SYNC,
|
2008-03-22 14:56:17 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_MAX_LATENESS,
|
2006-03-06 16:02:37 +00:00
|
|
|
g_param_spec_int64 ("max-lateness", "Max Lateness",
|
|
|
|
"Maximum number of nanoseconds that a buffer can be late before it "
|
|
|
|
"is dropped (-1 unlimited)", -1, G_MAXINT64, DEFAULT_MAX_LATENESS,
|
2008-03-22 14:56:17 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-03-06 16:02:37 +00:00
|
|
|
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_QOS,
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
g_param_spec_boolean ("qos", "Qos",
|
|
|
|
"Generate Quality-of-Service events upstream", DEFAULT_QOS,
|
2008-03-22 14:56:17 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
/**
|
2012-06-15 23:56:46 +00:00
|
|
|
* GstBaseSink:async:
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
*
|
2014-06-05 19:38:20 +00:00
|
|
|
* If set to %TRUE, the basesink will perform asynchronous state changes.
|
|
|
|
* When set to %FALSE, the sink will not signal the parent when it prerolls.
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
* Use this option when dealing with sparse streams or when synchronisation is
|
|
|
|
* not required.
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_ASYNC,
|
|
|
|
g_param_spec_boolean ("async", "Async",
|
2008-03-22 14:56:17 +00:00
|
|
|
"Go asynchronously to PAUSED", DEFAULT_ASYNC,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2007-08-30 17:50:54 +00:00
|
|
|
/**
|
2012-06-15 23:56:46 +00:00
|
|
|
* GstBaseSink:ts-offset:
|
2007-08-30 17:50:54 +00:00
|
|
|
*
|
|
|
|
* Controls the final synchronisation, a negative value will render the buffer
|
2009-08-24 15:56:32 +00:00
|
|
|
* earlier while a positive value delays playback. This property can be
|
2007-08-30 17:50:54 +00:00
|
|
|
* used to fix synchronisation in bad files.
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_TS_OFFSET,
|
|
|
|
g_param_spec_int64 ("ts-offset", "TS Offset",
|
|
|
|
"Timestamp offset in nanoseconds", G_MININT64, G_MAXINT64,
|
2008-03-22 14:56:17 +00:00
|
|
|
DEFAULT_TS_OFFSET, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2010-07-06 10:18:45 +00:00
|
|
|
|
|
|
|
/**
|
2012-06-15 23:56:46 +00:00
|
|
|
* GstBaseSink:enable-last-sample:
|
2010-07-06 10:18:45 +00:00
|
|
|
*
|
2014-06-05 19:38:20 +00:00
|
|
|
* Enable the last-sample property. If %FALSE, basesink doesn't keep a
|
2011-12-01 15:46:06 +00:00
|
|
|
* reference to the last buffer arrived and the last-sample property is always
|
2014-06-05 19:38:20 +00:00
|
|
|
* set to %NULL. This can be useful if you need buffers to be released as soon
|
2010-07-06 10:18:45 +00:00
|
|
|
* as possible, eg. if you're using a buffer pool.
|
|
|
|
*/
|
2011-12-01 15:46:06 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_ENABLE_LAST_SAMPLE,
|
|
|
|
g_param_spec_boolean ("enable-last-sample", "Enable Last Buffer",
|
|
|
|
"Enable the last-sample property", DEFAULT_ENABLE_LAST_SAMPLE,
|
2010-07-06 10:18:45 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
2007-10-30 18:30:13 +00:00
|
|
|
/**
|
2012-06-15 23:56:46 +00:00
|
|
|
* GstBaseSink:last-sample:
|
2007-10-30 18:30:13 +00:00
|
|
|
*
|
|
|
|
* The last buffer that arrived in the sink and was used for preroll or for
|
2008-02-29 15:39:44 +00:00
|
|
|
* rendering. This property can be used to generate thumbnails. This property
|
2014-06-05 19:38:20 +00:00
|
|
|
* can be %NULL when the sink has not yet received a buffer.
|
2007-10-30 18:30:13 +00:00
|
|
|
*/
|
2011-12-01 15:46:06 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_LAST_SAMPLE,
|
|
|
|
g_param_spec_boxed ("last-sample", "Last Sample",
|
|
|
|
"The last sample received in the sink", GST_TYPE_SAMPLE,
|
2008-03-22 14:56:17 +00:00
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
/**
|
2012-06-15 23:56:46 +00:00
|
|
|
* GstBaseSink:blocksize:
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
*
|
|
|
|
* The amount of bytes to pull when operating in pull mode.
|
|
|
|
*/
|
2014-09-25 19:21:09 +00:00
|
|
|
/* FIXME 2.0: blocksize property should be int, otherwise min>max.. */
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_BLOCKSIZE,
|
|
|
|
g_param_spec_uint ("blocksize", "Block size",
|
|
|
|
"Size in bytes to pull per buffer (0 = default)", 0, G_MAXUINT,
|
|
|
|
DEFAULT_BLOCKSIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2008-12-15 12:47:59 +00:00
|
|
|
/**
|
2012-06-15 23:56:46 +00:00
|
|
|
* GstBaseSink:render-delay:
|
2008-12-15 12:47:59 +00:00
|
|
|
*
|
|
|
|
* The additional delay between synchronisation and actual rendering of the
|
|
|
|
* media. This property will add additional latency to the device in order to
|
|
|
|
* make other sinks compensate for the delay.
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_RENDER_DELAY,
|
|
|
|
g_param_spec_uint64 ("render-delay", "Render Delay",
|
|
|
|
"Additional render delay of the sink in nanoseconds", 0, G_MAXUINT64,
|
|
|
|
DEFAULT_RENDER_DELAY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2011-02-10 12:42:05 +00:00
|
|
|
/**
|
2012-06-15 23:56:46 +00:00
|
|
|
* GstBaseSink:throttle-time:
|
2011-02-10 12:42:05 +00:00
|
|
|
*
|
|
|
|
* The time to insert between buffers. This property can be used to control
|
|
|
|
* the maximum amount of buffers per second to render. Setting this property
|
|
|
|
* to a value bigger than 0 will make the sink create THROTTLE QoS events.
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_THROTTLE_TIME,
|
|
|
|
g_param_spec_uint64 ("throttle-time", "Throttle time",
|
2012-11-09 15:50:50 +00:00
|
|
|
"The time to keep between rendered buffers (0 = disabled)", 0,
|
|
|
|
G_MAXUINT64, DEFAULT_THROTTLE_TIME,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
/**
|
|
|
|
* GstBaseSink:max-bitrate:
|
|
|
|
*
|
|
|
|
* Control the maximum amount of bits that will be rendered per second.
|
|
|
|
* Setting this property to a value bigger than 0 will make the sink delay
|
|
|
|
* rendering of the buffers when it would exceed to max-bitrate.
|
|
|
|
*
|
2013-11-16 12:24:56 +00:00
|
|
|
* Since: 1.2
|
2012-11-09 15:50:50 +00:00
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_MAX_BITRATE,
|
|
|
|
g_param_spec_uint64 ("max-bitrate", "Max Bitrate",
|
|
|
|
"The maximum bits per second to render (0 = disabled)", 0,
|
|
|
|
G_MAXUINT64, DEFAULT_MAX_BITRATE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
gstelement_class->change_state =
|
2005-06-28 12:01:49 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_base_sink_change_state);
|
2005-09-22 18:07:22 +00:00
|
|
|
gstelement_class->send_event = GST_DEBUG_FUNCPTR (gst_base_sink_send_event);
|
2011-07-26 10:21:38 +00:00
|
|
|
gstelement_class->query = GST_DEBUG_FUNCPTR (default_element_query);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2011-12-02 22:13:23 +00:00
|
|
|
klass->get_caps = GST_DEBUG_FUNCPTR (gst_base_sink_default_get_caps);
|
|
|
|
klass->set_caps = GST_DEBUG_FUNCPTR (gst_base_sink_default_set_caps);
|
2011-11-10 11:33:49 +00:00
|
|
|
klass->fixate = GST_DEBUG_FUNCPTR (gst_base_sink_default_fixate);
|
libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate): (gst_base_transform_init, gst_base_transform_sink_activa...
Original commit message from CVS:
2007-01-12 Andy Wingo <wingo@pobox.com>
* libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate):
(gst_base_transform_init, gst_base_transform_sink_activate_push)
(gst_base_transform_src_activate_pull):
Track the activation mode.
(gst_base_transform_setcaps): In pull mode, when activating the
src pad, after activating the sink pad, activate the sink pad's
peer, as discussed in part-negotiation.txt.
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasesrc.c (gst_base_src_fixate): Add fixate
vmethod, as in basesink.
* libs/gst/base/gstbasesink.h: Reformat docs, add fixate vmethod.
* libs/gst/base/gstbasesink.c (gst_base_sink_pad_setcaps): In pull
mode, first proxy the setcaps to the peer pad.
(gst_base_sink_pad_fixate): Add a fixate function that calls the
new fixate vmethod.
(gst_base_sink_default_activate_pull): Rename from
gst_base_sink_activate_pull.
(gst_base_sink_negotiate_pull): New function, performs negotiation
in pull mode before calling ::activate_pull().
(gst_base_sink_pad_activate_pull): Actually call the activate_pull
vmethod instead of the default implementation. I have no idea how
this worked before. Negotiate before calling activate_pull.
2007-01-12 15:56:00 +00:00
|
|
|
klass->activate_pull =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_base_sink_default_activate_pull);
|
2011-12-02 22:13:23 +00:00
|
|
|
klass->get_times = GST_DEBUG_FUNCPTR (gst_base_sink_default_get_times);
|
|
|
|
klass->query = GST_DEBUG_FUNCPTR (gst_base_sink_default_query);
|
2011-12-02 21:20:08 +00:00
|
|
|
klass->event = GST_DEBUG_FUNCPTR (gst_base_sink_default_event);
|
2012-09-04 10:13:11 +00:00
|
|
|
klass->wait_event = GST_DEBUG_FUNCPTR (gst_base_sink_default_wait_event);
|
2009-12-01 18:27:47 +00:00
|
|
|
|
|
|
|
/* Registering debug symbols for function pointers */
|
2011-11-10 09:58:42 +00:00
|
|
|
GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_fixate);
|
2009-12-01 18:27:47 +00:00
|
|
|
GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_activate);
|
2011-11-21 12:29:05 +00:00
|
|
|
GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_activate_mode);
|
2009-12-01 18:27:47 +00:00
|
|
|
GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_event);
|
|
|
|
GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_chain);
|
|
|
|
GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_chain_list);
|
2011-10-28 08:19:29 +00:00
|
|
|
GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_sink_query);
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps *
|
2011-11-15 10:20:48 +00:00
|
|
|
gst_base_sink_query_caps (GstBaseSink * bsink, GstPad * pad, GstCaps * filter)
|
2005-03-28 14:54:33 +00:00
|
|
|
{
|
|
|
|
GstBaseSinkClass *bclass;
|
|
|
|
GstCaps *caps = NULL;
|
2011-11-15 10:20:48 +00:00
|
|
|
gboolean fixed;
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-07-10 12:03:13 +00:00
|
|
|
bclass = GST_BASE_SINK_GET_CLASS (bsink);
|
2011-11-15 10:20:48 +00:00
|
|
|
fixed = GST_PAD_IS_FIXED_CAPS (pad);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2011-11-18 11:35:46 +00:00
|
|
|
if (fixed || bsink->pad_mode == GST_PAD_MODE_PULL) {
|
2011-11-15 10:20:48 +00:00
|
|
|
/* if we are operating in pull mode or fixed caps, we only accept the
|
|
|
|
* currently negotiated caps */
|
2011-05-06 17:04:54 +00:00
|
|
|
caps = gst_pad_get_current_caps (pad);
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
if (caps == NULL) {
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
if (bclass->get_caps)
|
2011-05-11 13:12:04 +00:00
|
|
|
caps = bclass->get_caps (bsink, filter);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
if (caps == NULL) {
|
|
|
|
GstPadTemplate *pad_template;
|
|
|
|
|
|
|
|
pad_template =
|
|
|
|
gst_element_class_get_pad_template (GST_ELEMENT_CLASS (bclass),
|
|
|
|
"sink");
|
|
|
|
if (pad_template != NULL) {
|
2011-05-17 10:25:22 +00:00
|
|
|
caps = gst_pad_template_get_caps (pad_template);
|
2011-05-11 13:12:04 +00:00
|
|
|
|
|
|
|
if (filter) {
|
|
|
|
GstCaps *intersection;
|
|
|
|
|
|
|
|
intersection =
|
|
|
|
gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
caps = intersection;
|
|
|
|
}
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
}
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
2012-03-11 17:57:44 +00:00
|
|
|
static GstCaps *
|
2011-11-10 09:58:42 +00:00
|
|
|
gst_base_sink_default_fixate (GstBaseSink * bsink, GstCaps * caps)
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (bsink, "using default caps fixate function");
|
2012-03-11 17:57:44 +00:00
|
|
|
return gst_caps_fixate (caps);
|
2011-11-10 09:58:42 +00:00
|
|
|
}
|
|
|
|
|
2012-03-11 17:57:44 +00:00
|
|
|
static GstCaps *
|
2011-11-10 09:58:42 +00:00
|
|
|
gst_base_sink_fixate (GstBaseSink * bsink, GstCaps * caps)
|
libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate): (gst_base_transform_init, gst_base_transform_sink_activa...
Original commit message from CVS:
2007-01-12 Andy Wingo <wingo@pobox.com>
* libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate):
(gst_base_transform_init, gst_base_transform_sink_activate_push)
(gst_base_transform_src_activate_pull):
Track the activation mode.
(gst_base_transform_setcaps): In pull mode, when activating the
src pad, after activating the sink pad, activate the sink pad's
peer, as discussed in part-negotiation.txt.
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasesrc.c (gst_base_src_fixate): Add fixate
vmethod, as in basesink.
* libs/gst/base/gstbasesink.h: Reformat docs, add fixate vmethod.
* libs/gst/base/gstbasesink.c (gst_base_sink_pad_setcaps): In pull
mode, first proxy the setcaps to the peer pad.
(gst_base_sink_pad_fixate): Add a fixate function that calls the
new fixate vmethod.
(gst_base_sink_default_activate_pull): Rename from
gst_base_sink_activate_pull.
(gst_base_sink_negotiate_pull): New function, performs negotiation
in pull mode before calling ::activate_pull().
(gst_base_sink_pad_activate_pull): Actually call the activate_pull
vmethod instead of the default implementation. I have no idea how
this worked before. Negotiate before calling activate_pull.
2007-01-12 15:56:00 +00:00
|
|
|
{
|
|
|
|
GstBaseSinkClass *bclass;
|
|
|
|
|
|
|
|
bclass = GST_BASE_SINK_GET_CLASS (bsink);
|
|
|
|
|
|
|
|
if (bclass->fixate)
|
2012-03-11 17:57:44 +00:00
|
|
|
caps = bclass->fixate (bsink, caps);
|
|
|
|
|
|
|
|
return caps;
|
libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate): (gst_base_transform_init, gst_base_transform_sink_activa...
Original commit message from CVS:
2007-01-12 Andy Wingo <wingo@pobox.com>
* libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate):
(gst_base_transform_init, gst_base_transform_sink_activate_push)
(gst_base_transform_src_activate_pull):
Track the activation mode.
(gst_base_transform_setcaps): In pull mode, when activating the
src pad, after activating the sink pad, activate the sink pad's
peer, as discussed in part-negotiation.txt.
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasesrc.c (gst_base_src_fixate): Add fixate
vmethod, as in basesink.
* libs/gst/base/gstbasesink.h: Reformat docs, add fixate vmethod.
* libs/gst/base/gstbasesink.c (gst_base_sink_pad_setcaps): In pull
mode, first proxy the setcaps to the peer pad.
(gst_base_sink_pad_fixate): Add a fixate function that calls the
new fixate vmethod.
(gst_base_sink_default_activate_pull): Rename from
gst_base_sink_activate_pull.
(gst_base_sink_negotiate_pull): New function, performs negotiation
in pull mode before calling ::activate_pull().
(gst_base_sink_pad_activate_pull): Actually call the activate_pull
vmethod instead of the default implementation. I have no idea how
this worked before. Negotiate before calling activate_pull.
2007-01-12 15:56:00 +00:00
|
|
|
}
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
static void
|
2005-06-28 12:01:49 +00:00
|
|
|
gst_base_sink_init (GstBaseSink * basesink, gpointer g_class)
|
2005-03-28 14:54:33 +00:00
|
|
|
{
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
GstPadTemplate *pad_template;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
GstBaseSinkPrivate *priv;
|
|
|
|
|
|
|
|
basesink->priv = priv = GST_BASE_SINK_GET_PRIVATE (basesink);
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
|
|
|
|
pad_template =
|
|
|
|
gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "sink");
|
|
|
|
g_return_if_fail (pad_template != NULL);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
basesink->sinkpad = gst_pad_new_from_template (pad_template, "sink");
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2009-12-01 18:27:47 +00:00
|
|
|
gst_pad_set_activate_function (basesink->sinkpad, gst_base_sink_pad_activate);
|
2011-11-21 12:29:05 +00:00
|
|
|
gst_pad_set_activatemode_function (basesink->sinkpad,
|
|
|
|
gst_base_sink_pad_activate_mode);
|
2011-07-26 10:21:38 +00:00
|
|
|
gst_pad_set_query_function (basesink->sinkpad, gst_base_sink_sink_query);
|
2009-12-01 18:27:47 +00:00
|
|
|
gst_pad_set_event_function (basesink->sinkpad, gst_base_sink_event);
|
|
|
|
gst_pad_set_chain_function (basesink->sinkpad, gst_base_sink_chain);
|
|
|
|
gst_pad_set_chain_list_function (basesink->sinkpad, gst_base_sink_chain_list);
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT_CAST (basesink), basesink->sinkpad);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2011-11-18 11:35:46 +00:00
|
|
|
basesink->pad_mode = GST_PAD_MODE_NONE;
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_init (&basesink->preroll_lock);
|
|
|
|
g_cond_init (&basesink->preroll_cond);
|
2007-09-14 15:52:27 +00:00
|
|
|
priv->have_latency = FALSE;
|
2005-05-12 19:45:44 +00:00
|
|
|
|
2005-08-26 14:21:43 +00:00
|
|
|
basesink->can_activate_push = DEFAULT_CAN_ACTIVATE_PUSH;
|
|
|
|
basesink->can_activate_pull = DEFAULT_CAN_ACTIVATE_PULL;
|
|
|
|
|
2005-09-20 17:38:51 +00:00
|
|
|
basesink->sync = DEFAULT_SYNC;
|
2011-02-22 18:09:48 +00:00
|
|
|
basesink->max_lateness = DEFAULT_MAX_LATENESS;
|
2008-04-17 07:14:46 +00:00
|
|
|
g_atomic_int_set (&priv->qos_enabled, DEFAULT_QOS);
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
priv->async_enabled = DEFAULT_ASYNC;
|
2007-08-30 17:50:54 +00:00
|
|
|
priv->ts_offset = DEFAULT_TS_OFFSET;
|
2008-12-15 12:47:59 +00:00
|
|
|
priv->render_delay = DEFAULT_RENDER_DELAY;
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
priv->blocksize = DEFAULT_BLOCKSIZE;
|
2010-10-20 15:41:28 +00:00
|
|
|
priv->cached_clock_id = NULL;
|
2011-12-01 15:46:06 +00:00
|
|
|
g_atomic_int_set (&priv->enable_last_sample, DEFAULT_ENABLE_LAST_SAMPLE);
|
2011-02-10 12:42:05 +00:00
|
|
|
priv->throttle_time = DEFAULT_THROTTLE_TIME;
|
2012-11-09 15:50:50 +00:00
|
|
|
priv->max_bitrate = DEFAULT_MAX_BITRATE;
|
2005-09-20 17:38:51 +00:00
|
|
|
|
2011-11-28 15:54:55 +00:00
|
|
|
GST_OBJECT_FLAG_SET (basesink, GST_ELEMENT_FLAG_SINK);
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|
|
|
|
|
2005-05-19 16:23:04 +00:00
|
|
|
static void
|
2005-06-28 12:01:49 +00:00
|
|
|
gst_base_sink_finalize (GObject * object)
|
2005-05-19 16:23:04 +00:00
|
|
|
{
|
|
|
|
GstBaseSink *basesink;
|
|
|
|
|
2005-07-10 12:03:13 +00:00
|
|
|
basesink = GST_BASE_SINK (object);
|
2005-05-19 16:23:04 +00:00
|
|
|
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_clear (&basesink->preroll_lock);
|
|
|
|
g_cond_clear (&basesink->preroll_cond);
|
2005-05-19 16:23:04 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2006-03-07 16:21:02 +00:00
|
|
|
/**
|
|
|
|
* gst_base_sink_set_sync:
|
|
|
|
* @sink: the sink
|
|
|
|
* @sync: the new sync value.
|
|
|
|
*
|
|
|
|
* Configures @sink to synchronize on the clock or not. When
|
2014-06-05 19:38:20 +00:00
|
|
|
* @sync is %FALSE, incoming samples will be played as fast as
|
|
|
|
* possible. If @sync is %TRUE, the timestamps of the incoming
|
2006-03-07 16:21:02 +00:00
|
|
|
* buffers will be used to schedule the exact render time of its
|
|
|
|
* contents.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_base_sink_set_sync (GstBaseSink * sink, gboolean sync)
|
|
|
|
{
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
g_return_if_fail (GST_IS_BASE_SINK (sink));
|
|
|
|
|
2006-03-07 16:21:02 +00:00
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
sink->sync = sync;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_sink_get_sync:
|
|
|
|
* @sink: the sink
|
|
|
|
*
|
|
|
|
* Checks if @sink is currently configured to synchronize against the
|
|
|
|
* clock.
|
|
|
|
*
|
2014-06-05 19:38:20 +00:00
|
|
|
* Returns: %TRUE if the sink is configured to synchronize against the clock.
|
2006-03-07 16:21:02 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_base_sink_get_sync (GstBaseSink * sink)
|
|
|
|
{
|
|
|
|
gboolean res;
|
|
|
|
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
g_return_val_if_fail (GST_IS_BASE_SINK (sink), FALSE);
|
|
|
|
|
2006-03-07 16:21:02 +00:00
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
res = sink->sync;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_sink_set_max_lateness:
|
|
|
|
* @sink: the sink
|
|
|
|
* @max_lateness: the new max lateness value.
|
|
|
|
*
|
|
|
|
* Sets the new max lateness value to @max_lateness. This value is
|
|
|
|
* used to decide if a buffer should be dropped or not based on the
|
|
|
|
* buffer timestamp and the current clock time. A value of -1 means
|
|
|
|
* an unlimited time.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_base_sink_set_max_lateness (GstBaseSink * sink, gint64 max_lateness)
|
|
|
|
{
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
g_return_if_fail (GST_IS_BASE_SINK (sink));
|
|
|
|
|
2006-03-07 16:21:02 +00:00
|
|
|
GST_OBJECT_LOCK (sink);
|
2011-02-22 18:09:48 +00:00
|
|
|
sink->max_lateness = max_lateness;
|
2006-03-07 16:21:02 +00:00
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_sink_get_max_lateness:
|
|
|
|
* @sink: the sink
|
|
|
|
*
|
|
|
|
* Gets the max lateness value. See gst_base_sink_set_max_lateness for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* Returns: The maximum time in nanoseconds that a buffer can be late
|
|
|
|
* before it is dropped and not rendered. A value of -1 means an
|
|
|
|
* unlimited time.
|
|
|
|
*/
|
|
|
|
gint64
|
|
|
|
gst_base_sink_get_max_lateness (GstBaseSink * sink)
|
|
|
|
{
|
|
|
|
gint64 res;
|
|
|
|
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
g_return_val_if_fail (GST_IS_BASE_SINK (sink), -1);
|
|
|
|
|
2006-03-07 16:21:02 +00:00
|
|
|
GST_OBJECT_LOCK (sink);
|
2011-02-22 18:09:48 +00:00
|
|
|
res = sink->max_lateness;
|
2006-03-07 16:21:02 +00:00
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
/**
|
|
|
|
* gst_base_sink_set_qos_enabled:
|
|
|
|
* @sink: the sink
|
2006-05-08 09:16:01 +00:00
|
|
|
* @enabled: the new qos value.
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
*
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
* Configures @sink to send Quality-of-Service events upstream.
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_base_sink_set_qos_enabled (GstBaseSink * sink, gboolean enabled)
|
|
|
|
{
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
g_return_if_fail (GST_IS_BASE_SINK (sink));
|
|
|
|
|
2008-04-17 07:14:46 +00:00
|
|
|
g_atomic_int_set (&sink->priv->qos_enabled, enabled);
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_sink_is_qos_enabled:
|
|
|
|
* @sink: the sink
|
|
|
|
*
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
* Checks if @sink is currently configured to send Quality-of-Service events
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
* upstream.
|
|
|
|
*
|
2014-06-05 19:38:20 +00:00
|
|
|
* Returns: %TRUE if the sink is configured to perform Quality-of-Service.
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_base_sink_is_qos_enabled (GstBaseSink * sink)
|
|
|
|
{
|
|
|
|
gboolean res;
|
|
|
|
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
g_return_val_if_fail (GST_IS_BASE_SINK (sink), FALSE);
|
|
|
|
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
res = g_atomic_int_get (&sink->priv->qos_enabled);
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
/**
|
|
|
|
* gst_base_sink_set_async_enabled:
|
|
|
|
* @sink: the sink
|
|
|
|
* @enabled: the new async value.
|
|
|
|
*
|
2013-12-07 14:38:19 +00:00
|
|
|
* Configures @sink to perform all state changes asynchronously. When async is
|
2011-09-07 11:14:38 +00:00
|
|
|
* disabled, the sink will immediately go to PAUSED instead of waiting for a
|
|
|
|
* preroll buffer. This feature is useful if the sink does not synchronize
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
* against the clock or when it is dealing with sparse streams.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_base_sink_set_async_enabled (GstBaseSink * sink, gboolean enabled)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_BASE_SINK (sink));
|
|
|
|
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_LOCK (sink);
|
2010-09-25 11:24:46 +00:00
|
|
|
g_atomic_int_set (&sink->priv->async_enabled, enabled);
|
2008-06-04 11:47:16 +00:00
|
|
|
GST_LOG_OBJECT (sink, "set async enabled to %d", enabled);
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (sink);
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_sink_is_async_enabled:
|
|
|
|
* @sink: the sink
|
|
|
|
*
|
|
|
|
* Checks if @sink is currently configured to perform asynchronous state
|
|
|
|
* changes to PAUSED.
|
|
|
|
*
|
2014-06-05 19:38:20 +00:00
|
|
|
* Returns: %TRUE if the sink is configured to perform asynchronous state
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
* changes.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_base_sink_is_async_enabled (GstBaseSink * sink)
|
|
|
|
{
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BASE_SINK (sink), FALSE);
|
|
|
|
|
2010-09-25 11:24:46 +00:00
|
|
|
res = g_atomic_int_get (&sink->priv->async_enabled);
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2007-08-30 17:50:54 +00:00
|
|
|
/**
|
|
|
|
* gst_base_sink_set_ts_offset:
|
|
|
|
* @sink: the sink
|
|
|
|
* @offset: the new offset
|
|
|
|
*
|
|
|
|
* Adjust the synchronisation of @sink with @offset. A negative value will
|
|
|
|
* render buffers earlier than their timestamp. A positive value will delay
|
|
|
|
* rendering. This function can be used to fix playback of badly timestamped
|
|
|
|
* buffers.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_base_sink_set_ts_offset (GstBaseSink * sink, GstClockTimeDiff offset)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_BASE_SINK (sink));
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
sink->priv->ts_offset = offset;
|
2008-06-04 11:47:16 +00:00
|
|
|
GST_LOG_OBJECT (sink, "set time offset to %" G_GINT64_FORMAT, offset);
|
2007-08-30 17:50:54 +00:00
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_sink_get_ts_offset:
|
|
|
|
* @sink: the sink
|
|
|
|
*
|
|
|
|
* Get the synchronisation offset of @sink.
|
|
|
|
*
|
|
|
|
* Returns: The synchronisation offset.
|
|
|
|
*/
|
|
|
|
GstClockTimeDiff
|
|
|
|
gst_base_sink_get_ts_offset (GstBaseSink * sink)
|
|
|
|
{
|
|
|
|
GstClockTimeDiff res;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BASE_SINK (sink), 0);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
res = sink->priv->ts_offset;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2007-10-30 18:30:13 +00:00
|
|
|
/**
|
2011-12-01 15:46:06 +00:00
|
|
|
* gst_base_sink_get_last_sample:
|
2007-10-30 18:30:13 +00:00
|
|
|
* @sink: the sink
|
|
|
|
*
|
2011-12-01 15:46:06 +00:00
|
|
|
* Get the last sample that arrived in the sink and was used for preroll or for
|
2007-10-30 18:30:13 +00:00
|
|
|
* rendering. This property can be used to generate thumbnails.
|
|
|
|
*
|
2011-12-01 15:46:06 +00:00
|
|
|
* The #GstCaps on the sample can be used to determine the type of the buffer.
|
2009-08-24 15:56:32 +00:00
|
|
|
*
|
2011-12-01 15:46:06 +00:00
|
|
|
* Free-function: gst_sample_unref
|
2010-12-07 18:35:56 +00:00
|
|
|
*
|
2014-06-12 00:12:20 +00:00
|
|
|
* Returns: (transfer full) (nullable): a #GstSample. gst_sample_unref() after
|
|
|
|
* usage. This function returns %NULL when no buffer has arrived in the
|
|
|
|
* sink yet or when the sink is not in PAUSED or PLAYING.
|
2007-10-30 18:30:13 +00:00
|
|
|
*/
|
2011-12-01 15:46:06 +00:00
|
|
|
GstSample *
|
|
|
|
gst_base_sink_get_last_sample (GstBaseSink * sink)
|
2007-10-30 18:30:13 +00:00
|
|
|
{
|
2011-12-01 15:46:06 +00:00
|
|
|
GstSample *res = NULL;
|
2007-10-30 18:30:13 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BASE_SINK (sink), NULL);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
2015-06-22 11:02:55 +00:00
|
|
|
if (sink->priv->last_buffer_list) {
|
|
|
|
GstBuffer *first_buffer = NULL;
|
|
|
|
|
|
|
|
/* Set the first buffer in the list to last sample's buffer */
|
|
|
|
first_buffer = gst_buffer_list_get (sink->priv->last_buffer_list, 0);
|
|
|
|
res =
|
|
|
|
gst_sample_new (first_buffer, sink->priv->last_caps, &sink->segment,
|
|
|
|
NULL);
|
|
|
|
gst_sample_set_buffer_list (res, sink->priv->last_buffer_list);
|
|
|
|
} else if (sink->priv->last_buffer) {
|
2011-12-01 15:46:06 +00:00
|
|
|
res = gst_sample_new (sink->priv->last_buffer,
|
|
|
|
sink->priv->last_caps, &sink->segment, NULL);
|
|
|
|
}
|
2007-10-30 18:30:13 +00:00
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2010-07-06 10:18:45 +00:00
|
|
|
/* with OBJECT_LOCK */
|
2007-10-30 18:30:13 +00:00
|
|
|
static void
|
2010-07-06 10:18:45 +00:00
|
|
|
gst_base_sink_set_last_buffer_unlocked (GstBaseSink * sink, GstBuffer * buffer)
|
2007-10-30 18:30:13 +00:00
|
|
|
{
|
2007-11-09 14:05:02 +00:00
|
|
|
GstBuffer *old;
|
|
|
|
|
|
|
|
old = sink->priv->last_buffer;
|
2009-02-03 11:52:49 +00:00
|
|
|
if (G_LIKELY (old != buffer)) {
|
|
|
|
GST_DEBUG_OBJECT (sink, "setting last buffer to %p", buffer);
|
|
|
|
if (G_LIKELY (buffer))
|
|
|
|
gst_buffer_ref (buffer);
|
|
|
|
sink->priv->last_buffer = buffer;
|
2011-12-01 15:46:06 +00:00
|
|
|
if (buffer)
|
|
|
|
/* copy over the caps */
|
|
|
|
gst_caps_replace (&sink->priv->last_caps, sink->priv->caps);
|
|
|
|
else
|
|
|
|
gst_caps_replace (&sink->priv->last_caps, NULL);
|
2009-02-03 11:52:49 +00:00
|
|
|
} else {
|
|
|
|
old = NULL;
|
|
|
|
}
|
|
|
|
/* avoid unreffing with the lock because cleanup code might want to take the
|
|
|
|
* lock too */
|
2010-07-06 10:18:45 +00:00
|
|
|
if (G_LIKELY (old)) {
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
2007-11-09 14:05:02 +00:00
|
|
|
gst_buffer_unref (old);
|
2010-07-06 10:18:45 +00:00
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-22 11:02:55 +00:00
|
|
|
/* with OBJECT_LOCK */
|
|
|
|
static void
|
|
|
|
gst_base_sink_set_last_buffer_list_unlocked (GstBaseSink * sink,
|
|
|
|
GstBufferList * buffer_list)
|
|
|
|
{
|
|
|
|
GstBufferList *old;
|
|
|
|
|
|
|
|
old = sink->priv->last_buffer_list;
|
|
|
|
if (G_LIKELY (old != buffer_list)) {
|
|
|
|
GST_DEBUG_OBJECT (sink, "setting last buffer list to %p", buffer_list);
|
|
|
|
if (G_LIKELY (buffer_list))
|
|
|
|
gst_mini_object_ref (GST_MINI_OBJECT_CAST (buffer_list));
|
|
|
|
sink->priv->last_buffer_list = buffer_list;
|
|
|
|
} else {
|
|
|
|
old = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* avoid unreffing with the lock because cleanup code might want to take the
|
|
|
|
* lock too */
|
|
|
|
if (G_LIKELY (old)) {
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (old));
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-06 10:18:45 +00:00
|
|
|
static void
|
|
|
|
gst_base_sink_set_last_buffer (GstBaseSink * sink, GstBuffer * buffer)
|
|
|
|
{
|
2011-12-01 15:46:06 +00:00
|
|
|
if (!g_atomic_int_get (&sink->priv->enable_last_sample))
|
2010-10-20 11:08:08 +00:00
|
|
|
return;
|
2010-07-06 10:18:45 +00:00
|
|
|
|
2010-10-20 11:08:08 +00:00
|
|
|
GST_OBJECT_LOCK (sink);
|
2010-07-06 10:18:45 +00:00
|
|
|
gst_base_sink_set_last_buffer_unlocked (sink, buffer);
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
2007-10-30 18:30:13 +00:00
|
|
|
}
|
|
|
|
|
2015-06-22 11:02:55 +00:00
|
|
|
static void
|
|
|
|
gst_base_sink_set_last_buffer_list (GstBaseSink * sink,
|
|
|
|
GstBufferList * buffer_list)
|
|
|
|
{
|
|
|
|
if (!g_atomic_int_get (&sink->priv->enable_last_sample))
|
|
|
|
return;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
gst_base_sink_set_last_buffer_list_unlocked (sink, buffer_list);
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
}
|
|
|
|
|
2010-07-06 14:21:05 +00:00
|
|
|
/**
|
2011-12-01 15:46:06 +00:00
|
|
|
* gst_base_sink_set_last_sample_enabled:
|
2010-07-06 14:21:05 +00:00
|
|
|
* @sink: the sink
|
2011-12-01 15:46:06 +00:00
|
|
|
* @enabled: the new enable-last-sample value.
|
2010-07-06 14:21:05 +00:00
|
|
|
*
|
2011-12-01 15:46:06 +00:00
|
|
|
* Configures @sink to store the last received sample in the last-sample
|
2010-07-06 14:21:05 +00:00
|
|
|
* property.
|
|
|
|
*/
|
|
|
|
void
|
2011-12-01 15:46:06 +00:00
|
|
|
gst_base_sink_set_last_sample_enabled (GstBaseSink * sink, gboolean enabled)
|
2010-07-06 14:21:05 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_BASE_SINK (sink));
|
|
|
|
|
2010-10-20 11:08:08 +00:00
|
|
|
/* Only take lock if we change the value */
|
2011-12-01 15:46:06 +00:00
|
|
|
if (g_atomic_int_compare_and_exchange (&sink->priv->enable_last_sample,
|
2010-10-20 11:08:08 +00:00
|
|
|
!enabled, enabled) && !enabled) {
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
gst_base_sink_set_last_buffer_unlocked (sink, NULL);
|
2015-06-22 11:02:55 +00:00
|
|
|
gst_base_sink_set_last_buffer_list_unlocked (sink, NULL);
|
2010-10-20 11:08:08 +00:00
|
|
|
GST_OBJECT_UNLOCK (sink);
|
2010-07-06 14:21:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-12-01 15:46:06 +00:00
|
|
|
* gst_base_sink_is_last_sample_enabled:
|
2010-07-06 14:21:05 +00:00
|
|
|
* @sink: the sink
|
|
|
|
*
|
2011-12-01 15:46:06 +00:00
|
|
|
* Checks if @sink is currently configured to store the last received sample in
|
|
|
|
* the last-sample property.
|
2010-07-06 14:21:05 +00:00
|
|
|
*
|
2014-06-05 19:38:20 +00:00
|
|
|
* Returns: %TRUE if the sink is configured to store the last received sample.
|
2010-07-06 14:21:05 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
2011-12-01 15:46:06 +00:00
|
|
|
gst_base_sink_is_last_sample_enabled (GstBaseSink * sink)
|
2010-07-06 14:21:05 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_IS_BASE_SINK (sink), FALSE);
|
|
|
|
|
2011-12-01 15:46:06 +00:00
|
|
|
return g_atomic_int_get (&sink->priv->enable_last_sample);
|
2010-07-06 14:21:05 +00:00
|
|
|
}
|
|
|
|
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
/**
|
|
|
|
* gst_base_sink_get_latency:
|
|
|
|
* @sink: the sink
|
|
|
|
*
|
|
|
|
* Get the currently configured latency.
|
|
|
|
*
|
|
|
|
* Returns: The configured latency.
|
|
|
|
*/
|
|
|
|
GstClockTime
|
|
|
|
gst_base_sink_get_latency (GstBaseSink * sink)
|
|
|
|
{
|
|
|
|
GstClockTime res;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
res = sink->priv->latency;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_sink_query_latency:
|
|
|
|
* @sink: the sink
|
2010-12-07 18:35:56 +00:00
|
|
|
* @live: (out) (allow-none): if the sink is live
|
|
|
|
* @upstream_live: (out) (allow-none): if an upstream element is live
|
|
|
|
* @min_latency: (out) (allow-none): the min latency of the upstream elements
|
|
|
|
* @max_latency: (out) (allow-none): the max latency of the upstream elements
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
*
|
|
|
|
* Query the sink for the latency parameters. The latency will be queried from
|
2014-06-05 19:38:20 +00:00
|
|
|
* the upstream elements. @live will be %TRUE if @sink is configured to
|
|
|
|
* synchronize against the clock. @upstream_live will be %TRUE if an upstream
|
2009-08-24 15:56:32 +00:00
|
|
|
* element is live.
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
*
|
2014-06-05 19:38:20 +00:00
|
|
|
* If both @live and @upstream_live are %TRUE, the sink will want to compensate
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
* for the latency introduced by the upstream elements by setting the
|
2013-12-07 14:38:19 +00:00
|
|
|
* @min_latency to a strictly positive value.
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
*
|
2009-08-24 15:56:32 +00:00
|
|
|
* This function is mostly used by subclasses.
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
*
|
2014-06-05 19:38:20 +00:00
|
|
|
* Returns: %TRUE if the query succeeded.
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_base_sink_query_latency (GstBaseSink * sink, gboolean * live,
|
|
|
|
gboolean * upstream_live, GstClockTime * min_latency,
|
|
|
|
GstClockTime * max_latency)
|
|
|
|
{
|
2007-09-24 12:29:23 +00:00
|
|
|
gboolean l, us_live, res, have_latency;
|
2008-06-20 08:54:45 +00:00
|
|
|
GstClockTime min, max, render_delay;
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
GstQuery *query;
|
2007-02-28 16:46:07 +00:00
|
|
|
GstClockTime us_min, us_max;
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
|
|
|
|
/* we are live when we sync to the clock */
|
2007-09-24 12:29:23 +00:00
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
l = sink->sync;
|
|
|
|
have_latency = sink->priv->have_latency;
|
2008-06-20 08:54:45 +00:00
|
|
|
render_delay = sink->priv->render_delay;
|
2007-09-24 12:29:23 +00:00
|
|
|
GST_OBJECT_UNLOCK (sink);
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
|
|
|
|
/* assume no latency */
|
|
|
|
min = 0;
|
|
|
|
max = -1;
|
|
|
|
us_live = FALSE;
|
2007-09-24 12:29:23 +00:00
|
|
|
|
2008-04-25 07:22:16 +00:00
|
|
|
if (have_latency) {
|
|
|
|
GST_DEBUG_OBJECT (sink, "we are ready for LATENCY query");
|
|
|
|
/* we are ready for a latency query this is when we preroll or when we are
|
|
|
|
* not async. */
|
|
|
|
query = gst_query_new_latency ();
|
|
|
|
|
|
|
|
/* ask the peer for the latency */
|
2011-05-17 09:20:05 +00:00
|
|
|
if ((res = gst_pad_peer_query (sink->sinkpad, query))) {
|
2007-09-24 12:46:17 +00:00
|
|
|
/* get upstream min and max latency */
|
|
|
|
gst_query_parse_latency (query, &us_live, &us_min, &us_max);
|
|
|
|
|
|
|
|
if (us_live) {
|
|
|
|
/* upstream live, use its latency, subclasses should use these
|
|
|
|
* values to create the complete latency. */
|
|
|
|
min = us_min;
|
|
|
|
max = us_max;
|
|
|
|
}
|
2008-06-20 08:54:45 +00:00
|
|
|
if (l) {
|
|
|
|
/* we need to add the render delay if we are live */
|
2015-02-11 12:41:56 +00:00
|
|
|
min += render_delay;
|
2008-06-20 08:54:45 +00:00
|
|
|
if (max != -1)
|
|
|
|
max += render_delay;
|
|
|
|
}
|
2007-09-24 12:29:23 +00:00
|
|
|
}
|
2008-04-25 07:22:16 +00:00
|
|
|
gst_query_unref (query);
|
2007-09-24 12:46:17 +00:00
|
|
|
} else {
|
2008-04-25 07:22:16 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "we are not yet ready for LATENCY query");
|
|
|
|
res = FALSE;
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
}
|
|
|
|
|
2008-04-25 07:22:16 +00:00
|
|
|
/* not live, we tried to do the query, if it failed we return TRUE anyway */
|
|
|
|
if (!res) {
|
|
|
|
if (!l) {
|
|
|
|
res = TRUE;
|
|
|
|
GST_DEBUG_OBJECT (sink, "latency query failed but we are not live");
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (sink, "latency query failed and we are live");
|
|
|
|
}
|
|
|
|
}
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
|
2008-04-25 07:22:16 +00:00
|
|
|
if (res) {
|
|
|
|
GST_DEBUG_OBJECT (sink, "latency query: live: %d, have_latency %d,"
|
|
|
|
" upstream: %d, min %" GST_TIME_FORMAT ", max %" GST_TIME_FORMAT, l,
|
|
|
|
have_latency, us_live, GST_TIME_ARGS (min), GST_TIME_ARGS (max));
|
2007-02-28 16:46:07 +00:00
|
|
|
|
2008-04-25 07:22:16 +00:00
|
|
|
if (live)
|
|
|
|
*live = l;
|
|
|
|
if (upstream_live)
|
|
|
|
*upstream_live = us_live;
|
|
|
|
if (min_latency)
|
|
|
|
*min_latency = min;
|
|
|
|
if (max_latency)
|
|
|
|
*max_latency = max;
|
2007-02-28 16:46:07 +00:00
|
|
|
}
|
2008-04-25 07:22:16 +00:00
|
|
|
return res;
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
}
|
|
|
|
|
2008-06-20 08:54:45 +00:00
|
|
|
/**
|
|
|
|
* gst_base_sink_set_render_delay:
|
|
|
|
* @sink: a #GstBaseSink
|
|
|
|
* @delay: the new delay
|
|
|
|
*
|
2009-08-24 15:56:32 +00:00
|
|
|
* Set the render delay in @sink to @delay. The render delay is the time
|
2008-06-20 08:54:45 +00:00
|
|
|
* between actual rendering of a buffer and its synchronisation time. Some
|
|
|
|
* devices might delay media rendering which can be compensated for with this
|
2009-08-24 15:56:32 +00:00
|
|
|
* function.
|
2008-06-20 08:54:45 +00:00
|
|
|
*
|
|
|
|
* After calling this function, this sink will report additional latency and
|
|
|
|
* other sinks will adjust their latency to delay the rendering of their media.
|
|
|
|
*
|
|
|
|
* This function is usually called by subclasses.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_base_sink_set_render_delay (GstBaseSink * sink, GstClockTime delay)
|
|
|
|
{
|
2008-11-20 14:23:05 +00:00
|
|
|
GstClockTime old_render_delay;
|
|
|
|
|
2008-06-20 08:54:45 +00:00
|
|
|
g_return_if_fail (GST_IS_BASE_SINK (sink));
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
2008-11-20 14:23:05 +00:00
|
|
|
old_render_delay = sink->priv->render_delay;
|
2008-06-20 08:54:45 +00:00
|
|
|
sink->priv->render_delay = delay;
|
|
|
|
GST_LOG_OBJECT (sink, "set render delay to %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (delay));
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
2008-11-20 14:23:05 +00:00
|
|
|
|
|
|
|
if (delay != old_render_delay) {
|
|
|
|
GST_DEBUG_OBJECT (sink, "posting latency changed");
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (sink),
|
|
|
|
gst_message_new_latency (GST_OBJECT_CAST (sink)));
|
|
|
|
}
|
2008-06-20 08:54:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_sink_get_render_delay:
|
|
|
|
* @sink: a #GstBaseSink
|
|
|
|
*
|
|
|
|
* Get the render delay of @sink. see gst_base_sink_set_render_delay() for more
|
|
|
|
* information about the render delay.
|
|
|
|
*
|
|
|
|
* Returns: the render delay of @sink.
|
|
|
|
*/
|
|
|
|
GstClockTime
|
|
|
|
gst_base_sink_get_render_delay (GstBaseSink * sink)
|
|
|
|
{
|
|
|
|
GstClockTimeDiff res;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BASE_SINK (sink), 0);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
res = sink->priv->render_delay;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
/**
|
|
|
|
* gst_base_sink_set_blocksize:
|
|
|
|
* @sink: a #GstBaseSink
|
|
|
|
* @blocksize: the blocksize in bytes
|
|
|
|
*
|
|
|
|
* Set the number of bytes that the sink will pull when it is operating in pull
|
|
|
|
* mode.
|
|
|
|
*/
|
2014-09-25 19:21:09 +00:00
|
|
|
/* FIXME 2.0: blocksize property should be int, otherwise min>max.. */
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
void
|
|
|
|
gst_base_sink_set_blocksize (GstBaseSink * sink, guint blocksize)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_BASE_SINK (sink));
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
sink->priv->blocksize = blocksize;
|
|
|
|
GST_LOG_OBJECT (sink, "set blocksize to %u", blocksize);
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_sink_get_blocksize:
|
|
|
|
* @sink: a #GstBaseSink
|
|
|
|
*
|
|
|
|
* Get the number of bytes that the sink will pull when it is operating in pull
|
|
|
|
* mode.
|
|
|
|
*
|
|
|
|
* Returns: the number of bytes @sink will pull in pull mode.
|
|
|
|
*/
|
2014-09-25 19:21:09 +00:00
|
|
|
/* FIXME 2.0: blocksize property should be int, otherwise min>max.. */
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
guint
|
|
|
|
gst_base_sink_get_blocksize (GstBaseSink * sink)
|
|
|
|
{
|
|
|
|
guint res;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BASE_SINK (sink), 0);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
res = sink->priv->blocksize;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2011-02-10 12:42:05 +00:00
|
|
|
/**
|
|
|
|
* gst_base_sink_set_throttle_time:
|
|
|
|
* @sink: a #GstBaseSink
|
|
|
|
* @throttle: the throttle time in nanoseconds
|
|
|
|
*
|
|
|
|
* Set the time that will be inserted between rendered buffers. This
|
|
|
|
* can be used to control the maximum buffers per second that the sink
|
|
|
|
* will render.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_base_sink_set_throttle_time (GstBaseSink * sink, guint64 throttle)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_BASE_SINK (sink));
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
sink->priv->throttle_time = throttle;
|
|
|
|
GST_LOG_OBJECT (sink, "set throttle_time to %" G_GUINT64_FORMAT, throttle);
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_sink_get_throttle_time:
|
|
|
|
* @sink: a #GstBaseSink
|
|
|
|
*
|
|
|
|
* Get the time that will be inserted between frames to control the
|
|
|
|
* maximum buffers per second.
|
|
|
|
*
|
|
|
|
* Returns: the number of nanoseconds @sink will put between frames.
|
|
|
|
*/
|
|
|
|
guint64
|
|
|
|
gst_base_sink_get_throttle_time (GstBaseSink * sink)
|
|
|
|
{
|
|
|
|
guint64 res;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BASE_SINK (sink), 0);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
res = sink->priv->throttle_time;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2012-11-09 15:50:50 +00:00
|
|
|
/**
|
|
|
|
* gst_base_sink_set_max_bitrate:
|
|
|
|
* @sink: a #GstBaseSink
|
|
|
|
* @max_bitrate: the max_bitrate in bits per second
|
|
|
|
*
|
|
|
|
* Set the maximum amount of bits per second that the sink will render.
|
|
|
|
*
|
2013-11-16 12:24:56 +00:00
|
|
|
* Since: 1.2
|
2012-11-09 15:50:50 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_base_sink_set_max_bitrate (GstBaseSink * sink, guint64 max_bitrate)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_BASE_SINK (sink));
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
sink->priv->max_bitrate = max_bitrate;
|
|
|
|
GST_LOG_OBJECT (sink, "set max_bitrate to %" G_GUINT64_FORMAT, max_bitrate);
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_sink_get_max_bitrate:
|
|
|
|
* @sink: a #GstBaseSink
|
|
|
|
*
|
|
|
|
* Get the maximum amount of bits per second that the sink will render.
|
|
|
|
*
|
|
|
|
* Returns: the maximum number of bits per second @sink will render.
|
|
|
|
*
|
2013-11-16 12:24:56 +00:00
|
|
|
* Since: 1.2
|
2012-11-09 15:50:50 +00:00
|
|
|
*/
|
|
|
|
guint64
|
|
|
|
gst_base_sink_get_max_bitrate (GstBaseSink * sink)
|
|
|
|
{
|
|
|
|
guint64 res;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BASE_SINK (sink), 0);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
res = sink->priv->max_bitrate;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
static void
|
2005-06-28 12:01:49 +00:00
|
|
|
gst_base_sink_set_property (GObject * object, guint prop_id,
|
2005-03-28 14:54:33 +00:00
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2005-08-26 14:21:43 +00:00
|
|
|
GstBaseSink *sink = GST_BASE_SINK (object);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2005-09-20 12:05:47 +00:00
|
|
|
case PROP_SYNC:
|
2006-03-07 16:21:02 +00:00
|
|
|
gst_base_sink_set_sync (sink, g_value_get_boolean (value));
|
2005-09-20 12:05:47 +00:00
|
|
|
break;
|
2006-03-06 16:02:37 +00:00
|
|
|
case PROP_MAX_LATENESS:
|
2006-03-07 16:21:02 +00:00
|
|
|
gst_base_sink_set_max_lateness (sink, g_value_get_int64 (value));
|
2006-03-06 16:02:37 +00:00
|
|
|
break;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
case PROP_QOS:
|
|
|
|
gst_base_sink_set_qos_enabled (sink, g_value_get_boolean (value));
|
|
|
|
break;
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
case PROP_ASYNC:
|
|
|
|
gst_base_sink_set_async_enabled (sink, g_value_get_boolean (value));
|
|
|
|
break;
|
2007-08-30 17:50:54 +00:00
|
|
|
case PROP_TS_OFFSET:
|
|
|
|
gst_base_sink_set_ts_offset (sink, g_value_get_int64 (value));
|
|
|
|
break;
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
case PROP_BLOCKSIZE:
|
|
|
|
gst_base_sink_set_blocksize (sink, g_value_get_uint (value));
|
|
|
|
break;
|
2008-12-15 12:47:59 +00:00
|
|
|
case PROP_RENDER_DELAY:
|
|
|
|
gst_base_sink_set_render_delay (sink, g_value_get_uint64 (value));
|
|
|
|
break;
|
2011-12-01 15:46:06 +00:00
|
|
|
case PROP_ENABLE_LAST_SAMPLE:
|
|
|
|
gst_base_sink_set_last_sample_enabled (sink, g_value_get_boolean (value));
|
2010-07-06 10:18:45 +00:00
|
|
|
break;
|
2011-02-10 12:42:05 +00:00
|
|
|
case PROP_THROTTLE_TIME:
|
|
|
|
gst_base_sink_set_throttle_time (sink, g_value_get_uint64 (value));
|
|
|
|
break;
|
2012-11-09 15:50:50 +00:00
|
|
|
case PROP_MAX_BITRATE:
|
|
|
|
gst_base_sink_set_max_bitrate (sink, g_value_get_uint64 (value));
|
|
|
|
break;
|
2005-03-28 14:54:33 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-06-28 12:01:49 +00:00
|
|
|
gst_base_sink_get_property (GObject * object, guint prop_id, GValue * value,
|
2005-03-28 14:54:33 +00:00
|
|
|
GParamSpec * pspec)
|
|
|
|
{
|
2005-08-26 14:21:43 +00:00
|
|
|
GstBaseSink *sink = GST_BASE_SINK (object);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2005-09-20 12:05:47 +00:00
|
|
|
case PROP_SYNC:
|
2006-03-07 16:21:02 +00:00
|
|
|
g_value_set_boolean (value, gst_base_sink_get_sync (sink));
|
2005-09-20 12:05:47 +00:00
|
|
|
break;
|
2006-03-06 16:02:37 +00:00
|
|
|
case PROP_MAX_LATENESS:
|
2006-03-07 16:21:02 +00:00
|
|
|
g_value_set_int64 (value, gst_base_sink_get_max_lateness (sink));
|
2006-03-06 16:02:37 +00:00
|
|
|
break;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
case PROP_QOS:
|
|
|
|
g_value_set_boolean (value, gst_base_sink_is_qos_enabled (sink));
|
|
|
|
break;
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
case PROP_ASYNC:
|
|
|
|
g_value_set_boolean (value, gst_base_sink_is_async_enabled (sink));
|
|
|
|
break;
|
2007-08-30 17:50:54 +00:00
|
|
|
case PROP_TS_OFFSET:
|
|
|
|
g_value_set_int64 (value, gst_base_sink_get_ts_offset (sink));
|
|
|
|
break;
|
2011-12-01 15:46:06 +00:00
|
|
|
case PROP_LAST_SAMPLE:
|
2015-05-25 11:02:28 +00:00
|
|
|
gst_value_take_sample (value, gst_base_sink_get_last_sample (sink));
|
2007-10-30 18:30:13 +00:00
|
|
|
break;
|
2011-12-01 15:46:06 +00:00
|
|
|
case PROP_ENABLE_LAST_SAMPLE:
|
|
|
|
g_value_set_boolean (value, gst_base_sink_is_last_sample_enabled (sink));
|
2010-07-06 10:18:45 +00:00
|
|
|
break;
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
case PROP_BLOCKSIZE:
|
|
|
|
g_value_set_uint (value, gst_base_sink_get_blocksize (sink));
|
|
|
|
break;
|
2008-12-15 12:47:59 +00:00
|
|
|
case PROP_RENDER_DELAY:
|
|
|
|
g_value_set_uint64 (value, gst_base_sink_get_render_delay (sink));
|
|
|
|
break;
|
2011-02-10 12:42:05 +00:00
|
|
|
case PROP_THROTTLE_TIME:
|
|
|
|
g_value_set_uint64 (value, gst_base_sink_get_throttle_time (sink));
|
|
|
|
break;
|
2012-11-09 15:50:50 +00:00
|
|
|
case PROP_MAX_BITRATE:
|
|
|
|
g_value_set_uint64 (value, gst_base_sink_get_max_bitrate (sink));
|
|
|
|
break;
|
2005-03-28 14:54:33 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-07 16:21:02 +00:00
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
static GstCaps *
|
2011-12-02 22:13:23 +00:00
|
|
|
gst_base_sink_default_get_caps (GstBaseSink * sink, GstCaps * filter)
|
2005-03-28 14:54:33 +00:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-12-02 22:13:23 +00:00
|
|
|
gst_base_sink_default_set_caps (GstBaseSink * sink, GstCaps * caps)
|
2005-03-28 14:54:33 +00:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
/* with PREROLL_LOCK, STREAM_LOCK */
|
check/: Small state change torture test.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/stress.c: (GST_START_TEST),
(simple_launch_lines_suite), (main):
Small state change torture test.
* docs/design/part-states.txt:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event), (do_playing),
(gst_base_sink_change_state):
Never take state lock from streaming thread, clean up ugly
hacks. Unfortunatly core does not yet support nice ways to
async commit state.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_recalc_state),
(bin_bus_handler):
Start state recalc if a STATE_DIRTY message is posted, but only
on the toplevel bin.
* gst/gstelement.c: (gst_element_sync_state_with_parent),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state_func), (gst_element_change_state):
* gst/gstelement.h:
State variables are now protected with the LOCK, the state
lock is only used to serialize _set_state().
2005-10-18 17:06:29 +00:00
|
|
|
static gboolean
|
|
|
|
gst_base_sink_commit_state (GstBaseSink * basesink)
|
|
|
|
{
|
|
|
|
/* commit state and proceed to next pending state */
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
GstState current, next, pending, post_pending;
|
|
|
|
gboolean post_paused = FALSE;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
gboolean post_async_done = FALSE;
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
gboolean post_playing = FALSE;
|
check/: Small state change torture test.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/stress.c: (GST_START_TEST),
(simple_launch_lines_suite), (main):
Small state change torture test.
* docs/design/part-states.txt:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event), (do_playing),
(gst_base_sink_change_state):
Never take state lock from streaming thread, clean up ugly
hacks. Unfortunatly core does not yet support nice ways to
async commit state.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_recalc_state),
(bin_bus_handler):
Start state recalc if a STATE_DIRTY message is posted, but only
on the toplevel bin.
* gst/gstelement.c: (gst_element_sync_state_with_parent),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state_func), (gst_element_change_state):
* gst/gstelement.h:
State variables are now protected with the LOCK, the state
lock is only used to serialize _set_state().
2005-10-18 17:06:29 +00:00
|
|
|
|
2006-09-15 09:49:14 +00:00
|
|
|
/* we are certainly not playing async anymore now */
|
|
|
|
basesink->playing_async = FALSE;
|
|
|
|
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
GST_OBJECT_LOCK (basesink);
|
|
|
|
current = GST_STATE (basesink);
|
|
|
|
next = GST_STATE_NEXT (basesink);
|
|
|
|
pending = GST_STATE_PENDING (basesink);
|
|
|
|
post_pending = pending;
|
check/: Small state change torture test.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/stress.c: (GST_START_TEST),
(simple_launch_lines_suite), (main):
Small state change torture test.
* docs/design/part-states.txt:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event), (do_playing),
(gst_base_sink_change_state):
Never take state lock from streaming thread, clean up ugly
hacks. Unfortunatly core does not yet support nice ways to
async commit state.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_recalc_state),
(bin_bus_handler):
Start state recalc if a STATE_DIRTY message is posted, but only
on the toplevel bin.
* gst/gstelement.c: (gst_element_sync_state_with_parent),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state_func), (gst_element_change_state):
* gst/gstelement.h:
State variables are now protected with the LOCK, the state
lock is only used to serialize _set_state().
2005-10-18 17:06:29 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
switch (pending) {
|
|
|
|
case GST_STATE_PLAYING:
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
{
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "commiting state to PLAYING");
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
basesink->need_preroll = FALSE;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
post_async_done = TRUE;
|
|
|
|
basesink->priv->commited = TRUE;
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
post_playing = TRUE;
|
|
|
|
/* post PAUSED too when we were READY */
|
|
|
|
if (current == GST_STATE_READY) {
|
|
|
|
post_paused = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
}
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
case GST_STATE_PAUSED:
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "commiting state to PAUSED");
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
post_paused = TRUE;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
post_async_done = TRUE;
|
|
|
|
basesink->priv->commited = TRUE;
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
post_pending = GST_STATE_VOID_PENDING;
|
|
|
|
break;
|
|
|
|
case GST_STATE_READY:
|
|
|
|
case GST_STATE_NULL:
|
|
|
|
goto stopping;
|
|
|
|
case GST_STATE_VOID_PENDING:
|
|
|
|
goto nothing_pending;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-09-14 15:52:27 +00:00
|
|
|
/* we can report latency queries now */
|
|
|
|
basesink->priv->have_latency = TRUE;
|
|
|
|
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
GST_STATE (basesink) = pending;
|
|
|
|
GST_STATE_NEXT (basesink) = GST_STATE_VOID_PENDING;
|
|
|
|
GST_STATE_PENDING (basesink) = GST_STATE_VOID_PENDING;
|
|
|
|
GST_STATE_RETURN (basesink) = GST_STATE_CHANGE_SUCCESS;
|
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
check/: Small state change torture test.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/stress.c: (GST_START_TEST),
(simple_launch_lines_suite), (main):
Small state change torture test.
* docs/design/part-states.txt:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event), (do_playing),
(gst_base_sink_change_state):
Never take state lock from streaming thread, clean up ugly
hacks. Unfortunatly core does not yet support nice ways to
async commit state.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_recalc_state),
(bin_bus_handler):
Start state recalc if a STATE_DIRTY message is posted, but only
on the toplevel bin.
* gst/gstelement.c: (gst_element_sync_state_with_parent),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state_func), (gst_element_change_state):
* gst/gstelement.h:
State variables are now protected with the LOCK, the state
lock is only used to serialize _set_state().
2005-10-18 17:06:29 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
if (post_paused) {
|
2007-08-16 10:07:48 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "posting PAUSED state change message");
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
|
|
|
gst_message_new_state_changed (GST_OBJECT_CAST (basesink),
|
|
|
|
current, next, post_pending));
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
}
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
if (post_async_done) {
|
2007-08-16 10:07:48 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "posting async-done message");
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
2012-06-13 08:52:48 +00:00
|
|
|
gst_message_new_async_done (GST_OBJECT_CAST (basesink),
|
|
|
|
GST_CLOCK_TIME_NONE));
|
check/: Small state change torture test.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/stress.c: (GST_START_TEST),
(simple_launch_lines_suite), (main):
Small state change torture test.
* docs/design/part-states.txt:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event), (do_playing),
(gst_base_sink_change_state):
Never take state lock from streaming thread, clean up ugly
hacks. Unfortunatly core does not yet support nice ways to
async commit state.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_recalc_state),
(bin_bus_handler):
Start state recalc if a STATE_DIRTY message is posted, but only
on the toplevel bin.
* gst/gstelement.c: (gst_element_sync_state_with_parent),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state_func), (gst_element_change_state):
* gst/gstelement.h:
State variables are now protected with the LOCK, the state
lock is only used to serialize _set_state().
2005-10-18 17:06:29 +00:00
|
|
|
}
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
if (post_playing) {
|
2013-06-17 08:25:20 +00:00
|
|
|
if (post_paused) {
|
|
|
|
GstElementClass *klass;
|
|
|
|
|
|
|
|
klass = GST_ELEMENT_GET_CLASS (basesink);
|
|
|
|
basesink->have_preroll = TRUE;
|
|
|
|
/* after releasing this lock, the state change function
|
|
|
|
* can execute concurrently with this thread. There is nothing we do to
|
|
|
|
* prevent this for now. subclasses should be prepared to handle it. */
|
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (basesink);
|
|
|
|
|
|
|
|
if (klass->change_state)
|
|
|
|
klass->change_state (GST_ELEMENT_CAST (basesink),
|
|
|
|
GST_STATE_CHANGE_PAUSED_TO_PLAYING);
|
|
|
|
|
|
|
|
GST_BASE_SINK_PREROLL_LOCK (basesink);
|
|
|
|
/* state change function could have been executed and we could be
|
|
|
|
* flushing now */
|
|
|
|
if (G_UNLIKELY (basesink->flushing))
|
2014-10-24 11:51:07 +00:00
|
|
|
goto stopping_unlocked;
|
2013-06-17 08:25:20 +00:00
|
|
|
}
|
2007-08-16 10:07:48 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "posting PLAYING state change message");
|
2013-06-17 08:25:20 +00:00
|
|
|
/* FIXME, we released the PREROLL lock above, it's possible that this
|
|
|
|
* message is not correct anymore when the element went back to PAUSED */
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
gst_message_new_state_changed (GST_OBJECT_CAST (basesink),
|
|
|
|
next, pending, GST_STATE_VOID_PENDING));
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_STATE_BROADCAST (basesink);
|
|
|
|
|
check/: Small state change torture test.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/stress.c: (GST_START_TEST),
(simple_launch_lines_suite), (main):
Small state change torture test.
* docs/design/part-states.txt:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event), (do_playing),
(gst_base_sink_change_state):
Never take state lock from streaming thread, clean up ugly
hacks. Unfortunatly core does not yet support nice ways to
async commit state.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_recalc_state),
(bin_bus_handler):
Start state recalc if a STATE_DIRTY message is posted, but only
on the toplevel bin.
* gst/gstelement.c: (gst_element_sync_state_with_parent),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state_func), (gst_element_change_state):
* gst/gstelement.h:
State variables are now protected with the LOCK, the state
lock is only used to serialize _set_state().
2005-10-18 17:06:29 +00:00
|
|
|
return TRUE;
|
|
|
|
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
nothing_pending:
|
|
|
|
{
|
2006-09-15 09:49:14 +00:00
|
|
|
/* Depending on the state, set our vars. We get in this situation when the
|
|
|
|
* state change function got a change to update the state vars before the
|
|
|
|
* streaming thread did. This is fine but we need to make sure that we
|
2014-06-05 19:38:20 +00:00
|
|
|
* update the need_preroll var since it was %TRUE when we got here and might
|
|
|
|
* become %FALSE if we got to PLAYING. */
|
2006-09-15 09:49:14 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "nothing to commit, now in %s",
|
|
|
|
gst_element_state_get_name (current));
|
|
|
|
switch (current) {
|
|
|
|
case GST_STATE_PLAYING:
|
|
|
|
basesink->need_preroll = FALSE;
|
|
|
|
break;
|
|
|
|
case GST_STATE_PAUSED:
|
|
|
|
basesink->need_preroll = TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
basesink->need_preroll = FALSE;
|
|
|
|
basesink->flushing = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2007-09-14 15:52:27 +00:00
|
|
|
/* we can report latency queries now */
|
|
|
|
basesink->priv->have_latency = TRUE;
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2014-10-24 11:51:07 +00:00
|
|
|
stopping_unlocked:
|
|
|
|
{
|
|
|
|
GST_OBJECT_LOCK (basesink);
|
|
|
|
goto stopping;
|
|
|
|
}
|
check/: Small state change torture test.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/stress.c: (GST_START_TEST),
(simple_launch_lines_suite), (main):
Small state change torture test.
* docs/design/part-states.txt:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event), (do_playing),
(gst_base_sink_change_state):
Never take state lock from streaming thread, clean up ugly
hacks. Unfortunatly core does not yet support nice ways to
async commit state.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_recalc_state),
(bin_bus_handler):
Start state recalc if a STATE_DIRTY message is posted, but only
on the toplevel bin.
* gst/gstelement.c: (gst_element_sync_state_with_parent),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state_func), (gst_element_change_state):
* gst/gstelement.h:
State variables are now protected with the LOCK, the state
lock is only used to serialize _set_state().
2005-10-18 17:06:29 +00:00
|
|
|
stopping:
|
|
|
|
{
|
|
|
|
/* app is going to READY */
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "stopping");
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
basesink->need_preroll = FALSE;
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
basesink->flushing = TRUE;
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
check/: Small state change torture test.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/stress.c: (GST_START_TEST),
(simple_launch_lines_suite), (main):
Small state change torture test.
* docs/design/part-states.txt:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event), (do_playing),
(gst_base_sink_change_state):
Never take state lock from streaming thread, clean up ugly
hacks. Unfortunatly core does not yet support nice ways to
async commit state.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_recalc_state),
(bin_bus_handler):
Start state recalc if a STATE_DIRTY message is posted, but only
on the toplevel bin.
* gst/gstelement.c: (gst_element_sync_state_with_parent),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state_func), (gst_element_change_state):
* gst/gstelement.h:
State variables are now protected with the LOCK, the state
lock is only used to serialize _set_state().
2005-10-18 17:06:29 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-14 17:29:08 +00:00
|
|
|
static void
|
|
|
|
start_stepping (GstBaseSink * sink, GstSegment * segment,
|
|
|
|
GstStepInfo * pending, GstStepInfo * current)
|
|
|
|
{
|
2009-06-09 08:25:34 +00:00
|
|
|
gint64 end;
|
2009-06-10 13:51:40 +00:00
|
|
|
GstMessage *message;
|
2009-06-09 08:25:34 +00:00
|
|
|
|
2009-05-14 17:29:08 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "update pending step");
|
2009-06-08 15:39:47 +00:00
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
2009-05-14 17:29:08 +00:00
|
|
|
memcpy (current, pending, sizeof (GstStepInfo));
|
|
|
|
pending->valid = FALSE;
|
2009-06-08 15:39:47 +00:00
|
|
|
GST_OBJECT_UNLOCK (sink);
|
2009-05-14 17:29:08 +00:00
|
|
|
|
2009-06-10 13:51:40 +00:00
|
|
|
/* post message first */
|
2009-06-12 11:18:21 +00:00
|
|
|
message =
|
|
|
|
gst_message_new_step_start (GST_OBJECT (sink), TRUE, current->format,
|
|
|
|
current->amount, current->rate, current->flush, current->intermediate);
|
2009-06-10 13:51:40 +00:00
|
|
|
gst_message_set_seqnum (message, current->seqnum);
|
|
|
|
gst_element_post_message (GST_ELEMENT (sink), message);
|
|
|
|
|
2009-05-29 14:06:52 +00:00
|
|
|
/* get the running time of where we paused and remember it */
|
|
|
|
current->start = gst_element_get_start_time (GST_ELEMENT_CAST (sink));
|
2009-06-04 10:34:47 +00:00
|
|
|
gst_segment_set_running_time (segment, GST_FORMAT_TIME, current->start);
|
2009-05-14 17:29:08 +00:00
|
|
|
|
2009-06-04 10:34:47 +00:00
|
|
|
/* set the new rate for the remainder of the segment */
|
|
|
|
current->start_rate = segment->rate;
|
2009-06-08 14:27:36 +00:00
|
|
|
segment->rate *= current->rate;
|
2009-05-14 17:29:08 +00:00
|
|
|
|
2009-06-09 10:06:35 +00:00
|
|
|
/* save values */
|
|
|
|
if (segment->rate > 0.0)
|
2009-06-09 08:25:34 +00:00
|
|
|
current->start_stop = segment->stop;
|
2009-06-09 10:06:35 +00:00
|
|
|
else
|
|
|
|
current->start_start = segment->start;
|
|
|
|
|
|
|
|
if (current->format == GST_FORMAT_TIME) {
|
2012-07-18 09:17:23 +00:00
|
|
|
/* calculate the running-time when the step operation should stop */
|
|
|
|
if (current->amount != -1)
|
|
|
|
end = current->start + current->amount;
|
|
|
|
else
|
|
|
|
end = -1;
|
|
|
|
|
2009-06-09 10:06:35 +00:00
|
|
|
if (!current->flush) {
|
2012-07-18 09:17:23 +00:00
|
|
|
gint64 position;
|
|
|
|
|
2009-06-09 10:06:35 +00:00
|
|
|
/* update the segment clipping regions for non-flushing seeks */
|
2009-06-12 11:18:21 +00:00
|
|
|
if (segment->rate > 0.0) {
|
2012-07-18 09:17:23 +00:00
|
|
|
if (end != -1)
|
2015-09-02 14:58:38 +00:00
|
|
|
position =
|
|
|
|
gst_segment_position_from_running_time (segment, GST_FORMAT_TIME,
|
|
|
|
end);
|
2012-07-18 09:17:23 +00:00
|
|
|
else
|
|
|
|
position = segment->stop;
|
|
|
|
|
|
|
|
segment->stop = position;
|
|
|
|
segment->position = position;
|
2009-06-12 11:18:21 +00:00
|
|
|
} else {
|
2012-07-18 09:17:23 +00:00
|
|
|
if (end != -1)
|
2015-09-02 14:58:38 +00:00
|
|
|
position =
|
|
|
|
gst_segment_position_from_running_time (segment, GST_FORMAT_TIME,
|
|
|
|
end);
|
2012-07-18 09:17:23 +00:00
|
|
|
else
|
|
|
|
position = segment->start;
|
2009-06-12 11:18:21 +00:00
|
|
|
|
|
|
|
segment->time = position;
|
|
|
|
segment->start = position;
|
2011-05-13 16:07:24 +00:00
|
|
|
segment->position = position;
|
2009-06-12 11:18:21 +00:00
|
|
|
}
|
2009-06-09 10:06:35 +00:00
|
|
|
}
|
2009-06-09 08:25:34 +00:00
|
|
|
}
|
|
|
|
|
2011-05-13 16:07:24 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "segment now %" GST_SEGMENT_FORMAT, segment);
|
2009-05-15 10:05:44 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "step started at running_time %" GST_TIME_FORMAT,
|
2009-05-18 13:48:20 +00:00
|
|
|
GST_TIME_ARGS (current->start));
|
2009-05-15 10:05:44 +00:00
|
|
|
|
2012-07-11 10:37:05 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "step amount: %" G_GUINT64_FORMAT ", format: %s, "
|
|
|
|
"rate: %f", current->amount, gst_format_get_name (current->format),
|
|
|
|
current->rate);
|
2009-05-14 17:29:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
stop_stepping (GstBaseSink * sink, GstSegment * segment,
|
2009-06-12 11:18:21 +00:00
|
|
|
GstStepInfo * current, gint64 rstart, gint64 rstop, gboolean eos)
|
2009-05-14 17:29:08 +00:00
|
|
|
{
|
2009-06-08 14:27:36 +00:00
|
|
|
gint64 stop, position;
|
2009-05-14 17:29:08 +00:00
|
|
|
GstMessage *message;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sink, "step complete");
|
|
|
|
|
2009-06-04 10:34:47 +00:00
|
|
|
if (segment->rate > 0.0)
|
2009-06-09 08:25:34 +00:00
|
|
|
stop = rstart;
|
2009-06-04 10:34:47 +00:00
|
|
|
else
|
2009-06-09 08:25:34 +00:00
|
|
|
stop = rstop;
|
2009-06-04 10:34:47 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"step stop at running_time %" GST_TIME_FORMAT, GST_TIME_ARGS (stop));
|
|
|
|
|
|
|
|
if (stop == -1)
|
|
|
|
current->duration = current->position;
|
|
|
|
else
|
|
|
|
current->duration = stop - current->start;
|
2009-05-15 13:25:06 +00:00
|
|
|
|
2009-05-19 08:50:57 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "step elapsed running_time %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (current->duration));
|
|
|
|
|
2009-06-08 14:27:36 +00:00
|
|
|
position = current->start + current->duration;
|
|
|
|
|
2009-06-09 08:25:34 +00:00
|
|
|
/* now move the segment to the new running time */
|
|
|
|
gst_segment_set_running_time (segment, GST_FORMAT_TIME, position);
|
2009-06-08 14:27:36 +00:00
|
|
|
|
|
|
|
if (current->flush) {
|
2011-05-13 16:07:24 +00:00
|
|
|
/* and remove the time we flushed, start time did not change */
|
|
|
|
segment->base = current->start;
|
2009-06-09 10:06:35 +00:00
|
|
|
} else {
|
|
|
|
/* start time is now the stepped position */
|
|
|
|
gst_element_set_start_time (GST_ELEMENT_CAST (sink), position);
|
2009-06-08 14:27:36 +00:00
|
|
|
}
|
2009-06-04 10:34:47 +00:00
|
|
|
|
2009-06-09 08:25:34 +00:00
|
|
|
/* restore the previous rate */
|
|
|
|
segment->rate = current->start_rate;
|
2009-06-09 10:06:35 +00:00
|
|
|
|
|
|
|
if (segment->rate > 0.0)
|
|
|
|
segment->stop = current->start_stop;
|
|
|
|
else
|
|
|
|
segment->start = current->start_start;
|
2009-06-09 08:25:34 +00:00
|
|
|
|
2009-06-08 14:27:36 +00:00
|
|
|
/* post the step done when we know the stepped duration in TIME */
|
2009-05-14 17:29:08 +00:00
|
|
|
message =
|
|
|
|
gst_message_new_step_done (GST_OBJECT_CAST (sink), current->format,
|
2009-05-18 13:48:20 +00:00
|
|
|
current->amount, current->rate, current->flush, current->intermediate,
|
2009-06-12 11:18:21 +00:00
|
|
|
current->duration, eos);
|
2009-05-14 17:29:08 +00:00
|
|
|
gst_message_set_seqnum (message, current->seqnum);
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (sink), message);
|
|
|
|
|
|
|
|
if (!current->intermediate)
|
|
|
|
sink->need_preroll = current->need_preroll;
|
2009-05-15 10:05:44 +00:00
|
|
|
|
|
|
|
/* and the current step info finished and becomes invalid */
|
2009-05-14 17:29:08 +00:00
|
|
|
current->valid = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
handle_stepping (GstBaseSink * sink, GstSegment * segment,
|
2011-05-13 16:07:24 +00:00
|
|
|
GstStepInfo * current, guint64 * cstart, guint64 * cstop, guint64 * rstart,
|
|
|
|
guint64 * rstop)
|
2009-05-14 17:29:08 +00:00
|
|
|
{
|
|
|
|
gboolean step_end = FALSE;
|
|
|
|
|
2012-07-18 09:17:23 +00:00
|
|
|
/* stepping never stops */
|
2012-07-11 10:37:05 +00:00
|
|
|
if (current->amount == -1)
|
2012-07-18 09:17:23 +00:00
|
|
|
return FALSE;
|
2012-07-11 10:37:05 +00:00
|
|
|
|
2009-05-14 17:29:08 +00:00
|
|
|
/* see if we need to skip this buffer because of stepping */
|
|
|
|
switch (current->format) {
|
|
|
|
case GST_FORMAT_TIME:
|
2009-05-15 13:25:06 +00:00
|
|
|
{
|
|
|
|
guint64 end;
|
2011-05-13 16:07:24 +00:00
|
|
|
guint64 first, last;
|
2011-05-09 14:39:13 +00:00
|
|
|
gdouble abs_rate;
|
2009-05-15 13:25:06 +00:00
|
|
|
|
2009-05-19 08:50:57 +00:00
|
|
|
if (segment->rate > 0.0) {
|
2009-11-28 21:29:29 +00:00
|
|
|
if (segment->stop == *cstop)
|
|
|
|
*rstop = *rstart + current->amount;
|
|
|
|
|
2009-05-31 17:10:02 +00:00
|
|
|
first = *rstart;
|
2009-05-19 08:50:57 +00:00
|
|
|
last = *rstop;
|
|
|
|
} else {
|
2009-11-28 21:29:29 +00:00
|
|
|
if (segment->start == *cstart)
|
|
|
|
*rstart = *rstop + current->amount;
|
|
|
|
|
2009-05-31 17:10:02 +00:00
|
|
|
first = *rstop;
|
2009-05-19 08:50:57 +00:00
|
|
|
last = *rstart;
|
|
|
|
}
|
2009-05-15 13:25:06 +00:00
|
|
|
|
2009-05-31 17:10:02 +00:00
|
|
|
end = current->start + current->amount;
|
|
|
|
current->position = first - current->start;
|
|
|
|
|
2011-05-09 14:39:13 +00:00
|
|
|
abs_rate = ABS (segment->rate);
|
|
|
|
if (G_UNLIKELY (abs_rate != 1.0))
|
|
|
|
current->position /= abs_rate;
|
2009-06-08 14:27:36 +00:00
|
|
|
|
2009-05-14 17:29:08 +00:00
|
|
|
GST_DEBUG_OBJECT (sink,
|
2009-05-31 17:10:02 +00:00
|
|
|
"buffer: %" GST_TIME_FORMAT "-%" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (first), GST_TIME_ARGS (last));
|
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"got time step %" GST_TIME_FORMAT "-%" GST_TIME_FORMAT "/%"
|
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (current->position),
|
|
|
|
GST_TIME_ARGS (last - current->start),
|
|
|
|
GST_TIME_ARGS (current->amount));
|
2009-05-15 13:25:06 +00:00
|
|
|
|
2009-06-09 08:25:34 +00:00
|
|
|
if ((current->flush && current->position >= current->amount)
|
|
|
|
|| last >= end) {
|
2009-05-31 17:10:02 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "step ended, we need clipping");
|
2009-05-15 13:25:06 +00:00
|
|
|
step_end = TRUE;
|
2009-05-19 08:50:57 +00:00
|
|
|
if (segment->rate > 0.0) {
|
|
|
|
*rstart = end;
|
2015-09-02 14:58:38 +00:00
|
|
|
*cstart =
|
|
|
|
gst_segment_position_from_running_time (segment, GST_FORMAT_TIME,
|
|
|
|
end);
|
2009-05-19 08:50:57 +00:00
|
|
|
} else {
|
|
|
|
*rstop = end;
|
2015-09-02 14:58:38 +00:00
|
|
|
*cstop =
|
|
|
|
gst_segment_position_from_running_time (segment, GST_FORMAT_TIME,
|
|
|
|
end);
|
2009-05-19 08:50:57 +00:00
|
|
|
}
|
2009-05-15 13:25:06 +00:00
|
|
|
}
|
2009-05-31 17:10:02 +00:00
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"cstart %" GST_TIME_FORMAT ", rstart %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (*cstart), GST_TIME_ARGS (*rstart));
|
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"cstop %" GST_TIME_FORMAT ", rstop %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (*cstop), GST_TIME_ARGS (*rstop));
|
2009-05-14 17:29:08 +00:00
|
|
|
break;
|
2009-05-15 13:25:06 +00:00
|
|
|
}
|
2009-05-14 17:29:08 +00:00
|
|
|
case GST_FORMAT_BUFFERS:
|
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"got default step %" G_GUINT64_FORMAT "/%" G_GUINT64_FORMAT,
|
2009-05-15 13:25:06 +00:00
|
|
|
current->position, current->amount);
|
2009-05-14 17:29:08 +00:00
|
|
|
|
2009-05-15 13:25:06 +00:00
|
|
|
if (current->position < current->amount) {
|
|
|
|
current->position++;
|
2009-05-14 17:29:08 +00:00
|
|
|
} else {
|
|
|
|
step_end = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
default:
|
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"got unknown step %" G_GUINT64_FORMAT "/%" G_GUINT64_FORMAT,
|
2009-05-15 13:25:06 +00:00
|
|
|
current->position, current->amount);
|
2009-05-14 17:29:08 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return step_end;
|
|
|
|
}
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
|
|
|
|
/* with STREAM_LOCK, PREROLL_LOCK
|
|
|
|
*
|
2014-06-05 19:38:20 +00:00
|
|
|
* Returns %TRUE if the object needs synchronisation and takes therefore
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
* part in prerolling.
|
|
|
|
*
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
* rsstart/rsstop contain the start/stop in stream time.
|
|
|
|
* rrstart/rrstop contain the start/stop in running time.
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
gst_base_sink_get_sync_times (GstBaseSink * basesink, GstMiniObject * obj,
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
GstClockTime * rsstart, GstClockTime * rsstop,
|
2013-02-05 16:19:50 +00:00
|
|
|
GstClockTime * rrstart, GstClockTime * rrstop, GstClockTime * rrnext,
|
|
|
|
gboolean * do_sync, gboolean * stepped, GstStepInfo * step,
|
|
|
|
gboolean * step_end)
|
2005-03-28 14:54:33 +00:00
|
|
|
{
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
GstBaseSinkClass *bclass;
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
GstClockTime start, stop; /* raw start/stop timestamps */
|
2011-05-13 16:07:24 +00:00
|
|
|
guint64 cstart, cstop; /* clipped raw timestamps */
|
2013-02-05 16:19:50 +00:00
|
|
|
guint64 rstart, rstop, rnext; /* clipped timestamps converted to running time */
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
GstClockTime sstart, sstop; /* clipped timestamps converted to stream time */
|
2006-04-07 14:50:06 +00:00
|
|
|
GstFormat format;
|
libs/gst/base/gstbasesink.c: Don't try to report a 0 position when we don't know, return -1 and FALSE instead. This m...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_do_sync), (gst_base_sink_preroll_object),
(gst_base_sink_event), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_change_state):
Don't try to report a 0 position when we don't know, return -1 and FALSE
instead. This mostly happens when we are prerolling.
Make sure we can report the right position before we post the ASYNC_DONE
message so that a message handler can query position without races.
* tests/check/generic/sinks.c: (send_eos), (GST_START_TEST),
(async_done_handoff), (async_done_func), (send_buffer),
(async_done_eos_func), (gst_sinks_suite):
Add two tests for the above.
2007-11-06 10:33:22 +00:00
|
|
|
GstBaseSinkPrivate *priv;
|
2011-12-02 12:35:58 +00:00
|
|
|
GstSegment *segment;
|
2009-06-12 11:18:21 +00:00
|
|
|
gboolean eos;
|
libs/gst/base/gstbasesink.c: Don't try to report a 0 position when we don't know, return -1 and FALSE instead. This m...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_do_sync), (gst_base_sink_preroll_object),
(gst_base_sink_event), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_change_state):
Don't try to report a 0 position when we don't know, return -1 and FALSE
instead. This mostly happens when we are prerolling.
Make sure we can report the right position before we post the ASYNC_DONE
message so that a message handler can query position without races.
* tests/check/generic/sinks.c: (send_eos), (GST_START_TEST),
(async_done_handoff), (async_done_func), (send_buffer),
(async_done_eos_func), (gst_sinks_suite):
Add two tests for the above.
2007-11-06 10:33:22 +00:00
|
|
|
|
|
|
|
priv = basesink->priv;
|
2011-12-02 12:35:58 +00:00
|
|
|
segment = &basesink->segment;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
2012-06-19 14:08:00 +00:00
|
|
|
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
|
|
|
|
2012-06-19 14:14:46 +00:00
|
|
|
again:
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
/* start with nothing */
|
2009-10-09 14:11:27 +00:00
|
|
|
start = stop = GST_CLOCK_TIME_NONE;
|
2012-06-19 14:14:46 +00:00
|
|
|
eos = FALSE;
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2011-12-03 05:29:42 +00:00
|
|
|
if (G_UNLIKELY (GST_IS_EVENT (obj))) {
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
GstEvent *event = GST_EVENT_CAST (obj);
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
/* EOS event needs syncing */
|
|
|
|
case GST_EVENT_EOS:
|
2008-06-20 08:28:46 +00:00
|
|
|
{
|
2011-12-02 21:20:08 +00:00
|
|
|
if (segment->rate >= 0.0) {
|
2008-05-29 16:34:22 +00:00
|
|
|
sstart = sstop = priv->current_sstop;
|
2009-10-09 14:11:27 +00:00
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (sstart)) {
|
2008-06-20 08:28:46 +00:00
|
|
|
/* we have not seen a buffer yet, use the segment values */
|
2011-12-02 21:20:08 +00:00
|
|
|
sstart = sstop = gst_segment_to_stream_time (segment,
|
|
|
|
segment->format, segment->stop);
|
2008-06-20 08:28:46 +00:00
|
|
|
}
|
|
|
|
} else {
|
2008-05-29 16:34:22 +00:00
|
|
|
sstart = sstop = priv->current_sstart;
|
2009-10-09 14:11:27 +00:00
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (sstart)) {
|
2008-06-20 08:28:46 +00:00
|
|
|
/* we have not seen a buffer yet, use the segment values */
|
2011-12-02 21:20:08 +00:00
|
|
|
sstart = sstop = gst_segment_to_stream_time (segment,
|
|
|
|
segment->format, segment->start);
|
2008-06-20 08:28:46 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-29 16:34:22 +00:00
|
|
|
|
2013-02-05 16:19:50 +00:00
|
|
|
rstart = rstop = rnext = priv->eos_rtime;
|
2006-05-08 09:16:01 +00:00
|
|
|
*do_sync = rstart != -1;
|
|
|
|
GST_DEBUG_OBJECT (basesink, "sync times for EOS %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (rstart));
|
2009-05-14 17:29:08 +00:00
|
|
|
/* if we are stepping, we end now */
|
2009-06-09 08:25:34 +00:00
|
|
|
*step_end = step->valid;
|
2009-06-12 11:18:21 +00:00
|
|
|
eos = TRUE;
|
2009-05-15 10:05:44 +00:00
|
|
|
goto eos_done;
|
2008-06-20 08:28:46 +00:00
|
|
|
}
|
2012-06-19 14:14:46 +00:00
|
|
|
case GST_EVENT_GAP:
|
|
|
|
{
|
|
|
|
GstClockTime timestamp, duration;
|
|
|
|
gst_event_parse_gap (event, ×tamp, &duration);
|
|
|
|
|
2012-08-31 18:31:45 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "Got Gap time %" GST_TIME_FORMAT
|
|
|
|
" duration %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (timestamp), GST_TIME_ARGS (duration));
|
|
|
|
|
2012-06-19 14:14:46 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
|
|
|
|
start = timestamp;
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (duration))
|
|
|
|
stop = start + duration;
|
|
|
|
}
|
|
|
|
*do_sync = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2008-06-20 08:28:46 +00:00
|
|
|
default:
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
/* other events do not need syncing */
|
|
|
|
return FALSE;
|
|
|
|
}
|
2012-06-19 14:08:00 +00:00
|
|
|
} else {
|
|
|
|
/* else do buffer sync code */
|
2012-06-19 14:14:46 +00:00
|
|
|
GstBuffer *buffer = GST_BUFFER_CAST (obj);
|
2005-08-24 17:57:36 +00:00
|
|
|
|
2012-06-19 14:08:00 +00:00
|
|
|
/* just get the times to see if we need syncing, if the start returns -1 we
|
|
|
|
* don't sync. */
|
|
|
|
if (bclass->get_times)
|
|
|
|
bclass->get_times (basesink, buffer, &start, &stop);
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
2012-06-19 14:08:00 +00:00
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (start)) {
|
|
|
|
/* we don't need to sync but we still want to get the timestamps for
|
|
|
|
* tracking the position */
|
|
|
|
gst_base_sink_default_get_times (basesink, buffer, &start, &stop);
|
|
|
|
*do_sync = FALSE;
|
|
|
|
} else {
|
|
|
|
*do_sync = TRUE;
|
|
|
|
}
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
}
|
2005-08-24 17:57:36 +00:00
|
|
|
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "got times start: %" GST_TIME_FORMAT
|
2006-05-08 09:16:01 +00:00
|
|
|
", stop: %" GST_TIME_FORMAT ", do_sync %d", GST_TIME_ARGS (start),
|
|
|
|
GST_TIME_ARGS (stop), *do_sync);
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
|
2006-04-07 14:50:06 +00:00
|
|
|
/* collect segment and format for code clarity */
|
|
|
|
format = segment->format;
|
|
|
|
|
2011-05-16 14:57:48 +00:00
|
|
|
/* clip */
|
|
|
|
if (G_UNLIKELY (!gst_segment_clip (segment, format,
|
2011-05-13 16:07:24 +00:00
|
|
|
start, stop, &cstart, &cstop))) {
|
2009-06-10 13:51:40 +00:00
|
|
|
if (step->valid) {
|
2009-06-12 11:18:21 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "step out of segment");
|
2009-06-10 13:51:40 +00:00
|
|
|
/* when we are stepping, pretend we're at the end of the segment */
|
|
|
|
if (segment->rate > 0.0) {
|
|
|
|
cstart = segment->stop;
|
|
|
|
cstop = segment->stop;
|
|
|
|
} else {
|
|
|
|
cstart = segment->start;
|
|
|
|
cstop = segment->start;
|
|
|
|
}
|
|
|
|
goto do_times;
|
|
|
|
}
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
goto out_of_segment;
|
2009-06-10 13:51:40 +00:00
|
|
|
}
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
if (G_UNLIKELY (start != cstart || stop != cstop)) {
|
|
|
|
GST_DEBUG_OBJECT (basesink, "clipped to: start %" GST_TIME_FORMAT
|
|
|
|
", stop: %" GST_TIME_FORMAT, GST_TIME_ARGS (cstart),
|
|
|
|
GST_TIME_ARGS (cstop));
|
gst/base/gstbasesink.c: Reworked the base sink, handle event and buffer serialisation correctly and removed possible ...
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_basesink_set_property),
(gst_basesink_preroll_queue_empty),
(gst_basesink_preroll_queue_flush), (gst_basesink_handle_object),
(gst_basesink_event), (gst_basesink_do_sync),
(gst_basesink_handle_event), (gst_basesink_handle_buffer),
(gst_basesink_chain), (gst_basesink_loop), (gst_basesink_activate),
(gst_basesink_change_state):
Reworked the base sink, handle event and buffer serialisation
correctly and removed possible deadlock.
Handle EOS correctly.
2005-06-25 17:54:58 +00:00
|
|
|
}
|
check/: Small state change torture test.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/stress.c: (GST_START_TEST),
(simple_launch_lines_suite), (main):
Small state change torture test.
* docs/design/part-states.txt:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event), (do_playing),
(gst_base_sink_change_state):
Never take state lock from streaming thread, clean up ugly
hacks. Unfortunatly core does not yet support nice ways to
async commit state.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_recalc_state),
(bin_bus_handler):
Start state recalc if a STATE_DIRTY message is posted, but only
on the toplevel bin.
* gst/gstelement.c: (gst_element_sync_state_with_parent),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state_func), (gst_element_change_state):
* gst/gstelement.h:
State variables are now protected with the LOCK, the state
lock is only used to serialize _set_state().
2005-10-18 17:06:29 +00:00
|
|
|
|
2006-08-28 15:57:39 +00:00
|
|
|
/* set last stop position */
|
2010-12-14 18:00:14 +00:00
|
|
|
if (G_LIKELY (stop != GST_CLOCK_TIME_NONE && cstop != GST_CLOCK_TIME_NONE))
|
2011-05-13 16:07:24 +00:00
|
|
|
segment->position = cstop;
|
2008-05-22 08:33:27 +00:00
|
|
|
else
|
2011-05-13 16:07:24 +00:00
|
|
|
segment->position = cstart;
|
2006-08-28 15:57:39 +00:00
|
|
|
|
2006-04-07 14:50:06 +00:00
|
|
|
do_times:
|
|
|
|
rstart = gst_segment_to_running_time (segment, format, cstart);
|
|
|
|
rstop = gst_segment_to_running_time (segment, format, cstop);
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
|
2013-02-05 16:19:50 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (stop))
|
|
|
|
rnext = rstop;
|
|
|
|
else
|
|
|
|
rnext = rstart;
|
|
|
|
|
2009-05-14 17:29:08 +00:00
|
|
|
if (G_UNLIKELY (step->valid)) {
|
2009-06-09 08:25:34 +00:00
|
|
|
if (!(*step_end = handle_stepping (basesink, segment, step, &cstart, &cstop,
|
2009-06-08 14:27:36 +00:00
|
|
|
&rstart, &rstop))) {
|
|
|
|
/* step is still busy, we discard data when we are flushing */
|
|
|
|
*stepped = step->flush;
|
2009-11-16 13:02:07 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "stepping busy");
|
2009-06-08 14:27:36 +00:00
|
|
|
}
|
2009-05-14 17:29:08 +00:00
|
|
|
}
|
2009-05-31 17:10:02 +00:00
|
|
|
/* this can produce wrong values if we accumulated non-TIME segments. If this happens,
|
|
|
|
* upstream is behaving very badly */
|
|
|
|
sstart = gst_segment_to_stream_time (segment, format, cstart);
|
|
|
|
sstop = gst_segment_to_stream_time (segment, format, cstop);
|
2009-05-14 17:29:08 +00:00
|
|
|
|
2009-05-15 10:05:44 +00:00
|
|
|
eos_done:
|
2009-06-12 11:18:21 +00:00
|
|
|
/* eos_done label only called when doing EOS, we also stop stepping then */
|
2009-06-09 08:25:34 +00:00
|
|
|
if (*step_end && step->flush) {
|
2009-06-09 10:06:35 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "flushing step ended");
|
2009-06-12 11:18:21 +00:00
|
|
|
stop_stepping (basesink, segment, step, rstart, rstop, eos);
|
2009-06-09 08:25:34 +00:00
|
|
|
*step_end = FALSE;
|
2010-10-18 08:46:59 +00:00
|
|
|
/* re-determine running start times for adjusted segment
|
|
|
|
* (which has a flushed amount of running/accumulated time removed) */
|
|
|
|
if (!GST_IS_EVENT (obj)) {
|
|
|
|
GST_DEBUG_OBJECT (basesink, "refresh sync times");
|
|
|
|
goto again;
|
|
|
|
}
|
2009-06-09 08:25:34 +00:00
|
|
|
}
|
2009-05-14 17:29:08 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
/* save times */
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
*rsstart = sstart;
|
|
|
|
*rsstop = sstop;
|
|
|
|
*rrstart = rstart;
|
|
|
|
*rrstop = rstop;
|
2013-02-05 16:19:50 +00:00
|
|
|
*rrnext = rnext;
|
2006-03-14 19:36:05 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
/* buffers and EOS always need syncing and preroll */
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
return TRUE;
|
2005-03-28 14:54:33 +00:00
|
|
|
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
/* special cases */
|
|
|
|
out_of_segment:
|
|
|
|
{
|
2009-06-03 13:39:13 +00:00
|
|
|
/* we usually clip in the chain function already but stepping could cause
|
2014-06-05 19:38:20 +00:00
|
|
|
* the segment to be updated later. we return %FALSE so that we don't try
|
2009-06-03 13:39:13 +00:00
|
|
|
* to sync on it. */
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
GST_LOG_OBJECT (basesink, "buffer skipped, not in segment");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
|
2008-06-04 11:47:16 +00:00
|
|
|
/* with STREAM_LOCK, PREROLL_LOCK, LOCK
|
2010-09-24 10:22:33 +00:00
|
|
|
* adjust a timestamp with the latency and timestamp offset. This function does
|
|
|
|
* not adjust for the render delay. */
|
2008-05-19 11:11:49 +00:00
|
|
|
static GstClockTime
|
|
|
|
gst_base_sink_adjust_time (GstBaseSink * basesink, GstClockTime time)
|
|
|
|
{
|
|
|
|
GstClockTimeDiff ts_offset;
|
|
|
|
|
|
|
|
/* don't do anything funny with invalid timestamps */
|
|
|
|
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (time)))
|
|
|
|
return time;
|
|
|
|
|
2010-09-24 10:22:33 +00:00
|
|
|
time += basesink->priv->latency;
|
2008-05-19 11:11:49 +00:00
|
|
|
|
2013-12-07 14:40:32 +00:00
|
|
|
/* apply offset, be careful for underflows */
|
2008-05-19 11:11:49 +00:00
|
|
|
ts_offset = basesink->priv->ts_offset;
|
|
|
|
if (ts_offset < 0) {
|
|
|
|
ts_offset = -ts_offset;
|
|
|
|
if (ts_offset < time)
|
|
|
|
time -= ts_offset;
|
|
|
|
else
|
|
|
|
time = 0;
|
|
|
|
} else
|
|
|
|
time += ts_offset;
|
|
|
|
|
2010-09-24 10:22:33 +00:00
|
|
|
/* subtract the render delay again, which was included in the latency */
|
|
|
|
if (time > basesink->priv->render_delay)
|
|
|
|
time -= basesink->priv->render_delay;
|
|
|
|
else
|
|
|
|
time = 0;
|
|
|
|
|
2008-05-19 11:11:49 +00:00
|
|
|
return time;
|
|
|
|
}
|
|
|
|
|
2008-11-24 20:02:55 +00:00
|
|
|
/**
|
|
|
|
* gst_base_sink_wait_clock:
|
2008-05-19 16:36:51 +00:00
|
|
|
* @sink: the sink
|
|
|
|
* @time: the running_time to be reached
|
2014-06-05 19:38:20 +00:00
|
|
|
* @jitter: (out) (allow-none): the jitter to be filled with time diff, or %NULL
|
2008-05-19 16:36:51 +00:00
|
|
|
*
|
|
|
|
* This function will block until @time is reached. It is usually called by
|
|
|
|
* subclasses that use their own internal synchronisation.
|
|
|
|
*
|
2014-06-05 19:38:20 +00:00
|
|
|
* If @time is not valid, no synchronisation is done and %GST_CLOCK_BADTIME is
|
2008-05-19 16:36:51 +00:00
|
|
|
* returned. Likewise, if synchronisation is disabled in the element or there
|
2014-06-05 19:38:20 +00:00
|
|
|
* is no clock, no synchronisation is done and %GST_CLOCK_BADTIME is returned.
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
*
|
2008-05-19 16:36:51 +00:00
|
|
|
* This function should only be called with the PREROLL_LOCK held, like when
|
2009-11-27 14:39:37 +00:00
|
|
|
* receiving an EOS event in the #GstBaseSinkClass.event() vmethod or when
|
|
|
|
* receiving a buffer in
|
|
|
|
* the #GstBaseSinkClass.render() vmethod.
|
2006-03-14 19:36:05 +00:00
|
|
|
*
|
2008-05-19 16:36:51 +00:00
|
|
|
* The @time argument should be the running_time of when this method should
|
|
|
|
* return and is not adjusted with any latency or offset configured in the
|
|
|
|
* sink.
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
*
|
2008-05-19 16:36:51 +00:00
|
|
|
* Returns: #GstClockReturn
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
*/
|
2008-05-19 16:36:51 +00:00
|
|
|
GstClockReturn
|
2009-01-09 15:43:17 +00:00
|
|
|
gst_base_sink_wait_clock (GstBaseSink * sink, GstClockTime time,
|
2006-03-06 15:16:23 +00:00
|
|
|
GstClockTimeDiff * jitter)
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
{
|
|
|
|
GstClockReturn ret;
|
|
|
|
GstClock *clock;
|
2009-12-11 15:19:18 +00:00
|
|
|
GstClockTime base_time;
|
gst/base/gstbasesink.c: Reworked the base sink, handle event and buffer serialisation correctly and removed possible ...
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_basesink_set_property),
(gst_basesink_preroll_queue_empty),
(gst_basesink_preroll_queue_flush), (gst_basesink_handle_object),
(gst_basesink_event), (gst_basesink_do_sync),
(gst_basesink_handle_event), (gst_basesink_handle_buffer),
(gst_basesink_chain), (gst_basesink_loop), (gst_basesink_activate),
(gst_basesink_change_state):
Reworked the base sink, handle event and buffer serialisation
correctly and removed possible deadlock.
Handle EOS correctly.
2005-06-25 17:54:58 +00:00
|
|
|
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (time)))
|
|
|
|
goto invalid_time;
|
gst/base/gstbasesink.c: Some more debug.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_get_position):
Some more debug.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
* tools/gst-launch.c: (main):
Remove old option.
2005-10-27 08:55:44 +00:00
|
|
|
|
2009-01-09 15:43:17 +00:00
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
if (G_UNLIKELY (!sink->sync))
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
goto no_sync;
|
gst/base/gstbasesink.c: Reworked the base sink, handle event and buffer serialisation correctly and removed possible ...
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_basesink_set_property),
(gst_basesink_preroll_queue_empty),
(gst_basesink_preroll_queue_flush), (gst_basesink_handle_object),
(gst_basesink_event), (gst_basesink_do_sync),
(gst_basesink_handle_event), (gst_basesink_handle_buffer),
(gst_basesink_chain), (gst_basesink_loop), (gst_basesink_activate),
(gst_basesink_change_state):
Reworked the base sink, handle event and buffer serialisation
correctly and removed possible deadlock.
Handle EOS correctly.
2005-06-25 17:54:58 +00:00
|
|
|
|
2009-01-09 15:43:17 +00:00
|
|
|
if (G_UNLIKELY ((clock = GST_ELEMENT_CLOCK (sink)) == NULL))
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
goto no_clock;
|
2005-06-30 12:14:47 +00:00
|
|
|
|
2009-12-11 15:19:18 +00:00
|
|
|
base_time = GST_ELEMENT_CAST (sink)->base_time;
|
|
|
|
GST_LOG_OBJECT (sink,
|
|
|
|
"time %" GST_TIME_FORMAT ", base_time %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (time), GST_TIME_ARGS (base_time));
|
|
|
|
|
2008-05-19 16:36:51 +00:00
|
|
|
/* add base_time to running_time to get the time against the clock */
|
2009-12-11 15:19:18 +00:00
|
|
|
time += base_time;
|
2007-08-30 17:50:54 +00:00
|
|
|
|
2010-10-20 15:41:28 +00:00
|
|
|
/* Re-use existing clockid if available */
|
2011-05-20 11:03:51 +00:00
|
|
|
/* FIXME: Casting to GstClockEntry only works because the types
|
|
|
|
* are the same */
|
|
|
|
if (G_LIKELY (sink->priv->cached_clock_id != NULL
|
2013-11-25 09:33:42 +00:00
|
|
|
&& GST_CLOCK_ENTRY_CLOCK ((GstClockEntry *) sink->
|
|
|
|
priv->cached_clock_id) == clock)) {
|
2010-10-20 15:41:28 +00:00
|
|
|
if (!gst_clock_single_shot_id_reinit (clock, sink->priv->cached_clock_id,
|
|
|
|
time)) {
|
|
|
|
gst_clock_id_unref (sink->priv->cached_clock_id);
|
|
|
|
sink->priv->cached_clock_id = gst_clock_new_single_shot_id (clock, time);
|
|
|
|
}
|
2011-05-20 11:03:51 +00:00
|
|
|
} else {
|
|
|
|
if (sink->priv->cached_clock_id != NULL)
|
|
|
|
gst_clock_id_unref (sink->priv->cached_clock_id);
|
2010-10-20 15:41:28 +00:00
|
|
|
sink->priv->cached_clock_id = gst_clock_new_single_shot_id (clock, time);
|
2011-05-20 11:03:51 +00:00
|
|
|
}
|
2009-01-09 15:43:17 +00:00
|
|
|
GST_OBJECT_UNLOCK (sink);
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
|
2008-05-19 16:36:51 +00:00
|
|
|
/* A blocking wait is performed on the clock. We save the ClockID
|
2009-08-24 15:56:32 +00:00
|
|
|
* so we can unlock the entry at any time. While we are blocking, we
|
2008-05-19 16:36:51 +00:00
|
|
|
* release the PREROLL_LOCK so that other threads can interrupt the
|
|
|
|
* entry. */
|
2010-10-20 15:41:28 +00:00
|
|
|
sink->clock_id = sink->priv->cached_clock_id;
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
/* release the preroll lock while waiting */
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (sink);
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
|
2010-10-20 15:41:28 +00:00
|
|
|
ret = gst_clock_id_wait (sink->priv->cached_clock_id, jitter);
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_LOCK (sink);
|
2009-01-09 15:43:17 +00:00
|
|
|
sink->clock_id = NULL;
|
2005-06-29 10:24:08 +00:00
|
|
|
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
return ret;
|
|
|
|
|
2006-03-14 19:36:05 +00:00
|
|
|
/* no syncing needed */
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
invalid_time:
|
|
|
|
{
|
2009-01-09 15:43:17 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "time not valid, no sync needed");
|
2006-03-14 19:36:05 +00:00
|
|
|
return GST_CLOCK_BADTIME;
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
}
|
|
|
|
no_sync:
|
|
|
|
{
|
2009-01-09 15:43:17 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "sync disabled");
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
2006-03-14 19:36:05 +00:00
|
|
|
return GST_CLOCK_BADTIME;
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
}
|
|
|
|
no_clock:
|
|
|
|
{
|
2009-01-09 15:43:17 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "no clock, can't sync");
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
2006-03-14 19:36:05 +00:00
|
|
|
return GST_CLOCK_BADTIME;
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-15 08:47:36 +00:00
|
|
|
/**
|
|
|
|
* gst_base_sink_wait_preroll:
|
|
|
|
* @sink: the sink
|
|
|
|
*
|
2009-11-27 14:39:37 +00:00
|
|
|
* If the #GstBaseSinkClass.render() method performs its own synchronisation
|
|
|
|
* against the clock it must unblock when going from PLAYING to the PAUSED state
|
|
|
|
* and call this method before continuing to render the remaining data.
|
2006-09-15 08:47:36 +00:00
|
|
|
*
|
|
|
|
* This function will block until a state change to PLAYING happens (in which
|
2014-06-05 19:38:20 +00:00
|
|
|
* case this function returns %GST_FLOW_OK) or the processing must be stopped due
|
2006-09-15 08:47:36 +00:00
|
|
|
* to a state change to READY or a FLUSH event (in which case this function
|
2014-06-05 19:38:20 +00:00
|
|
|
* returns %GST_FLOW_FLUSHING).
|
2006-09-15 08:47:36 +00:00
|
|
|
*
|
2008-10-08 14:21:13 +00:00
|
|
|
* This function should only be called with the PREROLL_LOCK held, like in the
|
|
|
|
* render function.
|
|
|
|
*
|
2014-06-05 19:38:20 +00:00
|
|
|
* Returns: %GST_FLOW_OK if the preroll completed and processing can
|
2006-09-15 08:47:36 +00:00
|
|
|
* continue. Any other return value should be returned from the render vmethod.
|
|
|
|
*/
|
|
|
|
GstFlowReturn
|
|
|
|
gst_base_sink_wait_preroll (GstBaseSink * sink)
|
|
|
|
{
|
|
|
|
sink->have_preroll = TRUE;
|
2007-09-14 15:52:27 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "waiting in preroll for flush or PLAYING");
|
2007-09-05 22:12:42 +00:00
|
|
|
/* block until the state changes, or we get a flush, or something */
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_WAIT (sink);
|
2007-09-05 22:12:42 +00:00
|
|
|
sink->have_preroll = FALSE;
|
2006-09-15 08:47:36 +00:00
|
|
|
if (G_UNLIKELY (sink->flushing))
|
|
|
|
goto stopping;
|
2009-05-19 17:45:06 +00:00
|
|
|
if (G_UNLIKELY (sink->priv->step_unlock))
|
|
|
|
goto step_unlocked;
|
2006-09-15 08:47:36 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "continue after preroll");
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
stopping:
|
|
|
|
{
|
2009-05-19 17:45:06 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "preroll interrupted because of flush");
|
2012-02-08 14:16:46 +00:00
|
|
|
return GST_FLOW_FLUSHING;
|
2006-09-15 08:47:36 +00:00
|
|
|
}
|
2009-05-19 17:45:06 +00:00
|
|
|
step_unlocked:
|
|
|
|
{
|
|
|
|
sink->priv->step_unlock = FALSE;
|
|
|
|
GST_DEBUG_OBJECT (sink, "preroll interrupted because of step");
|
|
|
|
return GST_FLOW_STEP;
|
|
|
|
}
|
2006-09-15 08:47:36 +00:00
|
|
|
}
|
|
|
|
|
2008-10-16 14:09:18 +00:00
|
|
|
/**
|
|
|
|
* gst_base_sink_do_preroll:
|
|
|
|
* @sink: the sink
|
2010-12-07 18:35:56 +00:00
|
|
|
* @obj: (transfer none): the mini object that caused the preroll
|
2008-10-16 14:09:18 +00:00
|
|
|
*
|
|
|
|
* If the @sink spawns its own thread for pulling buffers from upstream it
|
|
|
|
* should call this method after it has pulled a buffer. If the element needed
|
|
|
|
* to preroll, this function will perform the preroll and will then block
|
|
|
|
* until the element state is changed.
|
|
|
|
*
|
|
|
|
* This function should be called with the PREROLL_LOCK held.
|
|
|
|
*
|
2014-06-05 19:38:20 +00:00
|
|
|
* Returns: %GST_FLOW_OK if the preroll completed and processing can
|
2008-10-16 14:09:18 +00:00
|
|
|
* continue. Any other return value should be returned from the render vmethod.
|
|
|
|
*/
|
|
|
|
GstFlowReturn
|
|
|
|
gst_base_sink_do_preroll (GstBaseSink * sink, GstMiniObject * obj)
|
|
|
|
{
|
|
|
|
GstFlowReturn ret;
|
|
|
|
|
|
|
|
while (G_UNLIKELY (sink->need_preroll)) {
|
|
|
|
GST_DEBUG_OBJECT (sink, "prerolling object %p", obj);
|
|
|
|
|
2011-12-03 05:45:26 +00:00
|
|
|
/* if it's a buffer, we need to call the preroll method */
|
|
|
|
if (sink->priv->call_preroll) {
|
|
|
|
GstBaseSinkClass *bclass;
|
|
|
|
GstBuffer *buf;
|
|
|
|
|
|
|
|
if (GST_IS_BUFFER_LIST (obj)) {
|
|
|
|
buf = gst_buffer_list_get (GST_BUFFER_LIST_CAST (obj), 0);
|
2015-06-22 12:04:45 +00:00
|
|
|
gst_base_sink_set_last_buffer (sink, buf);
|
|
|
|
gst_base_sink_set_last_buffer_list (sink, GST_BUFFER_LIST_CAST (obj));
|
2011-12-03 05:45:26 +00:00
|
|
|
g_assert (NULL != buf);
|
|
|
|
} else if (GST_IS_BUFFER (obj)) {
|
|
|
|
buf = GST_BUFFER_CAST (obj);
|
|
|
|
/* For buffer lists do not set last buffer for now */
|
|
|
|
gst_base_sink_set_last_buffer (sink, buf);
|
2015-06-22 12:04:45 +00:00
|
|
|
gst_base_sink_set_last_buffer_list (sink, NULL);
|
|
|
|
} else {
|
2011-12-03 06:01:45 +00:00
|
|
|
buf = NULL;
|
2015-06-22 12:04:45 +00:00
|
|
|
}
|
2011-12-03 05:45:26 +00:00
|
|
|
|
2011-12-03 06:01:45 +00:00
|
|
|
if (buf) {
|
|
|
|
GST_DEBUG_OBJECT (sink, "preroll buffer %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
|
2011-12-03 05:45:26 +00:00
|
|
|
|
2011-12-03 06:01:45 +00:00
|
|
|
bclass = GST_BASE_SINK_GET_CLASS (sink);
|
2012-05-16 10:08:44 +00:00
|
|
|
|
|
|
|
if (bclass->prepare)
|
|
|
|
if ((ret = bclass->prepare (sink, buf)) != GST_FLOW_OK)
|
|
|
|
goto prepare_canceled;
|
|
|
|
|
2011-12-03 06:01:45 +00:00
|
|
|
if (bclass->preroll)
|
|
|
|
if ((ret = bclass->preroll (sink, buf)) != GST_FLOW_OK)
|
|
|
|
goto preroll_canceled;
|
2011-12-03 05:45:26 +00:00
|
|
|
|
2011-12-03 06:01:45 +00:00
|
|
|
sink->priv->call_preroll = FALSE;
|
|
|
|
}
|
2011-12-03 05:45:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* commit state */
|
|
|
|
if (G_LIKELY (sink->playing_async)) {
|
|
|
|
if (G_UNLIKELY (!gst_base_sink_commit_state (sink)))
|
|
|
|
goto stopping;
|
|
|
|
}
|
2008-10-16 14:09:18 +00:00
|
|
|
|
|
|
|
/* need to recheck here because the commit state could have
|
|
|
|
* made us not need the preroll anymore */
|
|
|
|
if (G_LIKELY (sink->need_preroll)) {
|
|
|
|
/* block until the state changes, or we get a flush, or something */
|
|
|
|
ret = gst_base_sink_wait_preroll (sink);
|
2009-10-08 06:53:54 +00:00
|
|
|
if ((ret != GST_FLOW_OK) && (ret != GST_FLOW_STEP))
|
|
|
|
goto preroll_failed;
|
2008-10-16 14:09:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
/* ERRORS */
|
2012-05-16 10:08:44 +00:00
|
|
|
prepare_canceled:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (sink, "prepare failed, abort state");
|
|
|
|
gst_element_abort_state (GST_ELEMENT_CAST (sink));
|
|
|
|
return ret;
|
|
|
|
}
|
2011-12-03 05:45:26 +00:00
|
|
|
preroll_canceled:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (sink, "preroll failed, abort state");
|
|
|
|
gst_element_abort_state (GST_ELEMENT_CAST (sink));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
stopping:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (sink, "stopping while commiting state");
|
2012-02-08 14:16:46 +00:00
|
|
|
return GST_FLOW_FLUSHING;
|
2011-12-03 05:45:26 +00:00
|
|
|
}
|
2009-01-21 11:43:55 +00:00
|
|
|
preroll_failed:
|
2008-10-16 14:09:18 +00:00
|
|
|
{
|
2011-03-23 14:42:24 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "preroll failed: %s", gst_flow_get_name (ret));
|
2008-10-16 14:09:18 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-10 15:18:44 +00:00
|
|
|
/**
|
2012-06-18 09:36:25 +00:00
|
|
|
* gst_base_sink_wait:
|
2007-10-10 15:18:44 +00:00
|
|
|
* @sink: the sink
|
|
|
|
* @time: the running_time to be reached
|
2014-06-05 19:38:20 +00:00
|
|
|
* @jitter: (out) (allow-none): the jitter to be filled with time diff, or %NULL
|
2007-10-10 15:18:44 +00:00
|
|
|
*
|
2012-06-18 09:36:25 +00:00
|
|
|
* This function will wait for preroll to complete and will then block until @time
|
|
|
|
* is reached. It is usually called by subclasses that use their own internal
|
|
|
|
* synchronisation but want to let some synchronization (like EOS) be handled
|
|
|
|
* by the base class.
|
2007-10-10 15:18:44 +00:00
|
|
|
*
|
2012-06-18 09:36:25 +00:00
|
|
|
* This function should only be called with the PREROLL_LOCK held (like when
|
|
|
|
* receiving an EOS event in the ::event vmethod or when handling buffers in
|
|
|
|
* ::render).
|
2007-10-10 15:18:44 +00:00
|
|
|
*
|
2012-06-18 09:36:25 +00:00
|
|
|
* The @time argument should be the running_time of when the timeout should happen
|
2008-05-19 16:36:51 +00:00
|
|
|
* and will be adjusted with any latency and offset configured in the sink.
|
|
|
|
*
|
2007-10-10 15:18:44 +00:00
|
|
|
* Returns: #GstFlowReturn
|
|
|
|
*/
|
|
|
|
GstFlowReturn
|
2012-06-18 09:36:25 +00:00
|
|
|
gst_base_sink_wait (GstBaseSink * sink, GstClockTime time,
|
2007-10-10 15:18:44 +00:00
|
|
|
GstClockTimeDiff * jitter)
|
|
|
|
{
|
|
|
|
GstClockReturn status;
|
|
|
|
GstFlowReturn ret;
|
|
|
|
|
|
|
|
do {
|
2008-05-19 11:11:49 +00:00
|
|
|
GstClockTime stime;
|
|
|
|
|
2007-10-10 15:18:44 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "checking preroll");
|
|
|
|
|
|
|
|
/* first wait for the playing state before we can continue */
|
2010-11-25 15:06:07 +00:00
|
|
|
while (G_UNLIKELY (sink->need_preroll)) {
|
2007-10-10 15:18:44 +00:00
|
|
|
ret = gst_base_sink_wait_preroll (sink);
|
2009-10-08 06:53:54 +00:00
|
|
|
if ((ret != GST_FLOW_OK) && (ret != GST_FLOW_STEP))
|
|
|
|
goto flushing;
|
2007-10-10 15:18:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* preroll done, we can sync since we are in PLAYING now. */
|
|
|
|
GST_DEBUG_OBJECT (sink, "possibly waiting for clock to reach %"
|
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (time));
|
|
|
|
|
2011-11-29 13:22:44 +00:00
|
|
|
/* compensate for latency, ts_offset and render delay */
|
2008-06-20 08:28:46 +00:00
|
|
|
stime = gst_base_sink_adjust_time (sink, time);
|
|
|
|
|
2009-08-24 15:56:32 +00:00
|
|
|
/* wait for the clock, this can be interrupted because we got shut down or
|
2007-10-10 15:18:44 +00:00
|
|
|
* we PAUSED. */
|
2008-05-19 11:11:49 +00:00
|
|
|
status = gst_base_sink_wait_clock (sink, stime, jitter);
|
2007-10-10 15:18:44 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sink, "clock returned %d", status);
|
|
|
|
|
|
|
|
/* invalid time, no clock or sync disabled, just continue then */
|
|
|
|
if (status == GST_CLOCK_BADTIME)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* waiting could have been interrupted and we can be flushing now */
|
|
|
|
if (G_UNLIKELY (sink->flushing))
|
|
|
|
goto flushing;
|
|
|
|
|
|
|
|
/* retry if we got unscheduled, which means we did not reach the timeout
|
|
|
|
* yet. if some other error occures, we continue. */
|
|
|
|
} while (status == GST_CLOCK_UNSCHEDULED);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sink, "end of stream");
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
flushing:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (sink, "we are flushing");
|
2012-02-08 14:16:46 +00:00
|
|
|
return GST_FLOW_FLUSHING;
|
2007-10-10 15:18:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
/* with STREAM_LOCK, PREROLL_LOCK
|
|
|
|
*
|
|
|
|
* Make sure we are in PLAYING and synchronize an object to the clock.
|
|
|
|
*
|
|
|
|
* If we need preroll, we are not in PLAYING. We try to commit the state
|
|
|
|
* if needed and then block if we still are not PLAYING.
|
|
|
|
*
|
|
|
|
* We start waiting on the clock in PLAYING. If we got interrupted, we
|
2011-09-07 11:14:38 +00:00
|
|
|
* immediately try to re-preroll.
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
*
|
|
|
|
* Some objects do not need synchronisation (most events) and so this function
|
2011-09-07 11:14:38 +00:00
|
|
|
* immediately returns GST_FLOW_OK.
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
*
|
2009-08-24 15:56:32 +00:00
|
|
|
* for objects that arrive later than max-lateness to be synchronized to the
|
2014-06-05 19:38:20 +00:00
|
|
|
* clock have the @late boolean set to %TRUE.
|
2006-03-13 11:16:45 +00:00
|
|
|
*
|
|
|
|
* This function keeps a running average of the jitter (the diff between the
|
|
|
|
* clock time and the requested sync time). The jitter is negative for
|
|
|
|
* objects that arrive in time and positive for late buffers.
|
|
|
|
*
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
* does not take ownership of obj.
|
|
|
|
*/
|
|
|
|
static GstFlowReturn
|
2011-12-02 21:20:08 +00:00
|
|
|
gst_base_sink_do_sync (GstBaseSink * basesink,
|
2011-12-03 05:29:42 +00:00
|
|
|
GstMiniObject * obj, gboolean * late, gboolean * step_end)
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
{
|
2010-06-17 11:19:24 +00:00
|
|
|
GstClockTimeDiff jitter = 0;
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
gboolean syncable;
|
|
|
|
GstClockReturn status = GST_CLOCK_OK;
|
2013-02-05 16:19:50 +00:00
|
|
|
GstClockTime rstart, rstop, rnext, sstart, sstop, stime;
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
gboolean do_sync;
|
libs/gst/base/gstbasesink.c: Don't try to report a 0 position when we don't know, return -1 and FALSE instead. This m...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_do_sync), (gst_base_sink_preroll_object),
(gst_base_sink_event), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_change_state):
Don't try to report a 0 position when we don't know, return -1 and FALSE
instead. This mostly happens when we are prerolling.
Make sure we can report the right position before we post the ASYNC_DONE
message so that a message handler can query position without races.
* tests/check/generic/sinks.c: (send_eos), (GST_START_TEST),
(async_done_handoff), (async_done_func), (send_buffer),
(async_done_eos_func), (gst_sinks_suite):
Add two tests for the above.
2007-11-06 10:33:22 +00:00
|
|
|
GstBaseSinkPrivate *priv;
|
2009-01-21 11:43:55 +00:00
|
|
|
GstFlowReturn ret;
|
2009-05-14 17:29:08 +00:00
|
|
|
GstStepInfo *current, *pending;
|
|
|
|
gboolean stepped;
|
libs/gst/base/gstbasesink.c: Don't try to report a 0 position when we don't know, return -1 and FALSE instead. This m...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_do_sync), (gst_base_sink_preroll_object),
(gst_base_sink_event), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_change_state):
Don't try to report a 0 position when we don't know, return -1 and FALSE
instead. This mostly happens when we are prerolling.
Make sure we can report the right position before we post the ASYNC_DONE
message so that a message handler can query position without races.
* tests/check/generic/sinks.c: (send_eos), (GST_START_TEST),
(async_done_handoff), (async_done_func), (send_buffer),
(async_done_eos_func), (gst_sinks_suite):
Add two tests for the above.
2007-11-06 10:33:22 +00:00
|
|
|
|
|
|
|
priv = basesink->priv;
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
|
2009-05-11 16:56:56 +00:00
|
|
|
do_step:
|
2013-02-05 16:19:50 +00:00
|
|
|
sstart = sstop = rstart = rstop = rnext = GST_CLOCK_TIME_NONE;
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
do_sync = TRUE;
|
2009-05-14 17:29:08 +00:00
|
|
|
stepped = FALSE;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
2009-10-09 14:11:27 +00:00
|
|
|
priv->current_rstart = GST_CLOCK_TIME_NONE;
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
|
2009-05-14 17:29:08 +00:00
|
|
|
/* get stepping info */
|
|
|
|
current = &priv->current_step;
|
|
|
|
pending = &priv->pending_step;
|
|
|
|
|
libs/gst/base/gstbasesink.c: Don't try to report a 0 position when we don't know, return -1 and FALSE instead. This m...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_do_sync), (gst_base_sink_preroll_object),
(gst_base_sink_event), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_change_state):
Don't try to report a 0 position when we don't know, return -1 and FALSE
instead. This mostly happens when we are prerolling.
Make sure we can report the right position before we post the ASYNC_DONE
message so that a message handler can query position without races.
* tests/check/generic/sinks.c: (send_eos), (GST_START_TEST),
(async_done_handoff), (async_done_func), (send_buffer),
(async_done_eos_func), (gst_sinks_suite):
Add two tests for the above.
2007-11-06 10:33:22 +00:00
|
|
|
/* get timing information for this object against the render segment */
|
2006-03-14 19:36:05 +00:00
|
|
|
syncable = gst_base_sink_get_sync_times (basesink, obj,
|
2013-02-05 16:19:50 +00:00
|
|
|
&sstart, &sstop, &rstart, &rstop, &rnext, &do_sync, &stepped, current,
|
|
|
|
step_end);
|
2009-05-14 17:29:08 +00:00
|
|
|
|
|
|
|
if (G_UNLIKELY (stepped))
|
|
|
|
goto step_skipped;
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
|
|
|
|
/* a syncable object needs to participate in preroll and
|
|
|
|
* clocking. All buffers and EOS are syncable. */
|
|
|
|
if (G_UNLIKELY (!syncable))
|
|
|
|
goto not_syncable;
|
|
|
|
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
/* store timing info for current object */
|
libs/gst/base/gstbasesink.c: Don't try to report a 0 position when we don't know, return -1 and FALSE instead. This m...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_do_sync), (gst_base_sink_preroll_object),
(gst_base_sink_event), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_change_state):
Don't try to report a 0 position when we don't know, return -1 and FALSE
instead. This mostly happens when we are prerolling.
Make sure we can report the right position before we post the ASYNC_DONE
message so that a message handler can query position without races.
* tests/check/generic/sinks.c: (send_eos), (GST_START_TEST),
(async_done_handoff), (async_done_func), (send_buffer),
(async_done_eos_func), (gst_sinks_suite):
Add two tests for the above.
2007-11-06 10:33:22 +00:00
|
|
|
priv->current_rstart = rstart;
|
2009-10-09 14:11:27 +00:00
|
|
|
priv->current_rstop = (GST_CLOCK_TIME_IS_VALID (rstop) ? rstop : rstart);
|
2009-05-11 16:56:56 +00:00
|
|
|
|
2006-05-08 09:16:01 +00:00
|
|
|
/* save sync time for eos when the previous object needed sync */
|
2013-02-05 16:19:50 +00:00
|
|
|
priv->eos_rtime = (do_sync ? rnext : GST_CLOCK_TIME_NONE);
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
2011-02-14 13:00:38 +00:00
|
|
|
/* calculate inter frame spacing */
|
|
|
|
if (G_UNLIKELY (priv->prev_rstart != -1 && priv->prev_rstart < rstart)) {
|
|
|
|
GstClockTime in_diff;
|
|
|
|
|
|
|
|
in_diff = rstart - priv->prev_rstart;
|
|
|
|
|
|
|
|
if (priv->avg_in_diff == -1)
|
|
|
|
priv->avg_in_diff = in_diff;
|
|
|
|
else
|
|
|
|
priv->avg_in_diff = UPDATE_RUNNING_AVG (priv->avg_in_diff, in_diff);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (basesink, "avg frame diff %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (priv->avg_in_diff));
|
|
|
|
|
|
|
|
}
|
|
|
|
priv->prev_rstart = rstart;
|
|
|
|
|
2011-02-10 13:50:04 +00:00
|
|
|
if (G_UNLIKELY (priv->earliest_in_time != -1
|
|
|
|
&& rstart < priv->earliest_in_time))
|
|
|
|
goto qos_dropped;
|
|
|
|
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
again:
|
|
|
|
/* first do preroll, this makes sure we commit our state
|
|
|
|
* to PAUSED and can continue to PLAYING. We cannot perform
|
2009-05-11 16:56:56 +00:00
|
|
|
* any clock sync in PAUSED because there is no clock. */
|
2009-01-21 11:43:55 +00:00
|
|
|
ret = gst_base_sink_do_preroll (basesink, obj);
|
|
|
|
if (G_UNLIKELY (ret != GST_FLOW_OK))
|
|
|
|
goto preroll_failed;
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2009-05-14 17:29:08 +00:00
|
|
|
/* update the segment with a pending step if the current one is invalid and we
|
|
|
|
* have a new pending one. We only accept new step updates after a preroll */
|
|
|
|
if (G_UNLIKELY (pending->valid && !current->valid)) {
|
|
|
|
start_stepping (basesink, &basesink->segment, pending, current);
|
2009-05-11 16:56:56 +00:00
|
|
|
goto do_step;
|
2009-05-14 17:29:08 +00:00
|
|
|
}
|
2009-05-11 16:56:56 +00:00
|
|
|
|
2009-11-16 13:02:07 +00:00
|
|
|
/* After rendering we store the position of the last buffer so that we can use
|
|
|
|
* it to report the position. We need to take the lock here. */
|
|
|
|
GST_OBJECT_LOCK (basesink);
|
|
|
|
priv->current_sstart = sstart;
|
|
|
|
priv->current_sstop = (GST_CLOCK_TIME_IS_VALID (sstop) ? sstop : sstart);
|
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
if (!do_sync)
|
|
|
|
goto done;
|
2006-03-14 19:36:05 +00:00
|
|
|
|
2008-06-20 08:54:45 +00:00
|
|
|
/* adjust for latency */
|
|
|
|
stime = gst_base_sink_adjust_time (basesink, rstart);
|
|
|
|
|
2012-11-09 15:50:50 +00:00
|
|
|
/* adjust for rate control */
|
|
|
|
if (priv->rc_next == -1 || (stime != -1 && stime >= priv->rc_next)) {
|
|
|
|
GST_DEBUG_OBJECT (basesink, "reset rc_time to time %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (stime));
|
|
|
|
priv->rc_time = stime;
|
|
|
|
priv->rc_accumulated = 0;
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (basesink, "rate control next %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (priv->rc_next));
|
|
|
|
stime = priv->rc_next;
|
|
|
|
}
|
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
/* preroll done, we can sync since we are in PLAYING now. */
|
2007-03-14 11:21:48 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "possibly waiting for clock to reach %"
|
2008-06-20 08:54:45 +00:00
|
|
|
GST_TIME_FORMAT ", adjusted %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (rstart), GST_TIME_ARGS (stime));
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
2011-09-07 11:14:38 +00:00
|
|
|
/* This function will return immediately if start == -1, no clock
|
2006-03-14 19:36:05 +00:00
|
|
|
* or sync is disabled with GST_CLOCK_BADTIME. */
|
2008-05-19 11:11:49 +00:00
|
|
|
status = gst_base_sink_wait_clock (basesink, stime, &jitter);
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
2010-10-04 13:49:18 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "clock returned %d, jitter %c%" GST_TIME_FORMAT,
|
|
|
|
status, (jitter < 0 ? '-' : ' '), GST_TIME_ARGS (ABS (jitter)));
|
2006-01-18 17:18:39 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
/* invalid time, no clock or sync disabled, just render */
|
2006-03-14 19:36:05 +00:00
|
|
|
if (status == GST_CLOCK_BADTIME)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
/* waiting could have been interrupted and we can be flushing now */
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
if (G_UNLIKELY (basesink->flushing))
|
2006-01-18 17:18:39 +00:00
|
|
|
goto flushing;
|
|
|
|
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
/* check for unlocked by a state change, we are not flushing so
|
|
|
|
* we can try to preroll on the current buffer. */
|
|
|
|
if (G_UNLIKELY (status == GST_CLOCK_UNSCHEDULED)) {
|
|
|
|
GST_DEBUG_OBJECT (basesink, "unscheduled, waiting some more");
|
2009-02-03 14:27:34 +00:00
|
|
|
priv->call_preroll = TRUE;
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
goto again;
|
|
|
|
}
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
/* successful syncing done, record observation */
|
libs/gst/base/gstbasesink.c: Don't try to report a 0 position when we don't know, return -1 and FALSE instead. This m...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_do_sync), (gst_base_sink_preroll_object),
(gst_base_sink_event), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_change_state):
Don't try to report a 0 position when we don't know, return -1 and FALSE
instead. This mostly happens when we are prerolling.
Make sure we can report the right position before we post the ASYNC_DONE
message so that a message handler can query position without races.
* tests/check/generic/sinks.c: (send_eos), (GST_START_TEST),
(async_done_handoff), (async_done_func), (send_buffer),
(async_done_eos_func), (gst_sinks_suite):
Add two tests for the above.
2007-11-06 10:33:22 +00:00
|
|
|
priv->current_jitter = jitter;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
|
|
|
/* check if the object should be dropped */
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
*late = gst_base_sink_is_too_late (basesink, obj, rstart, rstop,
|
2013-04-19 08:24:06 +00:00
|
|
|
status, jitter, TRUE);
|
2006-03-14 11:18:07 +00:00
|
|
|
|
2006-03-14 19:36:05 +00:00
|
|
|
done:
|
2006-03-14 11:18:07 +00:00
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
/* ERRORS */
|
2009-05-11 16:56:56 +00:00
|
|
|
step_skipped:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (basesink, "skipped stepped object %p", obj);
|
2009-05-14 17:29:08 +00:00
|
|
|
*late = TRUE;
|
2009-05-11 16:56:56 +00:00
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
2006-03-14 11:18:07 +00:00
|
|
|
not_syncable:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (basesink, "non syncable object %p", obj);
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
2011-02-10 13:50:04 +00:00
|
|
|
qos_dropped:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (basesink, "dropped because of QoS %p", obj);
|
|
|
|
*late = TRUE;
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
2006-03-14 11:18:07 +00:00
|
|
|
flushing:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (basesink, "we are flushing");
|
2012-02-08 14:16:46 +00:00
|
|
|
return GST_FLOW_FLUSHING;
|
2006-03-14 11:18:07 +00:00
|
|
|
}
|
2009-01-21 11:43:55 +00:00
|
|
|
preroll_failed:
|
2006-03-14 11:18:07 +00:00
|
|
|
{
|
2009-01-21 11:43:55 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "preroll failed");
|
2009-06-12 11:18:21 +00:00
|
|
|
*step_end = FALSE;
|
2009-01-21 11:43:55 +00:00
|
|
|
return ret;
|
2006-03-14 11:18:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
static gboolean
|
2011-02-10 13:17:12 +00:00
|
|
|
gst_base_sink_send_qos (GstBaseSink * basesink, GstQOSType type,
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
gdouble proportion, GstClockTime time, GstClockTimeDiff diff)
|
|
|
|
{
|
|
|
|
GstEvent *event;
|
|
|
|
gboolean res;
|
|
|
|
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
/* generate Quality-of-Service event */
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, basesink,
|
2011-02-10 13:17:12 +00:00
|
|
|
"qos: type %d, proportion: %lf, diff %" G_GINT64_FORMAT ", timestamp %"
|
|
|
|
GST_TIME_FORMAT, type, proportion, diff, GST_TIME_ARGS (time));
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
2011-05-09 16:48:55 +00:00
|
|
|
event = gst_event_new_qos (type, proportion, diff, time);
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
|
|
|
/* send upstream */
|
|
|
|
res = gst_pad_push_event (basesink->sinkpad, event);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_base_sink_perform_qos (GstBaseSink * sink, gboolean dropped)
|
|
|
|
{
|
|
|
|
GstBaseSinkPrivate *priv;
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
GstClockTime start, stop;
|
|
|
|
GstClockTimeDiff jitter;
|
|
|
|
GstClockTime pt, entered, left;
|
|
|
|
GstClockTime duration;
|
|
|
|
gdouble rate;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
|
|
|
priv = sink->priv;
|
|
|
|
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
start = priv->current_rstart;
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
|
2009-06-10 13:51:40 +00:00
|
|
|
if (priv->current_step.valid)
|
|
|
|
return;
|
|
|
|
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
/* if Quality-of-Service disabled, do nothing */
|
2009-10-09 14:11:27 +00:00
|
|
|
if (!g_atomic_int_get (&priv->qos_enabled) ||
|
|
|
|
!GST_CLOCK_TIME_IS_VALID (start))
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
return;
|
|
|
|
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
stop = priv->current_rstop;
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
jitter = priv->current_jitter;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
2008-06-04 11:47:16 +00:00
|
|
|
if (jitter < 0) {
|
|
|
|
/* this is the time the buffer entered the sink */
|
|
|
|
if (start < -jitter)
|
|
|
|
entered = 0;
|
|
|
|
else
|
|
|
|
entered = start + jitter;
|
|
|
|
left = start;
|
|
|
|
} else {
|
|
|
|
/* this is the time the buffer entered the sink */
|
|
|
|
entered = start + jitter;
|
|
|
|
/* this is the time the buffer left the sink */
|
|
|
|
left = start + jitter;
|
|
|
|
}
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
2016-09-08 12:19:38 +00:00
|
|
|
/* calculate duration of the buffer, only use buffer durations if not in
|
|
|
|
* trick mode or key-unit mode. Otherwise the buffer durations will be
|
|
|
|
* meaningless as frames are being dropped in-between without updating the
|
|
|
|
* durations. */
|
2016-09-12 15:41:16 +00:00
|
|
|
duration = priv->avg_in_diff;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
/* if we have the time when the last buffer left us, calculate
|
|
|
|
* processing time */
|
2009-10-09 14:11:27 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (priv->last_left)) {
|
2006-04-10 10:46:44 +00:00
|
|
|
if (entered > priv->last_left) {
|
|
|
|
pt = entered - priv->last_left;
|
|
|
|
} else {
|
|
|
|
pt = 0;
|
|
|
|
}
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
} else {
|
2006-04-10 10:46:44 +00:00
|
|
|
pt = priv->avg_pt;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
}
|
|
|
|
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, sink, "start: %" GST_TIME_FORMAT
|
2011-02-14 12:47:02 +00:00
|
|
|
", stop %" GST_TIME_FORMAT ", entered %" GST_TIME_FORMAT ", left %"
|
|
|
|
GST_TIME_FORMAT ", pt: %" GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT
|
|
|
|
",jitter %" G_GINT64_FORMAT, GST_TIME_ARGS (start), GST_TIME_ARGS (stop),
|
|
|
|
GST_TIME_ARGS (entered), GST_TIME_ARGS (left), GST_TIME_ARGS (pt),
|
|
|
|
GST_TIME_ARGS (duration), jitter);
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
|
2016-09-12 15:41:16 +00:00
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, sink,
|
|
|
|
"avg_pt: %" GST_TIME_FORMAT ", avg_rate: %g",
|
|
|
|
GST_TIME_ARGS (priv->avg_pt), priv->avg_rate);
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
|
|
|
|
/* collect running averages. for first observations, we copy the
|
|
|
|
* values */
|
2009-10-09 14:11:27 +00:00
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (priv->avg_pt))
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
priv->avg_pt = pt;
|
|
|
|
else
|
|
|
|
priv->avg_pt = UPDATE_RUNNING_AVG (priv->avg_pt, pt);
|
|
|
|
|
2016-09-12 15:41:16 +00:00
|
|
|
if (duration != -1 && duration != 0) {
|
2006-04-09 16:57:34 +00:00
|
|
|
rate =
|
|
|
|
gst_guint64_to_gdouble (priv->avg_pt) /
|
2016-09-12 15:41:16 +00:00
|
|
|
gst_guint64_to_gdouble (duration);
|
|
|
|
} else {
|
2011-02-14 12:49:10 +00:00
|
|
|
rate = 1.0;
|
2016-09-12 15:41:16 +00:00
|
|
|
}
|
2006-04-10 10:46:44 +00:00
|
|
|
|
2009-10-09 14:11:27 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (priv->last_left)) {
|
2006-04-10 10:46:44 +00:00
|
|
|
if (dropped || priv->avg_rate < 0.0) {
|
|
|
|
priv->avg_rate = rate;
|
|
|
|
} else {
|
|
|
|
if (rate > 1.0)
|
|
|
|
priv->avg_rate = UPDATE_RUNNING_AVG_N (priv->avg_rate, rate);
|
|
|
|
else
|
|
|
|
priv->avg_rate = UPDATE_RUNNING_AVG_P (priv->avg_rate, rate);
|
|
|
|
}
|
|
|
|
}
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
|
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, sink,
|
2016-09-12 15:41:16 +00:00
|
|
|
"updated: avg_pt: %" GST_TIME_FORMAT
|
|
|
|
", avg_rate: %g", GST_TIME_ARGS (priv->avg_pt), priv->avg_rate);
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
|
|
|
|
|
2006-04-10 10:46:44 +00:00
|
|
|
if (priv->avg_rate >= 0.0) {
|
2011-02-10 13:17:12 +00:00
|
|
|
GstQOSType type;
|
|
|
|
GstClockTimeDiff diff;
|
|
|
|
|
2008-06-04 11:47:16 +00:00
|
|
|
/* if we have a valid rate, start sending QoS messages */
|
|
|
|
if (priv->current_jitter < 0) {
|
|
|
|
/* make sure we never go below 0 when adding the jitter to the
|
|
|
|
* timestamp. */
|
|
|
|
if (priv->current_rstart < -priv->current_jitter)
|
|
|
|
priv->current_jitter = -priv->current_rstart;
|
|
|
|
}
|
2011-02-10 13:17:12 +00:00
|
|
|
|
|
|
|
if (priv->throttle_time > 0) {
|
|
|
|
diff = priv->throttle_time;
|
|
|
|
type = GST_QOS_TYPE_THROTTLE;
|
|
|
|
} else {
|
|
|
|
diff = priv->current_jitter;
|
|
|
|
if (diff <= 0)
|
|
|
|
type = GST_QOS_TYPE_OVERFLOW;
|
|
|
|
else
|
|
|
|
type = GST_QOS_TYPE_UNDERFLOW;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_base_sink_send_qos (sink, type, priv->avg_rate, priv->current_rstart,
|
|
|
|
diff);
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
}
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
|
2006-04-10 10:46:44 +00:00
|
|
|
/* record when this buffer will leave us */
|
|
|
|
priv->last_left = left;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* reset all qos measuring */
|
|
|
|
static void
|
|
|
|
gst_base_sink_reset_qos (GstBaseSink * sink)
|
|
|
|
{
|
|
|
|
GstBaseSinkPrivate *priv;
|
|
|
|
|
|
|
|
priv = sink->priv;
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
|
2011-02-14 11:21:39 +00:00
|
|
|
priv->last_render_time = GST_CLOCK_TIME_NONE;
|
2011-02-14 13:00:38 +00:00
|
|
|
priv->prev_rstart = GST_CLOCK_TIME_NONE;
|
2011-02-10 13:50:04 +00:00
|
|
|
priv->earliest_in_time = GST_CLOCK_TIME_NONE;
|
2009-10-09 14:11:27 +00:00
|
|
|
priv->last_left = GST_CLOCK_TIME_NONE;
|
|
|
|
priv->avg_pt = GST_CLOCK_TIME_NONE;
|
2006-04-10 10:46:44 +00:00
|
|
|
priv->avg_rate = -1.0;
|
2011-02-14 13:00:38 +00:00
|
|
|
priv->avg_in_diff = GST_CLOCK_TIME_NONE;
|
gst/gstbus.c: Small documentation clarification about the signal watch.
Original commit message from CVS:
* gst/gstbus.c:
Small documentation clarification about the signal watch.
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_do_render_stats), (gst_base_sink_render_object),
(gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_change_state):
Convert and store timestamps in stream time and running time, the
raw timestamps are not usefull, also document this better.
Use different window sizes for good and bad QoS observations so
we react to badness a little quicker.
Keep track of the amount of rendered and dropped buffers.
Send QoS timestamps in running time.
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_sink_eventfunc),
(gst_base_transform_handle_buffer):
Compare QoS timestamps against running time.
2006-04-07 14:02:12 +00:00
|
|
|
priv->rendered = 0;
|
|
|
|
priv->dropped = 0;
|
2007-06-14 12:03:44 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Checks if the object was scheduled too late.
|
2006-03-14 11:18:07 +00:00
|
|
|
*
|
2011-02-10 13:53:34 +00:00
|
|
|
* rstart/rstop contain the running_time start and stop values
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
* of the object.
|
|
|
|
*
|
|
|
|
* status and jitter contain the return values from the clock wait.
|
2006-03-14 11:18:07 +00:00
|
|
|
*
|
2014-06-05 19:38:20 +00:00
|
|
|
* returns %TRUE if the buffer was too late.
|
2006-03-14 11:18:07 +00:00
|
|
|
*/
|
|
|
|
static gboolean
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
gst_base_sink_is_too_late (GstBaseSink * basesink, GstMiniObject * obj,
|
2011-02-10 13:53:34 +00:00
|
|
|
GstClockTime rstart, GstClockTime rstop,
|
2013-04-19 08:24:06 +00:00
|
|
|
GstClockReturn status, GstClockTimeDiff jitter, gboolean render)
|
2006-03-14 11:18:07 +00:00
|
|
|
{
|
|
|
|
gboolean late;
|
2011-05-13 16:07:24 +00:00
|
|
|
guint64 max_lateness;
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
GstBaseSinkPrivate *priv;
|
|
|
|
|
|
|
|
priv = basesink->priv;
|
|
|
|
|
|
|
|
late = FALSE;
|
2006-03-14 11:18:07 +00:00
|
|
|
|
2006-03-14 19:36:05 +00:00
|
|
|
/* only for objects that were too late */
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
if (G_LIKELY (status != GST_CLOCK_EARLY))
|
2006-03-14 11:18:07 +00:00
|
|
|
goto in_time;
|
2006-03-06 16:02:37 +00:00
|
|
|
|
2011-02-22 18:09:48 +00:00
|
|
|
max_lateness = basesink->max_lateness;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
|
|
|
/* check if frame dropping is enabled */
|
|
|
|
if (max_lateness == -1)
|
|
|
|
goto no_drop;
|
|
|
|
|
|
|
|
/* only check for buffers */
|
2006-03-13 11:16:45 +00:00
|
|
|
if (G_UNLIKELY (!GST_IS_BUFFER (obj)))
|
2006-03-14 11:18:07 +00:00
|
|
|
goto not_buffer;
|
2006-03-13 11:16:45 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
/* can't do check if we don't have a timestamp */
|
2011-02-10 13:53:34 +00:00
|
|
|
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (rstart)))
|
2006-03-14 11:18:07 +00:00
|
|
|
goto no_timestamp;
|
|
|
|
|
2006-04-28 13:25:58 +00:00
|
|
|
/* we can add a valid stop time */
|
2011-02-10 13:53:34 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (rstop))
|
|
|
|
max_lateness += rstop;
|
2011-02-14 13:00:38 +00:00
|
|
|
else {
|
2011-02-10 13:53:34 +00:00
|
|
|
max_lateness += rstart;
|
2011-02-14 13:00:38 +00:00
|
|
|
/* no stop time, use avg frame diff */
|
|
|
|
if (priv->avg_in_diff != -1)
|
|
|
|
max_lateness += priv->avg_in_diff;
|
|
|
|
}
|
2006-04-28 13:25:58 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
/* if the jitter bigger than duration and lateness we are too late */
|
2011-02-10 13:53:34 +00:00
|
|
|
if ((late = rstart + jitter > max_lateness)) {
|
2009-07-06 18:48:58 +00:00
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_PERFORMANCE, basesink,
|
|
|
|
"buffer is too late %" GST_TIME_FORMAT
|
2011-02-10 13:53:34 +00:00
|
|
|
" > %" GST_TIME_FORMAT, GST_TIME_ARGS (rstart + jitter),
|
2006-04-28 13:25:58 +00:00
|
|
|
GST_TIME_ARGS (max_lateness));
|
2009-08-24 15:56:32 +00:00
|
|
|
/* !!emergency!!, if we did not receive anything valid for more than a
|
2006-04-28 13:25:58 +00:00
|
|
|
* second, render it anyway so the user sees something */
|
2011-02-14 11:21:39 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (priv->last_render_time) &&
|
|
|
|
rstart - priv->last_render_time > GST_SECOND) {
|
2006-04-28 13:25:58 +00:00
|
|
|
late = FALSE;
|
2009-06-01 17:37:14 +00:00
|
|
|
GST_ELEMENT_WARNING (basesink, CORE, CLOCK,
|
2009-06-08 15:16:27 +00:00
|
|
|
(_("A lot of buffers are being dropped.")),
|
|
|
|
("There may be a timestamping problem, or this computer is too slow."));
|
2009-07-06 18:48:58 +00:00
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_PERFORMANCE, basesink,
|
2006-04-28 13:25:58 +00:00
|
|
|
"**emergency** last buffer at %" GST_TIME_FORMAT " > GST_SECOND",
|
2011-02-14 11:21:39 +00:00
|
|
|
GST_TIME_ARGS (priv->last_render_time));
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
}
|
|
|
|
}
|
2006-03-14 11:18:07 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
done:
|
2013-04-19 08:24:06 +00:00
|
|
|
if (render && (!late || !GST_CLOCK_TIME_IS_VALID (priv->last_render_time))) {
|
2011-02-14 11:21:39 +00:00
|
|
|
priv->last_render_time = rstart;
|
2011-02-10 13:50:04 +00:00
|
|
|
/* the next allowed input timestamp */
|
|
|
|
if (priv->throttle_time > 0)
|
2011-02-10 13:53:34 +00:00
|
|
|
priv->earliest_in_time = rstart + priv->throttle_time;
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
}
|
2006-03-14 11:18:07 +00:00
|
|
|
return late;
|
gst/base/gstbasesink.c: Reworked the base sink, handle event and buffer serialisation correctly and removed possible ...
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_basesink_set_property),
(gst_basesink_preroll_queue_empty),
(gst_basesink_preroll_queue_flush), (gst_basesink_handle_object),
(gst_basesink_event), (gst_basesink_do_sync),
(gst_basesink_handle_event), (gst_basesink_handle_buffer),
(gst_basesink_chain), (gst_basesink_loop), (gst_basesink_activate),
(gst_basesink_change_state):
Reworked the base sink, handle event and buffer serialisation
correctly and removed possible deadlock.
Handle EOS correctly.
2005-06-25 17:54:58 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
/* all is fine */
|
2006-03-14 11:18:07 +00:00
|
|
|
in_time:
|
2005-08-24 17:57:36 +00:00
|
|
|
{
|
2006-03-14 11:18:07 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "object was scheduled in time");
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
goto done;
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
}
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
no_drop:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (basesink, "frame dropping disabled");
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
goto done;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
}
|
2006-03-14 11:18:07 +00:00
|
|
|
not_buffer:
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
{
|
2006-03-14 11:18:07 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "object is not a buffer");
|
|
|
|
return FALSE;
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
}
|
2006-03-14 11:18:07 +00:00
|
|
|
no_timestamp:
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
{
|
2006-03-14 11:18:07 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "buffer has no timestamp");
|
|
|
|
return FALSE;
|
|
|
|
}
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
}
|
|
|
|
|
2014-03-18 17:11:15 +00:00
|
|
|
static void
|
|
|
|
gst_base_sink_update_start_time (GstBaseSink * basesink)
|
|
|
|
{
|
|
|
|
GstClock *clock;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (basesink);
|
2016-06-13 16:33:27 +00:00
|
|
|
if (GST_STATE (basesink) == GST_STATE_PLAYING
|
|
|
|
&& (clock = GST_ELEMENT_CLOCK (basesink))) {
|
2014-03-18 17:11:15 +00:00
|
|
|
GstClockTime now;
|
|
|
|
|
|
|
|
gst_object_ref (clock);
|
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
|
|
|
|
|
|
|
/* calculate the time when we stopped */
|
|
|
|
now = gst_clock_get_time (clock);
|
|
|
|
gst_object_unref (clock);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (basesink);
|
|
|
|
/* store the current running time */
|
|
|
|
if (GST_ELEMENT_START_TIME (basesink) != GST_CLOCK_TIME_NONE) {
|
|
|
|
if (now != GST_CLOCK_TIME_NONE)
|
|
|
|
GST_ELEMENT_START_TIME (basesink) =
|
|
|
|
now - GST_ELEMENT_CAST (basesink)->base_time;
|
|
|
|
else
|
|
|
|
GST_WARNING_OBJECT (basesink,
|
|
|
|
"Clock %s returned invalid time, can't calculate "
|
|
|
|
"running_time when going to the PAUSED state",
|
|
|
|
GST_OBJECT_NAME (clock));
|
|
|
|
}
|
|
|
|
GST_DEBUG_OBJECT (basesink,
|
|
|
|
"start_time=%" GST_TIME_FORMAT ", now=%" GST_TIME_FORMAT
|
|
|
|
", base_time %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (GST_ELEMENT_START_TIME (basesink)),
|
|
|
|
GST_TIME_ARGS (now),
|
|
|
|
GST_TIME_ARGS (GST_ELEMENT_CAST (basesink)->base_time));
|
|
|
|
}
|
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
|
|
|
}
|
|
|
|
|
2008-10-16 14:09:18 +00:00
|
|
|
static void
|
|
|
|
gst_base_sink_flush_start (GstBaseSink * basesink, GstPad * pad)
|
|
|
|
{
|
|
|
|
/* make sure we are not blocked on the clock also clear any pending
|
|
|
|
* eos state. */
|
|
|
|
gst_base_sink_set_flushing (basesink, pad, TRUE);
|
|
|
|
|
|
|
|
/* we grab the stream lock but that is not needed since setting the
|
|
|
|
* sink to flushing would make sure no state commit is being done
|
|
|
|
* anymore */
|
|
|
|
GST_PAD_STREAM_LOCK (pad);
|
|
|
|
gst_base_sink_reset_qos (basesink);
|
2010-12-28 15:23:32 +00:00
|
|
|
/* and we need to commit our state again on the next
|
|
|
|
* prerolled buffer */
|
|
|
|
basesink->playing_async = TRUE;
|
2008-10-16 14:09:18 +00:00
|
|
|
if (basesink->priv->async_enabled) {
|
2014-03-18 17:11:15 +00:00
|
|
|
gst_base_sink_update_start_time (basesink);
|
2011-06-08 11:40:32 +00:00
|
|
|
gst_element_lost_state (GST_ELEMENT_CAST (basesink));
|
2008-10-16 14:09:18 +00:00
|
|
|
} else {
|
2011-08-23 16:19:53 +00:00
|
|
|
/* start time reset in above case as well;
|
|
|
|
* arranges for a.o. proper position reporting when flushing in PAUSED */
|
|
|
|
gst_element_set_start_time (GST_ELEMENT_CAST (basesink), 0);
|
2008-10-16 14:09:18 +00:00
|
|
|
basesink->priv->have_latency = TRUE;
|
|
|
|
}
|
|
|
|
gst_base_sink_set_last_buffer (basesink, NULL);
|
2015-06-22 11:02:55 +00:00
|
|
|
gst_base_sink_set_last_buffer_list (basesink, NULL);
|
2008-10-16 14:09:18 +00:00
|
|
|
GST_PAD_STREAM_UNLOCK (pad);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-06-10 09:55:08 +00:00
|
|
|
gst_base_sink_flush_stop (GstBaseSink * basesink, GstPad * pad,
|
|
|
|
gboolean reset_time)
|
2008-10-16 14:09:18 +00:00
|
|
|
{
|
|
|
|
/* unset flushing so we can accept new data, this also flushes out any EOS
|
|
|
|
* event. */
|
|
|
|
gst_base_sink_set_flushing (basesink, pad, FALSE);
|
|
|
|
|
|
|
|
/* for position reporting */
|
|
|
|
GST_OBJECT_LOCK (basesink);
|
2009-10-09 14:11:27 +00:00
|
|
|
basesink->priv->current_sstart = GST_CLOCK_TIME_NONE;
|
|
|
|
basesink->priv->current_sstop = GST_CLOCK_TIME_NONE;
|
|
|
|
basesink->priv->eos_rtime = GST_CLOCK_TIME_NONE;
|
2009-02-03 14:27:34 +00:00
|
|
|
basesink->priv->call_preroll = TRUE;
|
2009-06-08 14:27:36 +00:00
|
|
|
basesink->priv->current_step.valid = FALSE;
|
|
|
|
basesink->priv->pending_step.valid = FALSE;
|
2011-11-18 11:35:46 +00:00
|
|
|
if (basesink->pad_mode == GST_PAD_MODE_PUSH) {
|
2008-10-16 14:09:18 +00:00
|
|
|
/* we need new segment info after the flush. */
|
|
|
|
basesink->have_newsegment = FALSE;
|
2011-06-10 09:55:08 +00:00
|
|
|
if (reset_time) {
|
|
|
|
gst_segment_init (&basesink->segment, GST_FORMAT_UNDEFINED);
|
2012-11-20 15:19:16 +00:00
|
|
|
GST_ELEMENT_START_TIME (basesink) = 0;
|
2011-06-10 09:55:08 +00:00
|
|
|
}
|
2008-10-16 14:09:18 +00:00
|
|
|
}
|
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
2012-06-13 08:51:04 +00:00
|
|
|
|
|
|
|
if (reset_time) {
|
|
|
|
GST_DEBUG_OBJECT (basesink, "posting reset-time message");
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
|
|
|
gst_message_new_reset_time (GST_OBJECT_CAST (basesink), 0));
|
|
|
|
}
|
2008-10-16 14:09:18 +00:00
|
|
|
}
|
|
|
|
|
2011-12-02 21:20:08 +00:00
|
|
|
static GstFlowReturn
|
2012-08-31 18:31:45 +00:00
|
|
|
gst_base_sink_default_wait_event (GstBaseSink * basesink, GstEvent * event)
|
2011-12-02 21:20:08 +00:00
|
|
|
{
|
|
|
|
GstFlowReturn ret;
|
2013-03-03 16:00:11 +00:00
|
|
|
gboolean late, step_end = FALSE;
|
2011-12-02 21:20:08 +00:00
|
|
|
|
|
|
|
ret = gst_base_sink_do_sync (basesink, GST_MINI_OBJECT_CAST (event),
|
2011-12-03 05:29:42 +00:00
|
|
|
&late, &step_end);
|
2011-12-02 21:20:08 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-09-04 10:13:11 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_base_sink_wait_event (GstBaseSink * basesink, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstFlowReturn ret;
|
|
|
|
GstBaseSinkClass *bclass;
|
|
|
|
|
|
|
|
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
|
|
|
|
|
|
|
if (G_LIKELY (bclass->wait_event))
|
|
|
|
ret = bclass->wait_event (basesink, event);
|
|
|
|
else
|
|
|
|
ret = GST_FLOW_NOT_SUPPORTED;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
static gboolean
|
2011-12-02 21:20:08 +00:00
|
|
|
gst_base_sink_default_event (GstBaseSink * basesink, GstEvent * event)
|
2005-03-28 14:54:33 +00:00
|
|
|
{
|
|
|
|
gboolean result = TRUE;
|
|
|
|
GstBaseSinkClass *bclass;
|
|
|
|
|
2005-07-10 12:03:13 +00:00
|
|
|
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2011-12-02 21:20:08 +00:00
|
|
|
case GST_EVENT_FLUSH_START:
|
2005-03-28 14:54:33 +00:00
|
|
|
{
|
2011-12-02 21:20:08 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "flush-start %p", event);
|
|
|
|
gst_base_sink_flush_start (basesink, basesink->sinkpad);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
|
|
|
{
|
|
|
|
gboolean reset_time;
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
|
2011-12-02 21:20:08 +00:00
|
|
|
gst_event_parse_flush_stop (event, &reset_time);
|
|
|
|
GST_DEBUG_OBJECT (basesink, "flush-stop %p, reset_time: %d", event,
|
|
|
|
reset_time);
|
|
|
|
gst_base_sink_flush_stop (basesink, basesink->sinkpad, reset_time);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_EVENT_EOS:
|
|
|
|
{
|
|
|
|
GstMessage *message;
|
|
|
|
guint32 seqnum;
|
2011-06-06 09:20:29 +00:00
|
|
|
|
|
|
|
/* we set the received EOS flag here so that we can use it when testing if
|
|
|
|
* we are prerolled and to refuse more buffers. */
|
|
|
|
basesink->priv->received_eos = TRUE;
|
|
|
|
|
2011-12-02 21:20:08 +00:00
|
|
|
/* wait for EOS */
|
2012-09-04 10:13:11 +00:00
|
|
|
if (G_UNLIKELY (gst_base_sink_wait_event (basesink,
|
|
|
|
event) != GST_FLOW_OK)) {
|
|
|
|
result = FALSE;
|
|
|
|
goto done;
|
2011-12-02 21:20:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* the EOS event is completely handled so we mark
|
|
|
|
* ourselves as being in the EOS state. eos is also
|
|
|
|
* protected by the object lock so we can read it when
|
|
|
|
* answering the POSITION query. */
|
|
|
|
GST_OBJECT_LOCK (basesink);
|
|
|
|
basesink->eos = TRUE;
|
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
2011-06-06 09:20:29 +00:00
|
|
|
|
2011-12-02 21:20:08 +00:00
|
|
|
/* ok, now we can post the message */
|
|
|
|
GST_DEBUG_OBJECT (basesink, "Now posting EOS");
|
|
|
|
|
|
|
|
seqnum = basesink->priv->seqnum = gst_event_get_seqnum (event);
|
|
|
|
GST_DEBUG_OBJECT (basesink, "Got seqnum #%" G_GUINT32_FORMAT, seqnum);
|
|
|
|
|
|
|
|
message = gst_message_new_eos (GST_OBJECT_CAST (basesink));
|
|
|
|
gst_message_set_seqnum (message, seqnum);
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink), message);
|
2005-03-28 14:54:33 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-07-09 18:28:20 +00:00
|
|
|
case GST_EVENT_STREAM_START:
|
|
|
|
{
|
|
|
|
GstMessage *message;
|
|
|
|
guint32 seqnum;
|
2013-07-22 10:06:08 +00:00
|
|
|
guint group_id;
|
2012-07-09 18:28:20 +00:00
|
|
|
|
|
|
|
seqnum = gst_event_get_seqnum (event);
|
|
|
|
GST_DEBUG_OBJECT (basesink, "Now posting STREAM_START (seqnum:%d)",
|
|
|
|
seqnum);
|
|
|
|
message = gst_message_new_stream_start (GST_OBJECT_CAST (basesink));
|
2013-07-23 16:53:44 +00:00
|
|
|
if (gst_event_parse_group_id (event, &group_id)) {
|
2013-07-22 10:06:08 +00:00
|
|
|
gst_message_set_group_id (message, group_id);
|
2013-07-23 16:53:44 +00:00
|
|
|
} else {
|
|
|
|
GST_FIXME_OBJECT (basesink, "stream-start event without group-id. "
|
|
|
|
"Consider implementing group-id handling in the upstream "
|
|
|
|
"elements");
|
|
|
|
}
|
2012-07-09 18:28:20 +00:00
|
|
|
gst_message_set_seqnum (message, seqnum);
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink), message);
|
|
|
|
break;
|
|
|
|
}
|
2011-05-08 11:07:13 +00:00
|
|
|
case GST_EVENT_CAPS:
|
|
|
|
{
|
2014-11-09 09:32:18 +00:00
|
|
|
GstCaps *caps, *current_caps;
|
2011-05-08 11:07:13 +00:00
|
|
|
|
2011-05-09 13:06:07 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "caps %p", event);
|
|
|
|
|
2011-05-08 11:07:13 +00:00
|
|
|
gst_event_parse_caps (event, &caps);
|
2014-11-09 09:32:18 +00:00
|
|
|
current_caps = gst_pad_get_current_caps (GST_BASE_SINK_PAD (basesink));
|
2011-05-08 11:07:13 +00:00
|
|
|
|
2014-11-09 09:32:18 +00:00
|
|
|
if (current_caps && gst_caps_is_equal (current_caps, caps)) {
|
|
|
|
GST_DEBUG_OBJECT (basesink,
|
|
|
|
"New caps equal to old ones: %" GST_PTR_FORMAT, caps);
|
|
|
|
} else {
|
|
|
|
if (bclass->set_caps)
|
|
|
|
result = bclass->set_caps (basesink, caps);
|
|
|
|
|
|
|
|
if (result) {
|
|
|
|
GST_OBJECT_LOCK (basesink);
|
|
|
|
gst_caps_replace (&basesink->priv->caps, caps);
|
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
|
|
|
}
|
2011-12-01 15:46:06 +00:00
|
|
|
}
|
2014-11-09 09:32:18 +00:00
|
|
|
if (current_caps)
|
|
|
|
gst_caps_unref (current_caps);
|
2011-05-08 11:07:13 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-05-13 16:07:24 +00:00
|
|
|
case GST_EVENT_SEGMENT:
|
2011-12-02 21:20:08 +00:00
|
|
|
/* configure the segment */
|
|
|
|
/* The segment is protected with both the STREAM_LOCK and the OBJECT_LOCK.
|
|
|
|
* We protect with the OBJECT_LOCK so that we can use the values to
|
|
|
|
* safely answer a POSITION query. */
|
|
|
|
GST_OBJECT_LOCK (basesink);
|
|
|
|
/* the newsegment event is needed to bring the buffer timestamps to the
|
|
|
|
* stream time and to drop samples outside of the playback segment. */
|
|
|
|
gst_event_copy_segment (event, &basesink->segment);
|
2013-02-27 21:15:48 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "configured segment %" GST_SEGMENT_FORMAT,
|
2011-12-02 21:20:08 +00:00
|
|
|
&basesink->segment);
|
|
|
|
basesink->have_newsegment = TRUE;
|
2014-07-01 10:21:53 +00:00
|
|
|
gst_base_sink_reset_qos (basesink);
|
2011-12-02 21:20:08 +00:00
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
|
|
|
break;
|
2012-08-31 18:31:45 +00:00
|
|
|
case GST_EVENT_GAP:
|
|
|
|
{
|
2012-09-04 10:13:11 +00:00
|
|
|
if (G_UNLIKELY (gst_base_sink_wait_event (basesink,
|
|
|
|
event) != GST_FLOW_OK))
|
|
|
|
result = FALSE;
|
2012-08-31 18:31:45 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-12-02 21:20:08 +00:00
|
|
|
case GST_EVENT_TAG:
|
gst/base/gstbasesink.c: Reworked the base sink, handle event and buffer serialisation correctly and removed possible ...
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_basesink_set_property),
(gst_basesink_preroll_queue_empty),
(gst_basesink_preroll_queue_flush), (gst_basesink_handle_object),
(gst_basesink_event), (gst_basesink_do_sync),
(gst_basesink_handle_event), (gst_basesink_handle_buffer),
(gst_basesink_chain), (gst_basesink_loop), (gst_basesink_activate),
(gst_basesink_change_state):
Reworked the base sink, handle event and buffer serialisation
correctly and removed possible deadlock.
Handle EOS correctly.
2005-06-25 17:54:58 +00:00
|
|
|
{
|
2011-12-02 21:20:08 +00:00
|
|
|
GstTagList *taglist;
|
2007-10-08 17:05:06 +00:00
|
|
|
|
2011-12-02 21:20:08 +00:00
|
|
|
gst_event_parse_tag (event, &taglist);
|
2011-06-06 09:20:29 +00:00
|
|
|
|
2011-12-02 21:20:08 +00:00
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
|
|
|
gst_message_new_tag (GST_OBJECT_CAST (basesink),
|
|
|
|
gst_tag_list_copy (taglist)));
|
2005-03-28 14:54:33 +00:00
|
|
|
break;
|
gst/base/gstbasesink.c: Reworked the base sink, handle event and buffer serialisation correctly and removed possible ...
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_basesink_set_property),
(gst_basesink_preroll_queue_empty),
(gst_basesink_preroll_queue_flush), (gst_basesink_handle_object),
(gst_basesink_event), (gst_basesink_do_sync),
(gst_basesink_handle_event), (gst_basesink_handle_buffer),
(gst_basesink_chain), (gst_basesink_loop), (gst_basesink_activate),
(gst_basesink_change_state):
Reworked the base sink, handle event and buffer serialisation
correctly and removed possible deadlock.
Handle EOS correctly.
2005-06-25 17:54:58 +00:00
|
|
|
}
|
2012-07-03 15:25:21 +00:00
|
|
|
case GST_EVENT_TOC:
|
|
|
|
{
|
|
|
|
GstToc *toc;
|
|
|
|
gboolean updated;
|
|
|
|
|
|
|
|
gst_event_parse_toc (event, &toc, &updated);
|
|
|
|
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
|
|
|
gst_message_new_toc (GST_OBJECT_CAST (basesink), toc, updated));
|
|
|
|
|
|
|
|
gst_toc_unref (toc);
|
|
|
|
break;
|
|
|
|
}
|
2011-12-02 21:20:08 +00:00
|
|
|
case GST_EVENT_SINK_MESSAGE:
|
|
|
|
{
|
|
|
|
GstMessage *msg = NULL;
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
|
2011-12-02 21:20:08 +00:00
|
|
|
gst_event_parse_sink_message (event, &msg);
|
|
|
|
if (msg)
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink), msg);
|
Some docs updates
Original commit message from CVS:
* CHANGES-0.9:
* docs/design/part-TODO.txt:
* docs/design/part-events.txt:
Some docs updates
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_event), (gst_base_sink_do_sync),
(gst_base_sink_activate_push), (gst_base_sink_activate_pull):
* gst/base/gstbasesrc.c: (gst_base_src_send_discont),
(gst_base_src_do_seek), (gst_base_src_event_handler),
(gst_base_src_loop):
* gst/base/gstbasetransform.c: (gst_base_transform_transform_caps),
(gst_base_transform_configure_caps), (gst_base_transform_setcaps),
(gst_base_transform_get_size), (gst_base_transform_buffer_alloc),
(gst_base_transform_event), (gst_base_transform_handle_buffer),
(gst_base_transform_set_passthrough),
(gst_base_transform_is_passthrough):
* gst/elements/gstfakesink.c: (gst_fake_sink_event):
* gst/elements/gstfilesink.c: (gst_file_sink_event):
Event updates.
* gst/gstbuffer.h:
Use faster casts.
* gst/gstelement.c: (gst_element_seek):
* gst/gstelement.h:
Update gst_element_seek.
* gst/gstevent.c: (gst_event_finalize), (_gst_event_copy),
(gst_event_new), (gst_event_new_custom), (gst_event_get_structure),
(gst_event_new_flush_start), (gst_event_new_flush_stop),
(gst_event_new_eos), (gst_event_new_newsegment),
(gst_event_parse_newsegment), (gst_event_new_tag),
(gst_event_parse_tag), (gst_event_new_filler), (gst_event_new_qos),
(gst_event_parse_qos), (gst_event_new_seek),
(gst_event_parse_seek), (gst_event_new_navigation):
* gst/gstevent.h:
Make GstEvent use GstStructure. Add parsing code, make sure the
API is sufficiently generic.
Mark possible directions of events and serialization.
* gst/gstmessage.c: (gst_message_init), (gst_message_finalize),
(_gst_message_copy), (gst_message_new_segment_start),
(gst_message_new_segment_done), (gst_message_new_custom),
(gst_message_parse_segment_start),
(gst_message_parse_segment_done):
Small cleanups.
* gst/gstpad.c: (gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Update for new events.
Catch events sent in wrong directions.
* gst/gstqueue.c: (gst_queue_link_src),
(gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop),
(gst_queue_handle_src_query):
Event updates.
* gst/gsttag.c:
* gst/gsttag.h:
Remove event code from this file.
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_event),
(gst_dp_event_from_packet):
Event updates.
2005-07-27 18:33:03 +00:00
|
|
|
break;
|
2011-12-02 21:20:08 +00:00
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
done:
|
|
|
|
gst_event_unref (event);
|
2011-06-10 09:55:08 +00:00
|
|
|
|
2011-12-02 21:20:08 +00:00
|
|
|
return result;
|
|
|
|
}
|
Some docs updates
Original commit message from CVS:
* CHANGES-0.9:
* docs/design/part-TODO.txt:
* docs/design/part-events.txt:
Some docs updates
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_event), (gst_base_sink_do_sync),
(gst_base_sink_activate_push), (gst_base_sink_activate_pull):
* gst/base/gstbasesrc.c: (gst_base_src_send_discont),
(gst_base_src_do_seek), (gst_base_src_event_handler),
(gst_base_src_loop):
* gst/base/gstbasetransform.c: (gst_base_transform_transform_caps),
(gst_base_transform_configure_caps), (gst_base_transform_setcaps),
(gst_base_transform_get_size), (gst_base_transform_buffer_alloc),
(gst_base_transform_event), (gst_base_transform_handle_buffer),
(gst_base_transform_set_passthrough),
(gst_base_transform_is_passthrough):
* gst/elements/gstfakesink.c: (gst_fake_sink_event):
* gst/elements/gstfilesink.c: (gst_file_sink_event):
Event updates.
* gst/gstbuffer.h:
Use faster casts.
* gst/gstelement.c: (gst_element_seek):
* gst/gstelement.h:
Update gst_element_seek.
* gst/gstevent.c: (gst_event_finalize), (_gst_event_copy),
(gst_event_new), (gst_event_new_custom), (gst_event_get_structure),
(gst_event_new_flush_start), (gst_event_new_flush_stop),
(gst_event_new_eos), (gst_event_new_newsegment),
(gst_event_parse_newsegment), (gst_event_new_tag),
(gst_event_parse_tag), (gst_event_new_filler), (gst_event_new_qos),
(gst_event_parse_qos), (gst_event_new_seek),
(gst_event_parse_seek), (gst_event_new_navigation):
* gst/gstevent.h:
Make GstEvent use GstStructure. Add parsing code, make sure the
API is sufficiently generic.
Mark possible directions of events and serialization.
* gst/gstmessage.c: (gst_message_init), (gst_message_finalize),
(_gst_message_copy), (gst_message_new_segment_start),
(gst_message_new_segment_done), (gst_message_new_custom),
(gst_message_parse_segment_start),
(gst_message_parse_segment_done):
Small cleanups.
* gst/gstpad.c: (gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Update for new events.
Catch events sent in wrong directions.
* gst/gstqueue.c: (gst_queue_link_src),
(gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop),
(gst_queue_handle_src_query):
Event updates.
* gst/gsttag.c:
* gst/gsttag.h:
Remove event code from this file.
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_event),
(gst_dp_event_from_packet):
Event updates.
2005-07-27 18:33:03 +00:00
|
|
|
|
2011-12-02 21:20:08 +00:00
|
|
|
static gboolean
|
|
|
|
gst_base_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstBaseSink *basesink;
|
|
|
|
gboolean result = TRUE;
|
|
|
|
GstBaseSinkClass *bclass;
|
2006-12-07 10:59:05 +00:00
|
|
|
|
2011-12-02 21:20:08 +00:00
|
|
|
basesink = GST_BASE_SINK_CAST (parent);
|
|
|
|
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
2008-08-19 16:47:07 +00:00
|
|
|
|
2011-12-02 21:20:08 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "received event %p %" GST_PTR_FORMAT, event,
|
|
|
|
event);
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
|
|
|
/* special case for this serialized event because we don't want to grab
|
|
|
|
* the PREROLL lock or check if we were flushing */
|
|
|
|
if (bclass->event)
|
|
|
|
result = bclass->event (basesink, event);
|
2005-03-28 14:54:33 +00:00
|
|
|
break;
|
|
|
|
default:
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
if (GST_EVENT_IS_SERIALIZED (event)) {
|
2011-12-02 11:42:50 +00:00
|
|
|
GST_BASE_SINK_PREROLL_LOCK (basesink);
|
|
|
|
if (G_UNLIKELY (basesink->flushing))
|
|
|
|
goto flushing;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (basesink->priv->received_eos))
|
|
|
|
goto after_eos;
|
|
|
|
|
2011-12-02 21:20:08 +00:00
|
|
|
if (bclass->event)
|
|
|
|
result = bclass->event (basesink, event);
|
2011-12-02 11:42:50 +00:00
|
|
|
|
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (basesink);
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
} else {
|
|
|
|
if (bclass->event)
|
2011-12-02 21:20:08 +00:00
|
|
|
result = bclass->event (basesink, event);
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-10-08 17:05:06 +00:00
|
|
|
done:
|
2005-03-28 14:54:33 +00:00
|
|
|
return result;
|
2007-10-08 17:05:06 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
flushing:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (basesink, "we are flushing");
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (basesink);
|
2007-10-08 17:05:06 +00:00
|
|
|
gst_event_unref (event);
|
2011-12-02 21:20:08 +00:00
|
|
|
result = FALSE;
|
2007-10-08 17:05:06 +00:00
|
|
|
goto done;
|
|
|
|
}
|
2011-06-06 09:20:29 +00:00
|
|
|
|
|
|
|
after_eos:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (basesink, "Event received after EOS, dropping");
|
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (basesink);
|
|
|
|
gst_event_unref (event);
|
2011-12-02 21:20:08 +00:00
|
|
|
result = FALSE;
|
2011-06-06 09:20:29 +00:00
|
|
|
goto done;
|
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|
|
|
|
|
gst/: Made base source class, make fakesrc extend it.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_base_init),
(gst_basesink_pad_getcaps), (gst_basesink_pad_setcaps),
(gst_basesink_pad_buffer_alloc), (gst_basesink_init),
(gst_basesink_do_sync), (gst_basesink_chain_unlocked):
* gst/base/gstbasesrc.c: (gst_basesrc_get_type),
(gst_basesrc_base_init), (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_get_formats),
(gst_basesrc_get_query_types), (gst_basesrc_query),
(gst_basesrc_get_event_mask), (gst_basesrc_event_handler),
(gst_basesrc_set_property), (gst_basesrc_get_property),
(gst_basesrc_get_range_unlocked), (gst_basesrc_get_range),
(gst_basesrc_loop), (gst_basesrc_activate),
(gst_basesrc_change_state):
* gst/base/gstbasesrc.h:
* gst/elements/gstfakesrc.c: (gst_fakesrc_base_init),
(gst_fakesrc_class_init), (gst_fakesrc_init),
(gst_fakesrc_event_handler), (gst_fakesrc_set_property),
(gst_fakesrc_get_property), (gst_fakesrc_create):
* gst/elements/gstfakesrc.h:
* gst/elements/gstfilesrc.c: (gst_filesrc_getrange),
(gst_filesrc_open_file), (gst_filesrc_loop),
(gst_filesrc_activate), (filesrc_find_peek),
(gst_filesrc_type_find):
Made base source class, make fakesrc extend it.
Add comments to basesink class.
Some filesrc cleanup.
2005-04-05 08:44:20 +00:00
|
|
|
/* default implementation to calculate the start and end
|
gst/base/gstbasesink.*: Store and use discont values when syncing buffers as described in design docs.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_event), (gst_base_sink_get_times),
(gst_base_sink_do_sync), (gst_base_sink_change_state):
* gst/base/gstbasesink.h:
Store and use discont values when syncing buffers as described
in design docs.
* gst/base/gstbasesrc.c: (gst_base_src_send_discont),
(gst_base_src_do_seek), (gst_base_src_loop), (gst_base_src_start),
(gst_base_src_activate_push):
Push discont event when starting.
* gst/elements/gstidentity.c: (gst_identity_transform):
Small cleanups.
* gst/gstbin.c: (gst_bin_change_state):
Small cleanups in base_time distribution.
* gst/gstelement.c: (gst_element_set_base_time),
(gst_element_get_base_time), (gst_element_change_state):
* gst/gstelement.h:
Added methods for the base_time of the element.
Some MT fixes.
* gst/gstpipeline.c: (gst_pipeline_send_event),
(gst_pipeline_change_state), (gst_pipeline_set_new_stream_time),
(gst_pipeline_get_last_stream_time):
* gst/gstpipeline.h:
MT fixes.
Handle seeking as described in design doc, remove stream_time
hack.
Cleanups clock and stream_time selection code. Added accessors
for the stream_time.
2005-07-16 14:41:25 +00:00
|
|
|
* timestamps on a buffer, subclasses can override
|
gst/: Made base source class, make fakesrc extend it.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_base_init),
(gst_basesink_pad_getcaps), (gst_basesink_pad_setcaps),
(gst_basesink_pad_buffer_alloc), (gst_basesink_init),
(gst_basesink_do_sync), (gst_basesink_chain_unlocked):
* gst/base/gstbasesrc.c: (gst_basesrc_get_type),
(gst_basesrc_base_init), (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_get_formats),
(gst_basesrc_get_query_types), (gst_basesrc_query),
(gst_basesrc_get_event_mask), (gst_basesrc_event_handler),
(gst_basesrc_set_property), (gst_basesrc_get_property),
(gst_basesrc_get_range_unlocked), (gst_basesrc_get_range),
(gst_basesrc_loop), (gst_basesrc_activate),
(gst_basesrc_change_state):
* gst/base/gstbasesrc.h:
* gst/elements/gstfakesrc.c: (gst_fakesrc_base_init),
(gst_fakesrc_class_init), (gst_fakesrc_init),
(gst_fakesrc_event_handler), (gst_fakesrc_set_property),
(gst_fakesrc_get_property), (gst_fakesrc_create):
* gst/elements/gstfakesrc.h:
* gst/elements/gstfilesrc.c: (gst_filesrc_getrange),
(gst_filesrc_open_file), (gst_filesrc_loop),
(gst_filesrc_activate), (filesrc_find_peek),
(gst_filesrc_type_find):
Made base source class, make fakesrc extend it.
Add comments to basesink class.
Some filesrc cleanup.
2005-04-05 08:44:20 +00:00
|
|
|
*/
|
2005-03-28 14:54:33 +00:00
|
|
|
static void
|
2011-12-02 22:13:23 +00:00
|
|
|
gst_base_sink_default_get_times (GstBaseSink * basesink, GstBuffer * buffer,
|
2005-03-28 14:54:33 +00:00
|
|
|
GstClockTime * start, GstClockTime * end)
|
|
|
|
{
|
|
|
|
GstClockTime timestamp, duration;
|
|
|
|
|
2011-12-03 06:06:11 +00:00
|
|
|
/* first sync on DTS, else use PTS */
|
|
|
|
timestamp = GST_BUFFER_DTS (buffer);
|
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (timestamp))
|
|
|
|
timestamp = GST_BUFFER_PTS (buffer);
|
docs/design/part-seeking.txt: Some small additions.
Original commit message from CVS:
* docs/design/part-seeking.txt:
Some small additions.
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_get_times), (gst_base_sink_do_sync),
(gst_base_sink_activate_push), (gst_base_sink_activate_pull):
* gst/base/gstbasesink.h:
discont values are gint64, handle the math correctly.
* gst/base/gstbasesrc.c: (gst_base_src_loop):
Make the basesrc report error if the source pad is not linked.
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query),
(gst_queue_src_activate_push):
Make queue collect data even if the srcpad is not linked.
Start pushing out data as soon as it is linked.
* gst/gstutils.c: (gst_element_unlink), (gst_flow_get_name):
* gst/gstutils.h:
Added gst_flow_get_name() to ease error reporting.
2005-07-21 17:22:13 +00:00
|
|
|
|
2011-12-03 06:06:11 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
|
gst/base/gstbasesink.*: Store and use discont values when syncing buffers as described in design docs.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_event), (gst_base_sink_get_times),
(gst_base_sink_do_sync), (gst_base_sink_change_state):
* gst/base/gstbasesink.h:
Store and use discont values when syncing buffers as described
in design docs.
* gst/base/gstbasesrc.c: (gst_base_src_send_discont),
(gst_base_src_do_seek), (gst_base_src_loop), (gst_base_src_start),
(gst_base_src_activate_push):
Push discont event when starting.
* gst/elements/gstidentity.c: (gst_identity_transform):
Small cleanups.
* gst/gstbin.c: (gst_bin_change_state):
Small cleanups in base_time distribution.
* gst/gstelement.c: (gst_element_set_base_time),
(gst_element_get_base_time), (gst_element_change_state):
* gst/gstelement.h:
Added methods for the base_time of the element.
Some MT fixes.
* gst/gstpipeline.c: (gst_pipeline_send_event),
(gst_pipeline_change_state), (gst_pipeline_set_new_stream_time),
(gst_pipeline_get_last_stream_time):
* gst/gstpipeline.h:
MT fixes.
Handle seeking as described in design doc, remove stream_time
hack.
Cleanups clock and stream_time selection code. Added accessors
for the stream_time.
2005-07-16 14:41:25 +00:00
|
|
|
/* get duration to calculate end time */
|
2005-03-28 14:54:33 +00:00
|
|
|
duration = GST_BUFFER_DURATION (buffer);
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (duration)) {
|
2005-08-24 17:57:36 +00:00
|
|
|
*end = timestamp + duration;
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|
2005-08-24 17:57:36 +00:00
|
|
|
*start = timestamp;
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-14 15:52:27 +00:00
|
|
|
/* must be called with PREROLL_LOCK */
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
static gboolean
|
2007-06-19 21:58:30 +00:00
|
|
|
gst_base_sink_needs_preroll (GstBaseSink * basesink)
|
2005-09-26 15:43:30 +00:00
|
|
|
{
|
2007-06-19 21:58:30 +00:00
|
|
|
gboolean is_prerolled, res;
|
2005-10-08 09:58:30 +00:00
|
|
|
|
2007-10-08 17:05:06 +00:00
|
|
|
/* we have 2 cases where the PREROLL_LOCK is released:
|
|
|
|
* 1) we are blocking in the PREROLL_LOCK and thus are prerolled.
|
|
|
|
* 2) we are syncing on the clock
|
|
|
|
*/
|
|
|
|
is_prerolled = basesink->have_preroll || basesink->priv->received_eos;
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
res = !is_prerolled;
|
|
|
|
|
2007-06-19 21:58:30 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "have_preroll: %d, EOS: %d => needs preroll: %d",
|
2007-10-08 17:05:06 +00:00
|
|
|
basesink->have_preroll, basesink->priv->received_eos, res);
|
2007-09-05 22:12:42 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
return res;
|
|
|
|
}
|
2005-09-26 15:43:30 +00:00
|
|
|
|
2012-11-09 15:50:50 +00:00
|
|
|
static gboolean
|
|
|
|
count_list_bytes (GstBuffer ** buffer, guint idx, GstBaseSinkPrivate * priv)
|
|
|
|
{
|
|
|
|
priv->rc_accumulated += gst_buffer_get_size (*buffer);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-08-24 15:56:32 +00:00
|
|
|
/* with STREAM_LOCK, PREROLL_LOCK
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
* Takes a buffer and compare the timestamps with the last segment.
|
|
|
|
* If the buffer falls outside of the segment boundaries, drop it.
|
2011-12-02 21:50:55 +00:00
|
|
|
* Else send the buffer for preroll and rendering.
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
*
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
* This function takes ownership of the buffer.
|
gst/: Made base source class, make fakesrc extend it.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_base_init),
(gst_basesink_pad_getcaps), (gst_basesink_pad_setcaps),
(gst_basesink_pad_buffer_alloc), (gst_basesink_init),
(gst_basesink_do_sync), (gst_basesink_chain_unlocked):
* gst/base/gstbasesrc.c: (gst_basesrc_get_type),
(gst_basesrc_base_init), (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_get_formats),
(gst_basesrc_get_query_types), (gst_basesrc_query),
(gst_basesrc_get_event_mask), (gst_basesrc_event_handler),
(gst_basesrc_set_property), (gst_basesrc_get_property),
(gst_basesrc_get_range_unlocked), (gst_basesrc_get_range),
(gst_basesrc_loop), (gst_basesrc_activate),
(gst_basesrc_change_state):
* gst/base/gstbasesrc.h:
* gst/elements/gstfakesrc.c: (gst_fakesrc_base_init),
(gst_fakesrc_class_init), (gst_fakesrc_init),
(gst_fakesrc_event_handler), (gst_fakesrc_set_property),
(gst_fakesrc_get_property), (gst_fakesrc_create):
* gst/elements/gstfakesrc.h:
* gst/elements/gstfilesrc.c: (gst_filesrc_getrange),
(gst_filesrc_open_file), (gst_filesrc_loop),
(gst_filesrc_activate), (filesrc_find_peek),
(gst_filesrc_type_find):
Made base source class, make fakesrc extend it.
Add comments to basesink class.
Some filesrc cleanup.
2005-04-05 08:44:20 +00:00
|
|
|
*/
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_base_sink_chain_unlocked (GstBaseSink * basesink, GstPad * pad,
|
2012-05-16 10:08:44 +00:00
|
|
|
gpointer obj, gboolean is_list)
|
2005-03-28 14:54:33 +00:00
|
|
|
{
|
2008-05-19 11:11:49 +00:00
|
|
|
GstBaseSinkClass *bclass;
|
2011-12-02 21:50:55 +00:00
|
|
|
GstBaseSinkPrivate *priv = basesink->priv;
|
2013-03-30 09:24:27 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2006-10-09 09:32:29 +00:00
|
|
|
GstClockTime start = GST_CLOCK_TIME_NONE, end = GST_CLOCK_TIME_NONE;
|
2011-12-02 12:28:18 +00:00
|
|
|
GstSegment *segment;
|
2011-12-02 21:50:55 +00:00
|
|
|
GstBuffer *sync_buf;
|
2014-05-01 14:37:18 +00:00
|
|
|
gboolean late, step_end, prepared = FALSE;
|
gst/base/gstbasesink.c: Reworked the base sink, handle event and buffer serialisation correctly and removed possible ...
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_basesink_set_property),
(gst_basesink_preroll_queue_empty),
(gst_basesink_preroll_queue_flush), (gst_basesink_handle_object),
(gst_basesink_event), (gst_basesink_do_sync),
(gst_basesink_handle_event), (gst_basesink_handle_buffer),
(gst_basesink_chain), (gst_basesink_loop), (gst_basesink_activate),
(gst_basesink_change_state):
Reworked the base sink, handle event and buffer serialisation
correctly and removed possible deadlock.
Handle EOS correctly.
2005-06-25 17:54:58 +00:00
|
|
|
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
if (G_UNLIKELY (basesink->flushing))
|
|
|
|
goto flushing;
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2011-12-02 21:50:55 +00:00
|
|
|
if (G_UNLIKELY (priv->received_eos))
|
2007-10-08 17:05:06 +00:00
|
|
|
goto was_eos;
|
|
|
|
|
2012-05-16 10:08:44 +00:00
|
|
|
if (is_list) {
|
2015-03-14 21:07:01 +00:00
|
|
|
GstBufferList *buffer_list = GST_BUFFER_LIST_CAST (obj);
|
|
|
|
|
|
|
|
if (gst_buffer_list_length (buffer_list) == 0)
|
|
|
|
goto empty_list;
|
|
|
|
|
|
|
|
sync_buf = gst_buffer_list_get (buffer_list, 0);
|
2011-12-02 21:50:55 +00:00
|
|
|
g_assert (NULL != sync_buf);
|
2009-06-16 11:32:37 +00:00
|
|
|
} else {
|
2011-12-02 21:50:55 +00:00
|
|
|
sync_buf = GST_BUFFER_CAST (obj);
|
2009-06-16 11:32:37 +00:00
|
|
|
}
|
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
/* for code clarity */
|
2011-12-02 12:28:18 +00:00
|
|
|
segment = &basesink->segment;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
if (G_UNLIKELY (!basesink->have_newsegment)) {
|
2006-02-07 13:20:16 +00:00
|
|
|
gboolean sync;
|
|
|
|
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
sync = gst_base_sink_get_sync (basesink);
|
2006-02-07 13:20:16 +00:00
|
|
|
if (sync) {
|
|
|
|
GST_ELEMENT_WARNING (basesink, STREAM, FAILED,
|
|
|
|
(_("Internal data flow problem.")),
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
("Received buffer without a new-segment. Assuming timestamps start from 0."));
|
2006-02-07 13:20:16 +00:00
|
|
|
}
|
|
|
|
|
2006-05-08 09:16:01 +00:00
|
|
|
/* this means this sink will assume timestamps start from 0 */
|
2008-08-19 16:47:07 +00:00
|
|
|
GST_OBJECT_LOCK (basesink);
|
2011-12-02 12:28:18 +00:00
|
|
|
segment->start = 0;
|
|
|
|
segment->stop = -1;
|
2006-05-08 09:16:01 +00:00
|
|
|
basesink->segment.start = 0;
|
2009-10-09 14:44:28 +00:00
|
|
|
basesink->segment.stop = -1;
|
2008-08-19 16:47:07 +00:00
|
|
|
basesink->have_newsegment = TRUE;
|
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
}
|
|
|
|
|
2008-05-19 11:11:49 +00:00
|
|
|
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
|
|
|
|
|
|
|
/* check if the buffer needs to be dropped, we first ask the subclass for the
|
|
|
|
* start and end */
|
|
|
|
if (bclass->get_times)
|
2011-12-02 21:50:55 +00:00
|
|
|
bclass->get_times (basesink, sync_buf, &start, &end);
|
2008-05-19 11:11:49 +00:00
|
|
|
|
2009-10-09 14:11:27 +00:00
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (start)) {
|
2008-05-19 11:11:49 +00:00
|
|
|
/* if the subclass does not want sync, we use our own values so that we at
|
|
|
|
* least clip the buffer to the segment */
|
2011-12-02 22:13:23 +00:00
|
|
|
gst_base_sink_default_get_times (basesink, sync_buf, &start, &end);
|
2008-05-19 11:11:49 +00:00
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-09-01 18:12:18 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "got times start: %" GST_TIME_FORMAT
|
|
|
|
", end: %" GST_TIME_FORMAT, GST_TIME_ARGS (start), GST_TIME_ARGS (end));
|
2005-08-24 17:57:36 +00:00
|
|
|
|
2015-08-05 19:51:27 +00:00
|
|
|
/* a dropped buffer does not participate in anything. Buffer can only be
|
|
|
|
* dropped if their PTS falls completly outside the segment, while we sync
|
|
|
|
* preferably on DTS */
|
2011-12-02 12:28:18 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (start) && (segment->format == GST_FORMAT_TIME)) {
|
2015-08-05 19:51:27 +00:00
|
|
|
GstClockTime pts = GST_BUFFER_PTS (sync_buf);
|
|
|
|
GstClockTime pts_end = GST_CLOCK_TIME_NONE;
|
|
|
|
|
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (pts))
|
|
|
|
pts = start;
|
|
|
|
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (end))
|
|
|
|
pts_end = pts + (end - start);
|
|
|
|
|
2011-12-02 12:28:18 +00:00
|
|
|
if (G_UNLIKELY (!gst_segment_clip (segment,
|
2015-08-05 19:51:27 +00:00
|
|
|
GST_FORMAT_TIME, pts, pts_end, NULL, NULL)))
|
2006-01-18 16:40:16 +00:00
|
|
|
goto out_of_segment;
|
2005-11-29 17:13:44 +00:00
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2013-01-01 09:23:59 +00:00
|
|
|
if (bclass->prepare || bclass->prepare_list) {
|
2013-07-24 09:21:27 +00:00
|
|
|
gboolean do_sync = TRUE, stepped = FALSE, syncable = TRUE;
|
2013-02-05 16:19:50 +00:00
|
|
|
GstClockTime sstart, sstop, rstart, rstop, rnext;
|
2013-01-01 09:23:59 +00:00
|
|
|
GstStepInfo *current;
|
|
|
|
|
2013-07-24 09:21:27 +00:00
|
|
|
late = FALSE;
|
|
|
|
step_end = FALSE;
|
|
|
|
|
2013-01-01 09:23:59 +00:00
|
|
|
current = &priv->current_step;
|
|
|
|
syncable =
|
|
|
|
gst_base_sink_get_sync_times (basesink, obj, &sstart, &sstop, &rstart,
|
2013-02-05 16:19:50 +00:00
|
|
|
&rstop, &rnext, &do_sync, &stepped, current, &step_end);
|
2013-01-01 09:23:59 +00:00
|
|
|
|
2014-05-01 14:37:18 +00:00
|
|
|
if (G_UNLIKELY (stepped))
|
|
|
|
goto dropped;
|
|
|
|
|
2015-07-02 06:32:21 +00:00
|
|
|
if (syncable && do_sync && gst_base_sink_get_sync (basesink)) {
|
basesink: Fix QoS/lateness checking if subclass implements prepare/prepare_list vfuncs
In basesink functions gst_base_sink_chain_unlocked(), below code is used to
checking if buffer is late before doing prepare call to save some effort:
if (syncable && do_sync)
late =
gst_base_sink_is_too_late (basesink, obj, rstart, rstop,
GST_CLOCK_EARLY, 0, FALSE);
if (G_UNLIKELY (late))
goto dropped;
But this code has problem, it should calculate jitter based on current media
clock, rather than just passing 0. I found it will drop all the frames when
rewind in slow speed, such as -2X.
https://bugzilla.gnome.org/show_bug.cgi?id=749258
2015-05-14 07:49:43 +00:00
|
|
|
GstClock *clock;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (basesink);
|
|
|
|
clock = GST_ELEMENT_CLOCK (basesink);
|
|
|
|
if (clock && GST_STATE (basesink) == GST_STATE_PLAYING) {
|
|
|
|
GstClockTime base_time;
|
|
|
|
GstClockTime stime;
|
|
|
|
GstClockTime now;
|
|
|
|
|
|
|
|
base_time = GST_ELEMENT_CAST (basesink)->base_time;
|
|
|
|
stime = base_time + gst_base_sink_adjust_time (basesink, rstart);
|
|
|
|
now = gst_clock_get_time (clock);
|
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
|
|
|
|
|
|
|
late =
|
|
|
|
gst_base_sink_is_too_late (basesink, obj, rstart, rstop,
|
|
|
|
GST_CLOCK_EARLY, GST_CLOCK_DIFF (stime, now), FALSE);
|
|
|
|
} else {
|
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
|
|
|
}
|
|
|
|
}
|
2014-05-01 14:37:18 +00:00
|
|
|
|
|
|
|
if (G_UNLIKELY (late))
|
2013-01-01 09:23:59 +00:00
|
|
|
goto dropped;
|
|
|
|
|
|
|
|
if (!is_list) {
|
|
|
|
if (bclass->prepare) {
|
|
|
|
ret = bclass->prepare (basesink, GST_BUFFER_CAST (obj));
|
|
|
|
if (G_UNLIKELY (ret != GST_FLOW_OK))
|
|
|
|
goto prepare_failed;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (bclass->prepare_list) {
|
|
|
|
ret = bclass->prepare_list (basesink, GST_BUFFER_LIST_CAST (obj));
|
|
|
|
if (G_UNLIKELY (ret != GST_FLOW_OK))
|
|
|
|
goto prepare_failed;
|
|
|
|
}
|
2012-05-16 10:08:44 +00:00
|
|
|
}
|
2014-05-01 14:37:18 +00:00
|
|
|
|
|
|
|
prepared = TRUE;
|
2012-05-16 10:08:44 +00:00
|
|
|
}
|
|
|
|
|
2011-12-02 21:50:55 +00:00
|
|
|
again:
|
|
|
|
late = FALSE;
|
|
|
|
step_end = FALSE;
|
2011-12-02 21:36:38 +00:00
|
|
|
|
2011-12-02 21:50:55 +00:00
|
|
|
/* synchronize this object, non syncable objects return OK
|
|
|
|
* immediately. */
|
|
|
|
ret = gst_base_sink_do_sync (basesink, GST_MINI_OBJECT_CAST (sync_buf),
|
2011-12-03 05:29:42 +00:00
|
|
|
&late, &step_end);
|
2011-12-02 21:50:55 +00:00
|
|
|
if (G_UNLIKELY (ret != GST_FLOW_OK))
|
|
|
|
goto sync_failed;
|
|
|
|
|
2014-05-01 14:37:18 +00:00
|
|
|
/* Don't skip if prepare() was called on time */
|
|
|
|
late = late && !prepared;
|
|
|
|
|
2011-12-02 21:50:55 +00:00
|
|
|
/* drop late buffers unconditionally, let's hope it's unlikely */
|
|
|
|
if (G_UNLIKELY (late))
|
|
|
|
goto dropped;
|
|
|
|
|
2012-11-09 15:50:50 +00:00
|
|
|
if (priv->max_bitrate) {
|
|
|
|
if (is_list) {
|
|
|
|
gst_buffer_list_foreach (GST_BUFFER_LIST_CAST (obj),
|
|
|
|
(GstBufferListFunc) count_list_bytes, priv);
|
|
|
|
} else {
|
|
|
|
priv->rc_accumulated += gst_buffer_get_size (GST_BUFFER_CAST (obj));
|
|
|
|
}
|
|
|
|
priv->rc_next = priv->rc_time + gst_util_uint64_scale (priv->rc_accumulated,
|
|
|
|
8 * GST_SECOND, priv->max_bitrate);
|
|
|
|
}
|
|
|
|
|
2011-12-02 21:50:55 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "rendering object %p", obj);
|
|
|
|
|
2012-05-16 10:08:44 +00:00
|
|
|
if (!is_list) {
|
2011-12-03 05:29:42 +00:00
|
|
|
/* For buffer lists do not set last buffer for now. */
|
2011-12-02 21:50:55 +00:00
|
|
|
gst_base_sink_set_last_buffer (basesink, GST_BUFFER_CAST (obj));
|
2015-06-22 12:04:45 +00:00
|
|
|
gst_base_sink_set_last_buffer_list (basesink, NULL);
|
2011-12-02 21:50:55 +00:00
|
|
|
|
|
|
|
if (bclass->render)
|
|
|
|
ret = bclass->render (basesink, GST_BUFFER_CAST (obj));
|
|
|
|
} else {
|
2015-06-22 11:02:55 +00:00
|
|
|
GstBufferList *buffer_list = GST_BUFFER_LIST_CAST (obj);
|
|
|
|
|
2011-12-02 21:50:55 +00:00
|
|
|
if (bclass->render_list)
|
2015-06-22 11:02:55 +00:00
|
|
|
ret = bclass->render_list (basesink, buffer_list);
|
|
|
|
|
|
|
|
/* Set the first buffer and buffer list to be included in last sample */
|
|
|
|
gst_base_sink_set_last_buffer (basesink, sync_buf);
|
|
|
|
gst_base_sink_set_last_buffer_list (basesink, buffer_list);
|
2011-12-02 21:50:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ret == GST_FLOW_STEP)
|
|
|
|
goto again;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (basesink->flushing))
|
|
|
|
goto flushing;
|
|
|
|
|
|
|
|
priv->rendered++;
|
|
|
|
|
|
|
|
done:
|
|
|
|
if (step_end) {
|
|
|
|
/* the step ended, check if we need to activate a new step */
|
|
|
|
GST_DEBUG_OBJECT (basesink, "step ended");
|
|
|
|
stop_stepping (basesink, &basesink->segment, &priv->current_step,
|
|
|
|
priv->current_rstart, priv->current_rstop, basesink->eos);
|
|
|
|
goto again;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_base_sink_perform_qos (basesink, late);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (basesink, "object unref after render %p", obj);
|
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (obj));
|
|
|
|
|
|
|
|
return ret;
|
2005-08-24 17:57:36 +00:00
|
|
|
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
/* ERRORS */
|
|
|
|
flushing:
|
2006-01-18 16:40:16 +00:00
|
|
|
{
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "sink is flushing");
|
2009-06-16 11:32:37 +00:00
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (obj));
|
2012-02-08 14:16:46 +00:00
|
|
|
return GST_FLOW_FLUSHING;
|
2006-01-18 16:40:16 +00:00
|
|
|
}
|
2007-10-08 17:05:06 +00:00
|
|
|
was_eos:
|
|
|
|
{
|
2011-10-10 09:33:51 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "we are EOS, dropping object, return EOS");
|
2009-06-16 11:32:37 +00:00
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (obj));
|
2011-10-10 09:33:51 +00:00
|
|
|
return GST_FLOW_EOS;
|
2007-10-08 17:05:06 +00:00
|
|
|
}
|
2015-03-14 21:07:01 +00:00
|
|
|
empty_list:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (basesink, "buffer list with no buffers");
|
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (obj));
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
2005-09-01 18:12:18 +00:00
|
|
|
out_of_segment:
|
2005-08-24 17:57:36 +00:00
|
|
|
{
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "dropping buffer, out of clipping segment");
|
2009-06-16 11:32:37 +00:00
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (obj));
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
return GST_FLOW_OK;
|
gst/base/gstbasesink.c: Reworked the base sink, handle event and buffer serialisation correctly and removed possible ...
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_basesink_set_property),
(gst_basesink_preroll_queue_empty),
(gst_basesink_preroll_queue_flush), (gst_basesink_handle_object),
(gst_basesink_event), (gst_basesink_do_sync),
(gst_basesink_handle_event), (gst_basesink_handle_buffer),
(gst_basesink_chain), (gst_basesink_loop), (gst_basesink_activate),
(gst_basesink_change_state):
Reworked the base sink, handle event and buffer serialisation
correctly and removed possible deadlock.
Handle EOS correctly.
2005-06-25 17:54:58 +00:00
|
|
|
}
|
2012-05-16 10:08:44 +00:00
|
|
|
prepare_failed:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (basesink, "prepare buffer failed %s",
|
|
|
|
gst_flow_get_name (ret));
|
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (obj));
|
|
|
|
return ret;
|
|
|
|
}
|
2011-12-02 21:50:55 +00:00
|
|
|
sync_failed:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (basesink, "do_sync returned %s", gst_flow_get_name (ret));
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
dropped:
|
|
|
|
{
|
|
|
|
priv->dropped++;
|
|
|
|
GST_DEBUG_OBJECT (basesink, "buffer late, dropping");
|
|
|
|
|
|
|
|
if (g_atomic_int_get (&priv->qos_enabled)) {
|
|
|
|
GstMessage *qos_msg;
|
|
|
|
GstClockTime timestamp, duration;
|
|
|
|
|
|
|
|
timestamp = GST_BUFFER_TIMESTAMP (GST_BUFFER_CAST (sync_buf));
|
|
|
|
duration = GST_BUFFER_DURATION (GST_BUFFER_CAST (sync_buf));
|
|
|
|
|
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, basesink,
|
|
|
|
"qos: dropped buffer rt %" GST_TIME_FORMAT ", st %" GST_TIME_FORMAT
|
|
|
|
", ts %" GST_TIME_FORMAT ", dur %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (priv->current_rstart),
|
|
|
|
GST_TIME_ARGS (priv->current_sstart), GST_TIME_ARGS (timestamp),
|
|
|
|
GST_TIME_ARGS (duration));
|
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, basesink,
|
|
|
|
"qos: rendered %" G_GUINT64_FORMAT ", dropped %" G_GUINT64_FORMAT,
|
|
|
|
priv->rendered, priv->dropped);
|
|
|
|
|
|
|
|
qos_msg =
|
|
|
|
gst_message_new_qos (GST_OBJECT_CAST (basesink), basesink->sync,
|
|
|
|
priv->current_rstart, priv->current_sstart, timestamp, duration);
|
|
|
|
gst_message_set_qos_values (qos_msg, priv->current_jitter, priv->avg_rate,
|
|
|
|
1000000);
|
|
|
|
gst_message_set_qos_stats (qos_msg, GST_FORMAT_BUFFERS, priv->rendered,
|
|
|
|
priv->dropped);
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink), qos_msg);
|
|
|
|
}
|
|
|
|
goto done;
|
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|
|
|
|
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
/* with STREAM_LOCK
|
gst/: Made base source class, make fakesrc extend it.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_base_init),
(gst_basesink_pad_getcaps), (gst_basesink_pad_setcaps),
(gst_basesink_pad_buffer_alloc), (gst_basesink_init),
(gst_basesink_do_sync), (gst_basesink_chain_unlocked):
* gst/base/gstbasesrc.c: (gst_basesrc_get_type),
(gst_basesrc_base_init), (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_get_formats),
(gst_basesrc_get_query_types), (gst_basesrc_query),
(gst_basesrc_get_event_mask), (gst_basesrc_event_handler),
(gst_basesrc_set_property), (gst_basesrc_get_property),
(gst_basesrc_get_range_unlocked), (gst_basesrc_get_range),
(gst_basesrc_loop), (gst_basesrc_activate),
(gst_basesrc_change_state):
* gst/base/gstbasesrc.h:
* gst/elements/gstfakesrc.c: (gst_fakesrc_base_init),
(gst_fakesrc_class_init), (gst_fakesrc_init),
(gst_fakesrc_event_handler), (gst_fakesrc_set_property),
(gst_fakesrc_get_property), (gst_fakesrc_create):
* gst/elements/gstfakesrc.h:
* gst/elements/gstfilesrc.c: (gst_filesrc_getrange),
(gst_filesrc_open_file), (gst_filesrc_loop),
(gst_filesrc_activate), (filesrc_find_peek),
(gst_filesrc_type_find):
Made base source class, make fakesrc extend it.
Add comments to basesink class.
Some filesrc cleanup.
2005-04-05 08:44:20 +00:00
|
|
|
*/
|
2005-03-28 14:54:33 +00:00
|
|
|
static GstFlowReturn
|
2012-05-16 10:08:44 +00:00
|
|
|
gst_base_sink_chain_main (GstBaseSink * basesink, GstPad * pad, gpointer obj,
|
|
|
|
gboolean is_list)
|
2005-03-28 14:54:33 +00:00
|
|
|
{
|
gst/base/gstbasesink.c: Reworked the base sink, handle event and buffer serialisation correctly and removed possible ...
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_basesink_set_property),
(gst_basesink_preroll_queue_empty),
(gst_basesink_preroll_queue_flush), (gst_basesink_handle_object),
(gst_basesink_event), (gst_basesink_do_sync),
(gst_basesink_handle_event), (gst_basesink_handle_buffer),
(gst_basesink_chain), (gst_basesink_loop), (gst_basesink_activate),
(gst_basesink_change_state):
Reworked the base sink, handle event and buffer serialisation
correctly and removed possible deadlock.
Handle EOS correctly.
2005-06-25 17:54:58 +00:00
|
|
|
GstFlowReturn result;
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2011-11-18 11:35:46 +00:00
|
|
|
if (G_UNLIKELY (basesink->pad_mode != GST_PAD_MODE_PUSH))
|
2006-01-18 16:40:16 +00:00
|
|
|
goto wrong_mode;
|
2005-08-26 14:21:43 +00:00
|
|
|
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_LOCK (basesink);
|
2012-05-16 10:08:44 +00:00
|
|
|
result = gst_base_sink_chain_unlocked (basesink, pad, obj, is_list);
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (basesink);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-08-26 14:21:43 +00:00
|
|
|
done:
|
2005-03-28 14:54:33 +00:00
|
|
|
return result;
|
2006-01-18 16:40:16 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
wrong_mode:
|
|
|
|
{
|
|
|
|
GST_OBJECT_LOCK (pad);
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
GST_WARNING_OBJECT (basesink,
|
|
|
|
"Push on pad %s:%s, but it was not activated in push mode",
|
2006-01-18 16:40:16 +00:00
|
|
|
GST_DEBUG_PAD_NAME (pad));
|
|
|
|
GST_OBJECT_UNLOCK (pad);
|
2009-06-16 11:32:37 +00:00
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (obj));
|
2006-01-18 18:01:54 +00:00
|
|
|
/* we don't post an error message this will signal to the peer
|
|
|
|
* pushing that EOS is reached. */
|
2011-10-10 09:33:51 +00:00
|
|
|
result = GST_FLOW_EOS;
|
2006-01-18 16:40:16 +00:00
|
|
|
goto done;
|
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|
|
|
|
|
2009-06-16 11:32:37 +00:00
|
|
|
static GstFlowReturn
|
2011-11-17 11:40:45 +00:00
|
|
|
gst_base_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
2009-06-16 11:32:37 +00:00
|
|
|
{
|
|
|
|
GstBaseSink *basesink;
|
|
|
|
|
2011-11-17 11:40:45 +00:00
|
|
|
basesink = GST_BASE_SINK (parent);
|
2009-06-16 11:32:37 +00:00
|
|
|
|
2012-05-16 10:08:44 +00:00
|
|
|
return gst_base_sink_chain_main (basesink, pad, buf, FALSE);
|
2009-06-16 11:32:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2011-11-17 11:40:45 +00:00
|
|
|
gst_base_sink_chain_list (GstPad * pad, GstObject * parent,
|
|
|
|
GstBufferList * list)
|
2009-06-16 11:32:37 +00:00
|
|
|
{
|
|
|
|
GstBaseSink *basesink;
|
|
|
|
GstBaseSinkClass *bclass;
|
|
|
|
GstFlowReturn result;
|
|
|
|
|
2011-11-17 11:40:45 +00:00
|
|
|
basesink = GST_BASE_SINK (parent);
|
2009-06-16 11:32:37 +00:00
|
|
|
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
|
|
|
|
|
|
|
if (G_LIKELY (bclass->render_list)) {
|
2012-05-16 10:08:44 +00:00
|
|
|
result = gst_base_sink_chain_main (basesink, pad, list, TRUE);
|
2009-06-16 11:32:37 +00:00
|
|
|
} else {
|
2011-03-31 15:51:02 +00:00
|
|
|
guint i, len;
|
|
|
|
GstBuffer *buffer;
|
2009-06-16 11:32:37 +00:00
|
|
|
|
2013-08-29 10:07:38 +00:00
|
|
|
GST_LOG_OBJECT (pad, "chaining each buffer in list");
|
2009-06-16 11:32:37 +00:00
|
|
|
|
2011-10-29 06:24:12 +00:00
|
|
|
len = gst_buffer_list_length (list);
|
2009-06-16 11:32:37 +00:00
|
|
|
|
2011-03-31 15:51:02 +00:00
|
|
|
result = GST_FLOW_OK;
|
|
|
|
for (i = 0; i < len; i++) {
|
2012-01-19 14:17:33 +00:00
|
|
|
buffer = gst_buffer_list_get (list, i);
|
2011-12-03 05:29:42 +00:00
|
|
|
result = gst_base_sink_chain_main (basesink, pad,
|
2012-05-16 10:08:44 +00:00
|
|
|
gst_buffer_ref (buffer), FALSE);
|
2011-03-31 15:51:02 +00:00
|
|
|
if (result != GST_FLOW_OK)
|
|
|
|
break;
|
2009-06-16 11:32:37 +00:00
|
|
|
}
|
|
|
|
gst_buffer_list_unref (list);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-20 15:18:14 +00:00
|
|
|
static gboolean
|
|
|
|
gst_base_sink_default_do_seek (GstBaseSink * sink, GstSegment * segment)
|
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
|
|
|
|
|
|
|
/* update our offset if the start/stop position was updated */
|
|
|
|
if (segment->format == GST_FORMAT_BYTES) {
|
|
|
|
segment->time = segment->start;
|
|
|
|
} else if (segment->start == 0) {
|
|
|
|
/* seek to start, we can implement a default for this. */
|
|
|
|
segment->time = 0;
|
|
|
|
} else {
|
|
|
|
res = FALSE;
|
|
|
|
GST_INFO_OBJECT (sink, "Can't do a default seek");
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define SEEK_TYPE_IS_RELATIVE(t) (((t) != GST_SEEK_TYPE_NONE) && ((t) != GST_SEEK_TYPE_SET))
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_base_sink_default_prepare_seek_segment (GstBaseSink * sink,
|
|
|
|
GstEvent * event, GstSegment * segment)
|
|
|
|
{
|
|
|
|
/* By default, we try one of 2 things:
|
2009-08-24 15:56:32 +00:00
|
|
|
* - For absolute seek positions, convert the requested position to our
|
2008-10-20 15:18:14 +00:00
|
|
|
* configured processing format and place it in the output segment \
|
|
|
|
* - For relative seek positions, convert our current (input) values to the
|
|
|
|
* seek format, adjust by the relative seek offset and then convert back to
|
|
|
|
* the processing format
|
|
|
|
*/
|
2012-07-27 13:19:57 +00:00
|
|
|
GstSeekType start_type, stop_type;
|
|
|
|
gint64 start, stop;
|
2008-10-20 15:18:14 +00:00
|
|
|
GstSeekFlags flags;
|
2011-07-26 23:26:43 +00:00
|
|
|
GstFormat seek_format;
|
2008-10-20 15:18:14 +00:00
|
|
|
gdouble rate;
|
|
|
|
gboolean update;
|
|
|
|
gboolean res = TRUE;
|
|
|
|
|
|
|
|
gst_event_parse_seek (event, &rate, &seek_format, &flags,
|
2012-07-27 13:19:57 +00:00
|
|
|
&start_type, &start, &stop_type, &stop);
|
2008-10-20 15:18:14 +00:00
|
|
|
|
2011-07-26 23:26:43 +00:00
|
|
|
if (seek_format == segment->format) {
|
2011-05-13 16:07:24 +00:00
|
|
|
gst_segment_do_seek (segment, rate, seek_format, flags,
|
2012-07-27 13:19:57 +00:00
|
|
|
start_type, start, stop_type, stop, &update);
|
2008-10-20 15:18:14 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2012-07-27 13:19:57 +00:00
|
|
|
if (start_type != GST_SEEK_TYPE_NONE) {
|
|
|
|
/* FIXME: Handle seek_end by converting the input segment vals */
|
2008-10-20 15:18:14 +00:00
|
|
|
res =
|
2012-07-27 13:19:57 +00:00
|
|
|
gst_pad_query_convert (sink->sinkpad, seek_format, start,
|
|
|
|
segment->format, &start);
|
|
|
|
start_type = GST_SEEK_TYPE_SET;
|
2008-10-20 15:18:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (res && stop_type != GST_SEEK_TYPE_NONE) {
|
2012-07-27 13:19:57 +00:00
|
|
|
/* FIXME: Handle seek_end by converting the input segment vals */
|
2008-10-20 15:18:14 +00:00
|
|
|
res =
|
2011-07-26 23:26:43 +00:00
|
|
|
gst_pad_query_convert (sink->sinkpad, seek_format, stop,
|
|
|
|
segment->format, &stop);
|
2008-10-20 15:18:14 +00:00
|
|
|
stop_type = GST_SEEK_TYPE_SET;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* And finally, configure our output segment in the desired format */
|
2012-07-27 13:19:57 +00:00
|
|
|
gst_segment_do_seek (segment, rate, segment->format, flags, start_type, start,
|
2008-10-20 15:18:14 +00:00
|
|
|
stop_type, stop, &update);
|
|
|
|
|
|
|
|
if (!res)
|
|
|
|
goto no_format;
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
|
|
|
no_format:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (sink, "undefined format given, seek aborted.");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-16 14:09:18 +00:00
|
|
|
/* perform a seek, only executed in pull mode */
|
|
|
|
static gboolean
|
2008-10-20 15:18:14 +00:00
|
|
|
gst_base_sink_perform_seek (GstBaseSink * sink, GstPad * pad, GstEvent * event)
|
2008-10-16 14:09:18 +00:00
|
|
|
{
|
|
|
|
gboolean flush;
|
|
|
|
gdouble rate;
|
2008-10-20 15:18:14 +00:00
|
|
|
GstFormat seek_format, dest_format;
|
2008-10-16 14:09:18 +00:00
|
|
|
GstSeekFlags flags;
|
2012-07-27 13:19:57 +00:00
|
|
|
GstSeekType start_type, stop_type;
|
2008-10-20 15:18:14 +00:00
|
|
|
gboolean seekseg_configured = FALSE;
|
2012-07-27 13:19:57 +00:00
|
|
|
gint64 start, stop;
|
2008-10-20 15:18:14 +00:00
|
|
|
gboolean update, res = TRUE;
|
|
|
|
GstSegment seeksegment;
|
|
|
|
|
|
|
|
dest_format = sink->segment.format;
|
2008-10-16 14:09:18 +00:00
|
|
|
|
|
|
|
if (event) {
|
2008-10-20 15:18:14 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "performing seek with event %p", event);
|
2008-10-16 14:09:18 +00:00
|
|
|
gst_event_parse_seek (event, &rate, &seek_format, &flags,
|
2012-07-27 13:19:57 +00:00
|
|
|
&start_type, &start, &stop_type, &stop);
|
2008-10-16 14:09:18 +00:00
|
|
|
|
|
|
|
flush = flags & GST_SEEK_FLAG_FLUSH;
|
|
|
|
} else {
|
2008-10-20 15:18:14 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "performing seek without event");
|
2008-10-16 14:09:18 +00:00
|
|
|
flush = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flush) {
|
2008-10-20 15:18:14 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "flushing upstream");
|
2008-10-16 14:09:18 +00:00
|
|
|
gst_pad_push_event (pad, gst_event_new_flush_start ());
|
2008-10-20 15:18:14 +00:00
|
|
|
gst_base_sink_flush_start (sink, pad);
|
2008-10-16 14:09:18 +00:00
|
|
|
} else {
|
2008-10-20 15:18:14 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "pausing pulling thread");
|
2008-10-16 14:09:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_PAD_STREAM_LOCK (pad);
|
|
|
|
|
2008-10-20 15:18:14 +00:00
|
|
|
/* If we configured the seeksegment above, don't overwrite it now. Otherwise
|
|
|
|
* copy the current segment info into the temp segment that we can actually
|
2011-09-07 11:14:38 +00:00
|
|
|
* attempt the seek with. We only update the real segment if the seek succeeds. */
|
2008-10-20 15:18:14 +00:00
|
|
|
if (!seekseg_configured) {
|
|
|
|
memcpy (&seeksegment, &sink->segment, sizeof (GstSegment));
|
|
|
|
|
|
|
|
/* now configure the final seek segment */
|
|
|
|
if (event) {
|
|
|
|
if (sink->segment.format != seek_format) {
|
|
|
|
/* OK, here's where we give the subclass a chance to convert the relative
|
|
|
|
* seek into an absolute one in the processing format. We set up any
|
|
|
|
* absolute seek above, before taking the stream lock. */
|
|
|
|
if (!gst_base_sink_default_prepare_seek_segment (sink, event,
|
|
|
|
&seeksegment)) {
|
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"Preparing the seek failed after flushing. " "Aborting seek");
|
|
|
|
res = FALSE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* The seek format matches our processing format, no need to ask the
|
|
|
|
* the subclass to configure the segment. */
|
2011-05-13 16:07:24 +00:00
|
|
|
gst_segment_do_seek (&seeksegment, rate, seek_format, flags,
|
2012-07-27 13:19:57 +00:00
|
|
|
start_type, start, stop_type, stop, &update);
|
2008-10-20 15:18:14 +00:00
|
|
|
}
|
|
|
|
}
|
2009-08-24 15:56:32 +00:00
|
|
|
/* Else, no seek event passed, so we're just (re)starting the
|
2008-10-20 15:18:14 +00:00
|
|
|
current segment. */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
GST_DEBUG_OBJECT (sink, "segment configured from %" G_GINT64_FORMAT
|
|
|
|
" to %" G_GINT64_FORMAT ", position %" G_GINT64_FORMAT,
|
2011-05-13 16:07:24 +00:00
|
|
|
seeksegment.start, seeksegment.stop, seeksegment.position);
|
2008-10-20 15:18:14 +00:00
|
|
|
|
2011-05-13 16:07:24 +00:00
|
|
|
/* do the seek, segment.position contains the new position. */
|
2008-10-20 15:18:14 +00:00
|
|
|
res = gst_base_sink_default_do_seek (sink, &seeksegment);
|
|
|
|
}
|
|
|
|
|
2008-10-16 14:09:18 +00:00
|
|
|
if (flush) {
|
2008-10-20 15:18:14 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "stop flushing upstream");
|
2011-06-10 09:55:08 +00:00
|
|
|
gst_pad_push_event (pad, gst_event_new_flush_stop (TRUE));
|
|
|
|
gst_base_sink_flush_stop (sink, pad, TRUE);
|
2011-02-22 18:09:48 +00:00
|
|
|
} else if (res && sink->running) {
|
2009-08-24 15:56:32 +00:00
|
|
|
/* we are running the current segment and doing a non-flushing seek,
|
2011-05-13 16:07:24 +00:00
|
|
|
* close the segment first based on the position. */
|
2008-10-20 15:18:14 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "closing running segment %" G_GINT64_FORMAT
|
2011-05-13 16:07:24 +00:00
|
|
|
" to %" G_GINT64_FORMAT, sink->segment.start, sink->segment.position);
|
2008-10-20 15:18:14 +00:00
|
|
|
}
|
|
|
|
|
2009-08-24 15:56:32 +00:00
|
|
|
/* The subclass must have converted the segment to the processing format
|
2008-10-20 15:18:14 +00:00
|
|
|
* by now */
|
|
|
|
if (res && seeksegment.format != dest_format) {
|
|
|
|
GST_DEBUG_OBJECT (sink, "Subclass failed to prepare a seek segment "
|
|
|
|
"in the correct format. Aborting seek.");
|
|
|
|
res = FALSE;
|
2008-10-16 14:09:18 +00:00
|
|
|
}
|
|
|
|
|
2013-02-27 21:15:48 +00:00
|
|
|
GST_INFO_OBJECT (sink, "seeking done %d: %" GST_SEGMENT_FORMAT, res,
|
|
|
|
&seeksegment);
|
|
|
|
|
2011-09-07 11:14:38 +00:00
|
|
|
/* if successful seek, we update our real segment and push
|
2008-10-20 15:18:14 +00:00
|
|
|
* out the new segment. */
|
|
|
|
if (res) {
|
2011-05-13 16:07:24 +00:00
|
|
|
gst_segment_copy_into (&seeksegment, &sink->segment);
|
2008-10-20 15:18:14 +00:00
|
|
|
|
2012-07-09 20:51:07 +00:00
|
|
|
if (sink->segment.flags & GST_SEGMENT_FLAG_SEGMENT) {
|
2008-10-20 15:18:14 +00:00
|
|
|
gst_element_post_message (GST_ELEMENT (sink),
|
|
|
|
gst_message_new_segment_start (GST_OBJECT (sink),
|
2011-05-13 16:07:24 +00:00
|
|
|
sink->segment.format, sink->segment.position));
|
2008-10-20 15:18:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sink->priv->discont = TRUE;
|
2011-02-22 18:09:48 +00:00
|
|
|
sink->running = TRUE;
|
2008-10-20 15:18:14 +00:00
|
|
|
|
2008-10-16 14:09:18 +00:00
|
|
|
GST_PAD_STREAM_UNLOCK (pad);
|
|
|
|
|
2008-10-20 15:18:14 +00:00
|
|
|
return res;
|
2008-10-16 14:09:18 +00:00
|
|
|
}
|
|
|
|
|
2009-06-08 14:27:36 +00:00
|
|
|
static void
|
2009-06-08 15:39:47 +00:00
|
|
|
set_step_info (GstBaseSink * sink, GstStepInfo * current, GstStepInfo * pending,
|
|
|
|
guint seqnum, GstFormat format, guint64 amount, gdouble rate,
|
|
|
|
gboolean flush, gboolean intermediate)
|
2009-06-08 14:27:36 +00:00
|
|
|
{
|
|
|
|
GST_OBJECT_LOCK (sink);
|
2009-06-08 15:39:47 +00:00
|
|
|
pending->seqnum = seqnum;
|
|
|
|
pending->format = format;
|
|
|
|
pending->amount = amount;
|
|
|
|
pending->position = 0;
|
|
|
|
pending->rate = rate;
|
|
|
|
pending->flush = flush;
|
|
|
|
pending->intermediate = intermediate;
|
|
|
|
pending->valid = TRUE;
|
|
|
|
/* flush invalidates the current stepping segment */
|
|
|
|
if (flush)
|
|
|
|
current->valid = FALSE;
|
2009-06-08 14:27:36 +00:00
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
}
|
|
|
|
|
2009-05-11 16:56:56 +00:00
|
|
|
static gboolean
|
|
|
|
gst_base_sink_perform_step (GstBaseSink * sink, GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstBaseSinkPrivate *priv;
|
|
|
|
GstBaseSinkClass *bclass;
|
|
|
|
gboolean flush, intermediate;
|
|
|
|
gdouble rate;
|
|
|
|
GstFormat format;
|
|
|
|
guint64 amount;
|
|
|
|
guint seqnum;
|
2009-06-08 15:39:47 +00:00
|
|
|
GstStepInfo *pending, *current;
|
2009-06-10 13:51:40 +00:00
|
|
|
GstMessage *message;
|
2009-05-11 16:56:56 +00:00
|
|
|
|
|
|
|
bclass = GST_BASE_SINK_GET_CLASS (sink);
|
|
|
|
priv = sink->priv;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sink, "performing step with event %p", event);
|
|
|
|
|
|
|
|
gst_event_parse_step (event, &format, &amount, &rate, &flush, &intermediate);
|
|
|
|
seqnum = gst_event_get_seqnum (event);
|
|
|
|
|
2009-05-18 16:41:45 +00:00
|
|
|
pending = &priv->pending_step;
|
2009-06-08 15:39:47 +00:00
|
|
|
current = &priv->current_step;
|
2009-05-18 16:41:45 +00:00
|
|
|
|
2009-06-10 13:51:40 +00:00
|
|
|
/* post message first */
|
2009-06-12 11:18:21 +00:00
|
|
|
message = gst_message_new_step_start (GST_OBJECT (sink), FALSE, format,
|
|
|
|
amount, rate, flush, intermediate);
|
|
|
|
gst_message_set_seqnum (message, seqnum);
|
2009-06-10 13:51:40 +00:00
|
|
|
gst_element_post_message (GST_ELEMENT (sink), message);
|
|
|
|
|
2009-05-11 16:56:56 +00:00
|
|
|
if (flush) {
|
|
|
|
/* we need to call ::unlock before locking PREROLL_LOCK
|
|
|
|
* since we lock it before going into ::render */
|
|
|
|
if (bclass->unlock)
|
|
|
|
bclass->unlock (sink);
|
|
|
|
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_LOCK (sink);
|
2009-05-19 17:45:06 +00:00
|
|
|
/* now that we have the PREROLL lock, clear our unlock request */
|
|
|
|
if (bclass->unlock_stop)
|
|
|
|
bclass->unlock_stop (sink);
|
|
|
|
|
|
|
|
/* update the stepinfo and make it valid */
|
2009-06-08 15:39:47 +00:00
|
|
|
set_step_info (sink, current, pending, seqnum, format, amount, rate, flush,
|
2009-06-08 14:27:36 +00:00
|
|
|
intermediate);
|
2009-05-11 16:56:56 +00:00
|
|
|
|
|
|
|
if (sink->priv->async_enabled) {
|
|
|
|
/* and we need to commit our state again on the next
|
|
|
|
* prerolled buffer */
|
|
|
|
sink->playing_async = TRUE;
|
2009-05-14 17:29:08 +00:00
|
|
|
priv->pending_step.need_preroll = TRUE;
|
2009-05-11 16:56:56 +00:00
|
|
|
sink->need_preroll = FALSE;
|
2014-03-18 17:11:15 +00:00
|
|
|
gst_base_sink_update_start_time (sink);
|
2011-06-08 11:40:32 +00:00
|
|
|
gst_element_lost_state (GST_ELEMENT_CAST (sink));
|
2009-05-11 16:56:56 +00:00
|
|
|
} else {
|
|
|
|
sink->priv->have_latency = TRUE;
|
|
|
|
sink->need_preroll = FALSE;
|
|
|
|
}
|
2009-10-09 14:11:27 +00:00
|
|
|
priv->current_sstart = GST_CLOCK_TIME_NONE;
|
|
|
|
priv->current_sstop = GST_CLOCK_TIME_NONE;
|
|
|
|
priv->eos_rtime = GST_CLOCK_TIME_NONE;
|
2009-05-11 16:56:56 +00:00
|
|
|
priv->call_preroll = TRUE;
|
|
|
|
gst_base_sink_set_last_buffer (sink, NULL);
|
2015-06-22 11:02:55 +00:00
|
|
|
gst_base_sink_set_last_buffer_list (sink, NULL);
|
2009-05-11 16:56:56 +00:00
|
|
|
gst_base_sink_reset_qos (sink);
|
|
|
|
|
|
|
|
if (sink->clock_id) {
|
|
|
|
gst_clock_id_unschedule (sink->clock_id);
|
|
|
|
}
|
|
|
|
|
2009-05-19 17:45:06 +00:00
|
|
|
if (sink->have_preroll) {
|
|
|
|
GST_DEBUG_OBJECT (sink, "signal waiter");
|
|
|
|
priv->step_unlock = TRUE;
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_SIGNAL (sink);
|
2009-05-19 17:45:06 +00:00
|
|
|
}
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (sink);
|
2009-06-08 14:27:36 +00:00
|
|
|
} else {
|
|
|
|
/* update the stepinfo and make it valid */
|
2009-06-08 15:39:47 +00:00
|
|
|
set_step_info (sink, current, pending, seqnum, format, amount, rate, flush,
|
2009-06-08 14:27:36 +00:00
|
|
|
intermediate);
|
2009-05-11 16:56:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
/* with STREAM_LOCK
|
|
|
|
*/
|
2005-03-28 14:54:33 +00:00
|
|
|
static void
|
2005-06-28 12:01:49 +00:00
|
|
|
gst_base_sink_loop (GstPad * pad)
|
2005-03-28 14:54:33 +00:00
|
|
|
{
|
2011-11-17 11:40:45 +00:00
|
|
|
GstObject *parent;
|
2005-03-28 14:54:33 +00:00
|
|
|
GstBaseSink *basesink;
|
|
|
|
GstBuffer *buf = NULL;
|
|
|
|
GstFlowReturn result;
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
guint blocksize;
|
2008-10-16 14:09:18 +00:00
|
|
|
guint64 offset;
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2011-11-17 11:40:45 +00:00
|
|
|
parent = GST_OBJECT_PARENT (pad);
|
|
|
|
basesink = GST_BASE_SINK (parent);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2011-11-18 11:35:46 +00:00
|
|
|
g_assert (basesink->pad_mode == GST_PAD_MODE_PULL);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
if ((blocksize = basesink->priv->blocksize) == 0)
|
|
|
|
blocksize = -1;
|
|
|
|
|
2011-05-13 16:07:24 +00:00
|
|
|
offset = basesink->segment.position;
|
2008-10-16 14:09:18 +00:00
|
|
|
|
2007-08-28 15:02:19 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "pulling %" G_GUINT64_FORMAT ", %u",
|
2008-10-16 14:09:18 +00:00
|
|
|
offset, blocksize);
|
2007-08-28 15:02:19 +00:00
|
|
|
|
2008-10-16 14:09:18 +00:00
|
|
|
result = gst_pad_pull_range (pad, offset, blocksize, &buf);
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
if (G_UNLIKELY (result != GST_FLOW_OK))
|
2005-03-28 14:54:33 +00:00
|
|
|
goto paused;
|
|
|
|
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
if (G_UNLIKELY (buf == NULL))
|
|
|
|
goto no_buffer;
|
|
|
|
|
2011-03-21 17:13:55 +00:00
|
|
|
offset += gst_buffer_get_size (buf);
|
2008-10-16 14:09:18 +00:00
|
|
|
|
2011-05-13 16:07:24 +00:00
|
|
|
basesink->segment.position = offset;
|
2006-07-05 18:18:47 +00:00
|
|
|
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_LOCK (basesink);
|
2012-05-16 10:08:44 +00:00
|
|
|
result = gst_base_sink_chain_unlocked (basesink, pad, buf, FALSE);
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (basesink);
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
if (G_UNLIKELY (result != GST_FLOW_OK))
|
2005-03-28 14:54:33 +00:00
|
|
|
goto paused;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
/* ERRORS */
|
2005-03-28 14:54:33 +00:00
|
|
|
paused:
|
gst/base/: Make basesrc negotiate.
Original commit message from CVS:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_handle_object), (gst_base_sink_loop),
(gst_base_sink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasesrc.c: (gst_base_src_class_init),
(gst_base_src_init), (gst_base_src_setcaps),
(gst_base_src_getcaps), (gst_base_src_loop),
(gst_base_src_default_negotiate), (gst_base_src_negotiate),
(gst_base_src_start), (gst_base_src_change_state):
* gst/base/gstbasesrc.h:
Make basesrc negotiate.
Handle the case where preroll fails in basesink.
Update README.
2005-07-06 13:25:26 +00:00
|
|
|
{
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
GST_LOG_OBJECT (basesink, "pausing task, reason %s",
|
|
|
|
gst_flow_get_name (result));
|
gst/base/: Make basesrc negotiate.
Original commit message from CVS:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_handle_object), (gst_base_sink_loop),
(gst_base_sink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasesrc.c: (gst_base_src_class_init),
(gst_base_src_init), (gst_base_src_setcaps),
(gst_base_src_getcaps), (gst_base_src_loop),
(gst_base_src_default_negotiate), (gst_base_src_negotiate),
(gst_base_src_start), (gst_base_src_change_state):
* gst/base/gstbasesrc.h:
Make basesrc negotiate.
Handle the case where preroll fails in basesink.
Update README.
2005-07-06 13:25:26 +00:00
|
|
|
gst_pad_pause_task (pad);
|
2011-10-10 09:33:51 +00:00
|
|
|
if (result == GST_FLOW_EOS) {
|
2010-08-26 21:37:07 +00:00
|
|
|
/* perform EOS logic */
|
2012-07-09 20:51:07 +00:00
|
|
|
if (basesink->segment.flags & GST_SEGMENT_FLAG_SEGMENT) {
|
2010-08-26 21:37:07 +00:00
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
|
|
|
gst_message_new_segment_done (GST_OBJECT_CAST (basesink),
|
2011-05-13 16:07:24 +00:00
|
|
|
basesink->segment.format, basesink->segment.position));
|
2012-07-05 11:03:10 +00:00
|
|
|
gst_base_sink_event (pad, parent,
|
|
|
|
gst_event_new_segment_done (basesink->segment.format,
|
|
|
|
basesink->segment.position));
|
2008-10-16 14:09:18 +00:00
|
|
|
} else {
|
2011-11-17 11:40:45 +00:00
|
|
|
gst_base_sink_event (pad, parent, gst_event_new_eos ());
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
}
|
2011-10-10 09:33:51 +00:00
|
|
|
} else if (result == GST_FLOW_NOT_LINKED || result <= GST_FLOW_EOS) {
|
2010-08-26 21:37:07 +00:00
|
|
|
/* for fatal errors we post an error message, post the error
|
|
|
|
* first so the app knows about the error first.
|
|
|
|
* wrong-state is not a fatal error because it happens due to
|
|
|
|
* flushing and posting an error message in that case is the
|
|
|
|
* wrong thing to do, e.g. when basesrc is doing a flushing
|
|
|
|
* seek. */
|
2016-08-23 16:27:58 +00:00
|
|
|
GST_ELEMENT_FLOW_ERROR (basesink, result);
|
2011-11-17 11:40:45 +00:00
|
|
|
gst_base_sink_event (pad, parent, gst_event_new_eos ());
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
}
|
gst/base/: Make basesrc negotiate.
Original commit message from CVS:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_handle_object), (gst_base_sink_loop),
(gst_base_sink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasesrc.c: (gst_base_src_class_init),
(gst_base_src_init), (gst_base_src_setcaps),
(gst_base_src_getcaps), (gst_base_src_loop),
(gst_base_src_default_negotiate), (gst_base_src_negotiate),
(gst_base_src_start), (gst_base_src_change_state):
* gst/base/gstbasesrc.h:
Make basesrc negotiate.
Handle the case where preroll fails in basesink.
Update README.
2005-07-06 13:25:26 +00:00
|
|
|
return;
|
|
|
|
}
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
no_buffer:
|
|
|
|
{
|
|
|
|
GST_LOG_OBJECT (basesink, "no buffer, pausing");
|
2008-10-16 14:09:18 +00:00
|
|
|
GST_ELEMENT_ERROR (basesink, STREAM, FAILED,
|
|
|
|
(_("Internal data flow error.")), ("element returned NULL buffer"));
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
result = GST_FLOW_ERROR;
|
|
|
|
goto paused;
|
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
gst_base_sink_set_flushing (GstBaseSink * basesink, GstPad * pad,
|
|
|
|
gboolean flushing)
|
2005-03-28 14:54:33 +00:00
|
|
|
{
|
libs/gst/base/: Add ::unlock_stop to basesrc and basesink. This allows an opportunity for sub-classes to correctly cl...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_set_flushing),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
* libs/gst/base/gstbasesrc.c: (gst_base_src_perform_seek),
(gst_base_src_default_event), (gst_base_src_unlock_stop),
(gst_base_src_deactivate):
* libs/gst/base/gstbasesrc.h:
Add ::unlock_stop to basesrc and basesink. This allows an opportunity
for sub-classes to correctly clear any state they set trying to
unlock, such as clearing out unlock commands from a command fd.
* plugins/elements/gstfdsink.c: (gst_fd_sink_class_init),
(gst_fd_sink_render), (gst_fd_sink_unlock),
(gst_fd_sink_unlock_stop):
* plugins/elements/gstfdsrc.c: (gst_fd_src_class_init),
(gst_fd_src_init), (gst_fd_src_unlock), (gst_fd_src_unlock_stop),
(gst_fd_src_create), (gst_fd_src_get_size), (gst_fd_src_do_seek):
Implement unlock_stop in fdsrc and fdsink.
Implement seeking in fdsrc when a seekable fd is passed, as in
gst-launch-0.10 fdsrc ! ... ! xvimagesink < /path/to/file
2007-03-19 15:01:40 +00:00
|
|
|
GstBaseSinkClass *bclass;
|
2006-05-08 11:49:43 +00:00
|
|
|
|
libs/gst/base/: Add ::unlock_stop to basesrc and basesink. This allows an opportunity for sub-classes to correctly cl...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_set_flushing),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
* libs/gst/base/gstbasesrc.c: (gst_base_src_perform_seek),
(gst_base_src_default_event), (gst_base_src_unlock_stop),
(gst_base_src_deactivate):
* libs/gst/base/gstbasesrc.h:
Add ::unlock_stop to basesrc and basesink. This allows an opportunity
for sub-classes to correctly clear any state they set trying to
unlock, such as clearing out unlock commands from a command fd.
* plugins/elements/gstfdsink.c: (gst_fd_sink_class_init),
(gst_fd_sink_render), (gst_fd_sink_unlock),
(gst_fd_sink_unlock_stop):
* plugins/elements/gstfdsrc.c: (gst_fd_src_class_init),
(gst_fd_src_init), (gst_fd_src_unlock), (gst_fd_src_unlock_stop),
(gst_fd_src_create), (gst_fd_src_get_size), (gst_fd_src_do_seek):
Implement unlock_stop in fdsrc and fdsink.
Implement seeking in fdsrc when a seekable fd is passed, as in
gst-launch-0.10 fdsrc ! ... ! xvimagesink < /path/to/file
2007-03-19 15:01:40 +00:00
|
|
|
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
libs/gst/base/: Add ::unlock_stop to basesrc and basesink. This allows an opportunity for sub-classes to correctly cl...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_set_flushing),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
* libs/gst/base/gstbasesrc.c: (gst_base_src_perform_seek),
(gst_base_src_default_event), (gst_base_src_unlock_stop),
(gst_base_src_deactivate):
* libs/gst/base/gstbasesrc.h:
Add ::unlock_stop to basesrc and basesink. This allows an opportunity
for sub-classes to correctly clear any state they set trying to
unlock, such as clearing out unlock commands from a command fd.
* plugins/elements/gstfdsink.c: (gst_fd_sink_class_init),
(gst_fd_sink_render), (gst_fd_sink_unlock),
(gst_fd_sink_unlock_stop):
* plugins/elements/gstfdsrc.c: (gst_fd_src_class_init),
(gst_fd_src_init), (gst_fd_src_unlock), (gst_fd_src_unlock_stop),
(gst_fd_src_create), (gst_fd_src_get_size), (gst_fd_src_do_seek):
Implement unlock_stop in fdsrc and fdsink.
Implement seeking in fdsrc when a seekable fd is passed, as in
gst-launch-0.10 fdsrc ! ... ! xvimagesink < /path/to/file
2007-03-19 15:01:40 +00:00
|
|
|
if (flushing) {
|
2006-05-08 11:49:43 +00:00
|
|
|
/* unlock any subclasses, we need to do this before grabbing the
|
|
|
|
* PREROLL_LOCK since we hold this lock before going into ::render. */
|
|
|
|
if (bclass->unlock)
|
|
|
|
bclass->unlock (basesink);
|
|
|
|
}
|
|
|
|
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_LOCK (basesink);
|
2006-05-08 11:49:43 +00:00
|
|
|
basesink->flushing = flushing;
|
|
|
|
if (flushing) {
|
libs/gst/base/: Add ::unlock_stop to basesrc and basesink. This allows an opportunity for sub-classes to correctly cl...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_set_flushing),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
* libs/gst/base/gstbasesrc.c: (gst_base_src_perform_seek),
(gst_base_src_default_event), (gst_base_src_unlock_stop),
(gst_base_src_deactivate):
* libs/gst/base/gstbasesrc.h:
Add ::unlock_stop to basesrc and basesink. This allows an opportunity
for sub-classes to correctly clear any state they set trying to
unlock, such as clearing out unlock commands from a command fd.
* plugins/elements/gstfdsink.c: (gst_fd_sink_class_init),
(gst_fd_sink_render), (gst_fd_sink_unlock),
(gst_fd_sink_unlock_stop):
* plugins/elements/gstfdsrc.c: (gst_fd_src_class_init),
(gst_fd_src_init), (gst_fd_src_unlock), (gst_fd_src_unlock_stop),
(gst_fd_src_create), (gst_fd_src_get_size), (gst_fd_src_do_seek):
Implement unlock_stop in fdsrc and fdsink.
Implement seeking in fdsrc when a seekable fd is passed, as in
gst-launch-0.10 fdsrc ! ... ! xvimagesink < /path/to/file
2007-03-19 15:01:40 +00:00
|
|
|
/* step 1, now that we have the PREROLL lock, clear our unlock request */
|
|
|
|
if (bclass->unlock_stop)
|
|
|
|
bclass->unlock_stop (basesink);
|
|
|
|
|
2007-09-14 15:52:27 +00:00
|
|
|
/* set need_preroll before we unblock the clock. If the clock is unblocked
|
|
|
|
* before timing out, we can reuse the buffer for preroll. */
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
basesink->need_preroll = TRUE;
|
2007-09-14 15:52:27 +00:00
|
|
|
|
|
|
|
/* step 2, unblock clock sync (if any) or any other blocking thing */
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
if (basesink->clock_id) {
|
|
|
|
gst_clock_id_unschedule (basesink->clock_id);
|
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2008-05-07 09:47:27 +00:00
|
|
|
/* flush out the data thread if it's locked in finish_preroll, this will
|
|
|
|
* also flush out the EOS state */
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink,
|
|
|
|
"flushing out data thread, need preroll to TRUE");
|
2011-12-02 11:42:50 +00:00
|
|
|
|
|
|
|
/* we can't have EOS anymore now */
|
|
|
|
basesink->eos = FALSE;
|
|
|
|
basesink->priv->received_eos = FALSE;
|
|
|
|
basesink->have_preroll = FALSE;
|
|
|
|
basesink->priv->step_unlock = FALSE;
|
|
|
|
/* can't report latency anymore until we preroll again */
|
|
|
|
if (basesink->priv->async_enabled) {
|
|
|
|
GST_OBJECT_LOCK (basesink);
|
|
|
|
basesink->priv->have_latency = FALSE;
|
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
|
|
|
}
|
|
|
|
/* and signal any waiters now */
|
|
|
|
GST_BASE_SINK_PREROLL_SIGNAL (basesink);
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
}
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (basesink);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate): (gst_base_transform_init, gst_base_transform_sink_activa...
Original commit message from CVS:
2007-01-12 Andy Wingo <wingo@pobox.com>
* libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate):
(gst_base_transform_init, gst_base_transform_sink_activate_push)
(gst_base_transform_src_activate_pull):
Track the activation mode.
(gst_base_transform_setcaps): In pull mode, when activating the
src pad, after activating the sink pad, activate the sink pad's
peer, as discussed in part-negotiation.txt.
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasesrc.c (gst_base_src_fixate): Add fixate
vmethod, as in basesink.
* libs/gst/base/gstbasesink.h: Reformat docs, add fixate vmethod.
* libs/gst/base/gstbasesink.c (gst_base_sink_pad_setcaps): In pull
mode, first proxy the setcaps to the peer pad.
(gst_base_sink_pad_fixate): Add a fixate function that calls the
new fixate vmethod.
(gst_base_sink_default_activate_pull): Rename from
gst_base_sink_activate_pull.
(gst_base_sink_negotiate_pull): New function, performs negotiation
in pull mode before calling ::activate_pull().
(gst_base_sink_pad_activate_pull): Actually call the activate_pull
vmethod instead of the default implementation. I have no idea how
this worked before. Negotiate before calling activate_pull.
2007-01-12 15:56:00 +00:00
|
|
|
gst_base_sink_default_activate_pull (GstBaseSink * basesink, gboolean active)
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
{
|
|
|
|
gboolean result;
|
|
|
|
|
2007-01-06 17:18:03 +00:00
|
|
|
if (active) {
|
|
|
|
/* start task */
|
|
|
|
result = gst_pad_start_task (basesink->sinkpad,
|
2012-06-20 08:31:49 +00:00
|
|
|
(GstTaskFunction) gst_base_sink_loop, basesink->sinkpad, NULL);
|
2007-01-06 17:18:03 +00:00
|
|
|
} else {
|
|
|
|
/* step 2, make sure streaming finishes */
|
|
|
|
result = gst_pad_stop_task (basesink->sinkpad);
|
|
|
|
}
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-11-18 12:46:46 +00:00
|
|
|
gst_base_sink_pad_activate (GstPad * pad, GstObject * parent)
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
{
|
|
|
|
gboolean result = FALSE;
|
|
|
|
GstBaseSink *basesink;
|
2011-05-24 15:36:24 +00:00
|
|
|
GstQuery *query;
|
|
|
|
gboolean pull_mode;
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
|
2011-11-18 12:46:46 +00:00
|
|
|
basesink = GST_BASE_SINK (parent);
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
|
2005-08-26 14:21:43 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "Trying pull mode first");
|
|
|
|
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
gst_base_sink_set_flushing (basesink, pad, FALSE);
|
|
|
|
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
/* we need to have the pull mode enabled */
|
2008-10-10 10:38:12 +00:00
|
|
|
if (!basesink->can_activate_pull) {
|
|
|
|
GST_DEBUG_OBJECT (basesink, "pull mode disabled");
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
goto fallback;
|
2008-10-10 10:38:12 +00:00
|
|
|
}
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
|
|
|
|
/* check if downstreams supports pull mode at all */
|
2011-05-24 15:36:24 +00:00
|
|
|
query = gst_query_new_scheduling ();
|
|
|
|
|
|
|
|
if (!gst_pad_peer_query (pad, query)) {
|
|
|
|
gst_query_unref (query);
|
|
|
|
GST_DEBUG_OBJECT (basesink, "peer query faild, no pull mode");
|
|
|
|
goto fallback;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* parse result of the query */
|
2011-11-18 16:27:16 +00:00
|
|
|
pull_mode = gst_query_has_scheduling_mode (query, GST_PAD_MODE_PULL);
|
2011-05-24 15:36:24 +00:00
|
|
|
gst_query_unref (query);
|
|
|
|
|
|
|
|
if (!pull_mode) {
|
2008-10-10 10:38:12 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "pull mode not supported");
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
goto fallback;
|
2008-10-10 10:38:12 +00:00
|
|
|
}
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
|
|
|
|
/* set the pad mode before starting the task so that it's in the
|
|
|
|
* correct state for the new thread. also the sink set_caps and get_caps
|
|
|
|
* function checks this */
|
2011-11-18 11:35:46 +00:00
|
|
|
basesink->pad_mode = GST_PAD_MODE_PULL;
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
|
|
|
|
/* we first try to negotiate a format so that when we try to activate
|
|
|
|
* downstream, it knows about our format */
|
2008-10-10 10:38:12 +00:00
|
|
|
if (!gst_base_sink_negotiate_pull (basesink)) {
|
|
|
|
GST_DEBUG_OBJECT (basesink, "failed to negotiate in pull mode");
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
goto fallback;
|
2008-10-10 10:38:12 +00:00
|
|
|
}
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
|
|
|
|
/* ok activate now */
|
2011-11-21 12:29:05 +00:00
|
|
|
if (!gst_pad_activate_mode (pad, GST_PAD_MODE_PULL, TRUE)) {
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
/* clear any pending caps */
|
|
|
|
GST_OBJECT_LOCK (basesink);
|
2011-12-01 15:46:06 +00:00
|
|
|
gst_caps_replace (&basesink->priv->caps, NULL);
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
2008-10-10 10:38:12 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "failed to activate in pull mode");
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
goto fallback;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (basesink, "Success activating pull mode");
|
|
|
|
result = TRUE;
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
/* push mode fallback */
|
|
|
|
fallback:
|
|
|
|
GST_DEBUG_OBJECT (basesink, "Falling back to push mode");
|
2011-11-21 12:29:05 +00:00
|
|
|
if ((result = gst_pad_activate_mode (pad, GST_PAD_MODE_PUSH, TRUE))) {
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "Success activating push mode");
|
2005-08-26 14:21:43 +00:00
|
|
|
}
|
|
|
|
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
done:
|
2005-08-26 14:21:43 +00:00
|
|
|
if (!result) {
|
|
|
|
GST_WARNING_OBJECT (basesink, "Could not activate pad in either mode");
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
gst_base_sink_set_flushing (basesink, pad, TRUE);
|
2005-08-26 14:21:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-11-18 12:46:46 +00:00
|
|
|
gst_base_sink_pad_activate_push (GstPad * pad, GstObject * parent,
|
|
|
|
gboolean active)
|
2005-08-26 14:21:43 +00:00
|
|
|
{
|
|
|
|
gboolean result;
|
|
|
|
GstBaseSink *basesink;
|
|
|
|
|
2011-11-18 12:46:46 +00:00
|
|
|
basesink = GST_BASE_SINK (parent);
|
2005-08-26 14:21:43 +00:00
|
|
|
|
|
|
|
if (active) {
|
|
|
|
if (!basesink->can_activate_push) {
|
|
|
|
result = FALSE;
|
2011-11-18 11:35:46 +00:00
|
|
|
basesink->pad_mode = GST_PAD_MODE_NONE;
|
2005-08-26 14:21:43 +00:00
|
|
|
} else {
|
|
|
|
result = TRUE;
|
2011-11-18 11:35:46 +00:00
|
|
|
basesink->pad_mode = GST_PAD_MODE_PUSH;
|
2005-08-26 14:21:43 +00:00
|
|
|
}
|
|
|
|
} else {
|
2011-11-18 11:35:46 +00:00
|
|
|
if (G_UNLIKELY (basesink->pad_mode != GST_PAD_MODE_PUSH)) {
|
2005-08-26 14:21:43 +00:00
|
|
|
g_warning ("Internal GStreamer activation error!!!");
|
|
|
|
result = FALSE;
|
|
|
|
} else {
|
2007-01-06 17:18:03 +00:00
|
|
|
gst_base_sink_set_flushing (basesink, pad, TRUE);
|
|
|
|
result = TRUE;
|
2011-11-18 11:35:46 +00:00
|
|
|
basesink->pad_mode = GST_PAD_MODE_NONE;
|
2005-08-26 14:21:43 +00:00
|
|
|
}
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate): (gst_base_transform_init, gst_base_transform_sink_activa...
Original commit message from CVS:
2007-01-12 Andy Wingo <wingo@pobox.com>
* libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate):
(gst_base_transform_init, gst_base_transform_sink_activate_push)
(gst_base_transform_src_activate_pull):
Track the activation mode.
(gst_base_transform_setcaps): In pull mode, when activating the
src pad, after activating the sink pad, activate the sink pad's
peer, as discussed in part-negotiation.txt.
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasesrc.c (gst_base_src_fixate): Add fixate
vmethod, as in basesink.
* libs/gst/base/gstbasesink.h: Reformat docs, add fixate vmethod.
* libs/gst/base/gstbasesink.c (gst_base_sink_pad_setcaps): In pull
mode, first proxy the setcaps to the peer pad.
(gst_base_sink_pad_fixate): Add a fixate function that calls the
new fixate vmethod.
(gst_base_sink_default_activate_pull): Rename from
gst_base_sink_activate_pull.
(gst_base_sink_negotiate_pull): New function, performs negotiation
in pull mode before calling ::activate_pull().
(gst_base_sink_pad_activate_pull): Actually call the activate_pull
vmethod instead of the default implementation. I have no idea how
this worked before. Negotiate before calling activate_pull.
2007-01-12 15:56:00 +00:00
|
|
|
static gboolean
|
|
|
|
gst_base_sink_negotiate_pull (GstBaseSink * basesink)
|
|
|
|
{
|
|
|
|
GstCaps *caps;
|
2008-08-19 16:47:07 +00:00
|
|
|
gboolean result;
|
libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate): (gst_base_transform_init, gst_base_transform_sink_activa...
Original commit message from CVS:
2007-01-12 Andy Wingo <wingo@pobox.com>
* libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate):
(gst_base_transform_init, gst_base_transform_sink_activate_push)
(gst_base_transform_src_activate_pull):
Track the activation mode.
(gst_base_transform_setcaps): In pull mode, when activating the
src pad, after activating the sink pad, activate the sink pad's
peer, as discussed in part-negotiation.txt.
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasesrc.c (gst_base_src_fixate): Add fixate
vmethod, as in basesink.
* libs/gst/base/gstbasesink.h: Reformat docs, add fixate vmethod.
* libs/gst/base/gstbasesink.c (gst_base_sink_pad_setcaps): In pull
mode, first proxy the setcaps to the peer pad.
(gst_base_sink_pad_fixate): Add a fixate function that calls the
new fixate vmethod.
(gst_base_sink_default_activate_pull): Rename from
gst_base_sink_activate_pull.
(gst_base_sink_negotiate_pull): New function, performs negotiation
in pull mode before calling ::activate_pull().
(gst_base_sink_pad_activate_pull): Actually call the activate_pull
vmethod instead of the default implementation. I have no idea how
this worked before. Negotiate before calling activate_pull.
2007-01-12 15:56:00 +00:00
|
|
|
|
2008-08-19 16:47:07 +00:00
|
|
|
result = FALSE;
|
libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate): (gst_base_transform_init, gst_base_transform_sink_activa...
Original commit message from CVS:
2007-01-12 Andy Wingo <wingo@pobox.com>
* libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate):
(gst_base_transform_init, gst_base_transform_sink_activate_push)
(gst_base_transform_src_activate_pull):
Track the activation mode.
(gst_base_transform_setcaps): In pull mode, when activating the
src pad, after activating the sink pad, activate the sink pad's
peer, as discussed in part-negotiation.txt.
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasesrc.c (gst_base_src_fixate): Add fixate
vmethod, as in basesink.
* libs/gst/base/gstbasesink.h: Reformat docs, add fixate vmethod.
* libs/gst/base/gstbasesink.c (gst_base_sink_pad_setcaps): In pull
mode, first proxy the setcaps to the peer pad.
(gst_base_sink_pad_fixate): Add a fixate function that calls the
new fixate vmethod.
(gst_base_sink_default_activate_pull): Rename from
gst_base_sink_activate_pull.
(gst_base_sink_negotiate_pull): New function, performs negotiation
in pull mode before calling ::activate_pull().
(gst_base_sink_pad_activate_pull): Actually call the activate_pull
vmethod instead of the default implementation. I have no idea how
this worked before. Negotiate before calling activate_pull.
2007-01-12 15:56:00 +00:00
|
|
|
|
2008-08-19 16:47:07 +00:00
|
|
|
/* this returns the intersection between our caps and the peer caps. If there
|
2014-06-05 19:38:20 +00:00
|
|
|
* is no peer, it returns %NULL and we can't operate in pull mode so we can
|
2008-08-19 16:47:07 +00:00
|
|
|
* fail the negotiation. */
|
|
|
|
caps = gst_pad_get_allowed_caps (GST_BASE_SINK_PAD (basesink));
|
|
|
|
if (caps == NULL || gst_caps_is_empty (caps))
|
libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate): (gst_base_transform_init, gst_base_transform_sink_activa...
Original commit message from CVS:
2007-01-12 Andy Wingo <wingo@pobox.com>
* libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate):
(gst_base_transform_init, gst_base_transform_sink_activate_push)
(gst_base_transform_src_activate_pull):
Track the activation mode.
(gst_base_transform_setcaps): In pull mode, when activating the
src pad, after activating the sink pad, activate the sink pad's
peer, as discussed in part-negotiation.txt.
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasesrc.c (gst_base_src_fixate): Add fixate
vmethod, as in basesink.
* libs/gst/base/gstbasesink.h: Reformat docs, add fixate vmethod.
* libs/gst/base/gstbasesink.c (gst_base_sink_pad_setcaps): In pull
mode, first proxy the setcaps to the peer pad.
(gst_base_sink_pad_fixate): Add a fixate function that calls the
new fixate vmethod.
(gst_base_sink_default_activate_pull): Rename from
gst_base_sink_activate_pull.
(gst_base_sink_negotiate_pull): New function, performs negotiation
in pull mode before calling ::activate_pull().
(gst_base_sink_pad_activate_pull): Actually call the activate_pull
vmethod instead of the default implementation. I have no idea how
this worked before. Negotiate before calling activate_pull.
2007-01-12 15:56:00 +00:00
|
|
|
goto no_caps_possible;
|
|
|
|
|
2008-08-19 16:47:07 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "allowed caps: %" GST_PTR_FORMAT, caps);
|
|
|
|
|
2007-01-12 18:06:29 +00:00
|
|
|
if (gst_caps_is_any (caps)) {
|
|
|
|
GST_DEBUG_OBJECT (basesink, "caps were ANY after fixating, "
|
|
|
|
"allowing pull()");
|
|
|
|
/* neither side has template caps in this case, so they are prepared for
|
|
|
|
pull() without setcaps() */
|
2008-08-19 16:47:07 +00:00
|
|
|
result = TRUE;
|
2011-04-18 16:19:24 +00:00
|
|
|
} else {
|
|
|
|
/* try to fixate */
|
2012-03-11 17:57:44 +00:00
|
|
|
caps = gst_base_sink_fixate (basesink, caps);
|
2011-04-18 16:19:24 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "fixated to: %" GST_PTR_FORMAT, caps);
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
|
2011-04-18 16:19:24 +00:00
|
|
|
if (gst_caps_is_fixed (caps)) {
|
2012-06-08 13:36:40 +00:00
|
|
|
if (!gst_pad_set_caps (GST_BASE_SINK_PAD (basesink), caps))
|
2011-04-18 16:19:24 +00:00
|
|
|
goto could_not_set_caps;
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
|
2011-04-18 16:19:24 +00:00
|
|
|
result = TRUE;
|
|
|
|
}
|
2007-01-12 18:06:29 +00:00
|
|
|
}
|
libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate): (gst_base_transform_init, gst_base_transform_sink_activa...
Original commit message from CVS:
2007-01-12 Andy Wingo <wingo@pobox.com>
* libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate):
(gst_base_transform_init, gst_base_transform_sink_activate_push)
(gst_base_transform_src_activate_pull):
Track the activation mode.
(gst_base_transform_setcaps): In pull mode, when activating the
src pad, after activating the sink pad, activate the sink pad's
peer, as discussed in part-negotiation.txt.
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasesrc.c (gst_base_src_fixate): Add fixate
vmethod, as in basesink.
* libs/gst/base/gstbasesink.h: Reformat docs, add fixate vmethod.
* libs/gst/base/gstbasesink.c (gst_base_sink_pad_setcaps): In pull
mode, first proxy the setcaps to the peer pad.
(gst_base_sink_pad_fixate): Add a fixate function that calls the
new fixate vmethod.
(gst_base_sink_default_activate_pull): Rename from
gst_base_sink_activate_pull.
(gst_base_sink_negotiate_pull): New function, performs negotiation
in pull mode before calling ::activate_pull().
(gst_base_sink_pad_activate_pull): Actually call the activate_pull
vmethod instead of the default implementation. I have no idea how
this worked before. Negotiate before calling activate_pull.
2007-01-12 15:56:00 +00:00
|
|
|
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
2008-08-19 16:47:07 +00:00
|
|
|
return result;
|
libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate): (gst_base_transform_init, gst_base_transform_sink_activa...
Original commit message from CVS:
2007-01-12 Andy Wingo <wingo@pobox.com>
* libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate):
(gst_base_transform_init, gst_base_transform_sink_activate_push)
(gst_base_transform_src_activate_pull):
Track the activation mode.
(gst_base_transform_setcaps): In pull mode, when activating the
src pad, after activating the sink pad, activate the sink pad's
peer, as discussed in part-negotiation.txt.
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasesrc.c (gst_base_src_fixate): Add fixate
vmethod, as in basesink.
* libs/gst/base/gstbasesink.h: Reformat docs, add fixate vmethod.
* libs/gst/base/gstbasesink.c (gst_base_sink_pad_setcaps): In pull
mode, first proxy the setcaps to the peer pad.
(gst_base_sink_pad_fixate): Add a fixate function that calls the
new fixate vmethod.
(gst_base_sink_default_activate_pull): Rename from
gst_base_sink_activate_pull.
(gst_base_sink_negotiate_pull): New function, performs negotiation
in pull mode before calling ::activate_pull().
(gst_base_sink_pad_activate_pull): Actually call the activate_pull
vmethod instead of the default implementation. I have no idea how
this worked before. Negotiate before calling activate_pull.
2007-01-12 15:56:00 +00:00
|
|
|
|
|
|
|
no_caps_possible:
|
|
|
|
{
|
|
|
|
GST_INFO_OBJECT (basesink, "Pipeline could not agree on caps");
|
|
|
|
GST_DEBUG_OBJECT (basesink, "get_allowed_caps() returned EMPTY");
|
2008-08-19 16:47:07 +00:00
|
|
|
if (caps)
|
|
|
|
gst_caps_unref (caps);
|
libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate): (gst_base_transform_init, gst_base_transform_sink_activa...
Original commit message from CVS:
2007-01-12 Andy Wingo <wingo@pobox.com>
* libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate):
(gst_base_transform_init, gst_base_transform_sink_activate_push)
(gst_base_transform_src_activate_pull):
Track the activation mode.
(gst_base_transform_setcaps): In pull mode, when activating the
src pad, after activating the sink pad, activate the sink pad's
peer, as discussed in part-negotiation.txt.
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasesrc.c (gst_base_src_fixate): Add fixate
vmethod, as in basesink.
* libs/gst/base/gstbasesink.h: Reformat docs, add fixate vmethod.
* libs/gst/base/gstbasesink.c (gst_base_sink_pad_setcaps): In pull
mode, first proxy the setcaps to the peer pad.
(gst_base_sink_pad_fixate): Add a fixate function that calls the
new fixate vmethod.
(gst_base_sink_default_activate_pull): Rename from
gst_base_sink_activate_pull.
(gst_base_sink_negotiate_pull): New function, performs negotiation
in pull mode before calling ::activate_pull().
(gst_base_sink_pad_activate_pull): Actually call the activate_pull
vmethod instead of the default implementation. I have no idea how
this worked before. Negotiate before calling activate_pull.
2007-01-12 15:56:00 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
could_not_set_caps:
|
|
|
|
{
|
|
|
|
GST_INFO_OBJECT (basesink, "Could not set caps: %" GST_PTR_FORMAT, caps);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
/* this won't get called until we implement an activate function */
|
|
|
|
static gboolean
|
2011-11-18 12:46:46 +00:00
|
|
|
gst_base_sink_pad_activate_pull (GstPad * pad, GstObject * parent,
|
|
|
|
gboolean active)
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
{
|
|
|
|
gboolean result = FALSE;
|
|
|
|
GstBaseSink *basesink;
|
2007-01-06 17:18:03 +00:00
|
|
|
GstBaseSinkClass *bclass;
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
|
2011-11-18 12:46:46 +00:00
|
|
|
basesink = GST_BASE_SINK (parent);
|
2007-01-06 17:18:03 +00:00
|
|
|
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
|
|
|
|
if (active) {
|
2008-10-17 13:27:59 +00:00
|
|
|
gint64 duration;
|
|
|
|
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
/* we mark we have a newsegment here because pull based
|
|
|
|
* mode works just fine without having a newsegment before the
|
|
|
|
* first buffer */
|
2011-07-26 23:26:43 +00:00
|
|
|
gst_segment_init (&basesink->segment, GST_FORMAT_BYTES);
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
GST_OBJECT_LOCK (basesink);
|
|
|
|
basesink->have_newsegment = TRUE;
|
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
2005-08-26 14:21:43 +00:00
|
|
|
|
2008-10-17 13:27:59 +00:00
|
|
|
/* get the peer duration in bytes */
|
2011-11-15 16:50:34 +00:00
|
|
|
result = gst_pad_peer_query_duration (pad, GST_FORMAT_BYTES, &duration);
|
2008-10-17 13:27:59 +00:00
|
|
|
if (result) {
|
|
|
|
GST_DEBUG_OBJECT (basesink,
|
|
|
|
"setting duration in bytes to %" G_GINT64_FORMAT, duration);
|
2011-05-13 16:07:24 +00:00
|
|
|
basesink->segment.duration = duration;
|
2008-10-17 13:27:59 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (basesink, "unknown duration");
|
|
|
|
}
|
|
|
|
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
if (bclass->activate_pull)
|
|
|
|
result = bclass->activate_pull (basesink, TRUE);
|
|
|
|
else
|
|
|
|
result = FALSE;
|
2005-09-07 10:06:56 +00:00
|
|
|
|
2008-10-17 13:27:59 +00:00
|
|
|
if (!result)
|
|
|
|
goto activate_failed;
|
|
|
|
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
} else {
|
2011-11-18 11:35:46 +00:00
|
|
|
if (G_UNLIKELY (basesink->pad_mode != GST_PAD_MODE_PULL)) {
|
2005-08-26 14:21:43 +00:00
|
|
|
g_warning ("Internal GStreamer activation error!!!");
|
|
|
|
result = FALSE;
|
|
|
|
} else {
|
2007-01-06 17:18:03 +00:00
|
|
|
result = gst_base_sink_set_flushing (basesink, pad, TRUE);
|
|
|
|
if (bclass->activate_pull)
|
|
|
|
result &= bclass->activate_pull (basesink, FALSE);
|
2011-11-18 11:35:46 +00:00
|
|
|
basesink->pad_mode = GST_PAD_MODE_NONE;
|
2005-08-26 14:21:43 +00:00
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
2008-10-17 13:27:59 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
activate_failed:
|
|
|
|
{
|
2009-02-26 13:40:26 +00:00
|
|
|
/* reset, as starting the thread failed */
|
2011-11-18 11:35:46 +00:00
|
|
|
basesink->pad_mode = GST_PAD_MODE_NONE;
|
2009-02-26 13:40:26 +00:00
|
|
|
|
2008-10-17 13:27:59 +00:00
|
|
|
GST_ERROR_OBJECT (basesink, "subclass failed to activate in pull mode");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|
|
|
|
|
2011-11-21 12:29:05 +00:00
|
|
|
static gboolean
|
|
|
|
gst_base_sink_pad_activate_mode (GstPad * pad, GstObject * parent,
|
|
|
|
GstPadMode mode, gboolean active)
|
|
|
|
{
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
switch (mode) {
|
|
|
|
case GST_PAD_MODE_PULL:
|
|
|
|
res = gst_base_sink_pad_activate_pull (pad, parent, active);
|
|
|
|
break;
|
|
|
|
case GST_PAD_MODE_PUSH:
|
|
|
|
res = gst_base_sink_pad_activate_push (pad, parent, active);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_LOG_OBJECT (pad, "unknown activation mode %d", mode);
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
/* send an event to our sinkpad peer. */
|
2005-09-22 18:07:22 +00:00
|
|
|
static gboolean
|
|
|
|
gst_base_sink_send_event (GstElement * element, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstPad *pad;
|
|
|
|
GstBaseSink *basesink = GST_BASE_SINK (element);
|
2007-11-21 13:47:52 +00:00
|
|
|
gboolean forward, result = TRUE;
|
2011-11-18 11:35:46 +00:00
|
|
|
GstPadMode mode;
|
2007-11-21 13:47:52 +00:00
|
|
|
|
2008-10-16 14:09:18 +00:00
|
|
|
GST_OBJECT_LOCK (element);
|
|
|
|
/* get the pad and the scheduling mode */
|
|
|
|
pad = gst_object_ref (basesink->sinkpad);
|
|
|
|
mode = basesink->pad_mode;
|
|
|
|
GST_OBJECT_UNLOCK (element);
|
|
|
|
|
2009-03-05 16:42:22 +00:00
|
|
|
/* only push UPSTREAM events upstream */
|
|
|
|
forward = GST_EVENT_IS_UPSTREAM (event);
|
2005-09-22 18:07:22 +00:00
|
|
|
|
2010-08-05 06:36:16 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "handling event %p %" GST_PTR_FORMAT, event,
|
|
|
|
event);
|
|
|
|
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_LATENCY:
|
|
|
|
{
|
|
|
|
GstClockTime latency;
|
2005-09-22 18:07:22 +00:00
|
|
|
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
gst_event_parse_latency (event, &latency);
|
2005-09-22 18:07:22 +00:00
|
|
|
|
2008-04-25 07:22:16 +00:00
|
|
|
/* store the latency. We use this to adjust the running_time before syncing
|
|
|
|
* it to the clock. */
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
GST_OBJECT_LOCK (element);
|
|
|
|
basesink->priv->latency = latency;
|
2009-02-23 09:53:17 +00:00
|
|
|
if (!basesink->priv->have_latency)
|
|
|
|
forward = FALSE;
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
GST_OBJECT_UNLOCK (element);
|
|
|
|
GST_DEBUG_OBJECT (basesink, "latency set to %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (latency));
|
2007-02-28 16:46:07 +00:00
|
|
|
|
2008-10-08 14:21:13 +00:00
|
|
|
/* We forward this event so that all elements know about the global pipeline
|
|
|
|
* latency. This is interesting for an element when it wants to figure out
|
|
|
|
* when a particular piece of data will be rendered. */
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-10-16 14:09:18 +00:00
|
|
|
case GST_EVENT_SEEK:
|
|
|
|
/* in pull mode we will execute the seek */
|
2011-11-18 11:35:46 +00:00
|
|
|
if (mode == GST_PAD_MODE_PULL)
|
2008-10-16 14:09:18 +00:00
|
|
|
result = gst_base_sink_perform_seek (basesink, pad, event);
|
|
|
|
break;
|
2009-05-11 16:56:56 +00:00
|
|
|
case GST_EVENT_STEP:
|
|
|
|
result = gst_base_sink_perform_step (basesink, pad, event);
|
|
|
|
forward = FALSE;
|
|
|
|
break;
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (forward) {
|
2016-11-30 20:17:55 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "sending event %p %" GST_PTR_FORMAT, event,
|
|
|
|
event);
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
result = gst_pad_push_event (pad, event);
|
2007-11-21 13:47:52 +00:00
|
|
|
} else {
|
|
|
|
/* not forwarded, unref the event */
|
|
|
|
gst_event_unref (event);
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
}
|
2008-10-16 14:09:18 +00:00
|
|
|
|
|
|
|
gst_object_unref (pad);
|
2011-10-18 12:08:19 +00:00
|
|
|
|
2016-11-30 20:17:55 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "handled event: %d", result);
|
2011-10-18 12:08:19 +00:00
|
|
|
|
2005-09-22 18:07:22 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
static gboolean
|
|
|
|
gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
|
2008-10-06 08:58:25 +00:00
|
|
|
gint64 * cur, gboolean * upstream)
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
{
|
2010-11-25 17:48:09 +00:00
|
|
|
GstClock *clock = NULL;
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
gboolean res = FALSE;
|
2011-07-26 23:26:43 +00:00
|
|
|
GstFormat oformat;
|
2010-11-25 17:48:09 +00:00
|
|
|
GstSegment *segment;
|
2009-11-11 17:12:19 +00:00
|
|
|
GstClockTime now, latency;
|
2011-05-13 16:07:24 +00:00
|
|
|
GstClockTimeDiff base_time;
|
|
|
|
gint64 time, base, duration;
|
2008-10-20 15:18:14 +00:00
|
|
|
gdouble rate;
|
|
|
|
gint64 last;
|
2010-11-25 17:48:09 +00:00
|
|
|
gboolean last_seen, with_clock, in_paused;
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
|
2008-10-20 15:18:14 +00:00
|
|
|
GST_OBJECT_LOCK (basesink);
|
|
|
|
/* we can only get the segment when we are not NULL or READY */
|
|
|
|
if (!basesink->have_newsegment)
|
|
|
|
goto wrong_state;
|
|
|
|
|
2010-11-25 17:48:09 +00:00
|
|
|
in_paused = FALSE;
|
2008-10-20 15:18:14 +00:00
|
|
|
/* when not in PLAYING or when we're busy with a state change, we
|
|
|
|
* cannot read from the clock so we report time based on the
|
|
|
|
* last seen timestamp. */
|
|
|
|
if (GST_STATE (basesink) != GST_STATE_PLAYING ||
|
2010-11-25 17:48:09 +00:00
|
|
|
GST_STATE_PENDING (basesink) != GST_STATE_VOID_PENDING) {
|
|
|
|
in_paused = TRUE;
|
|
|
|
}
|
2008-10-20 15:18:14 +00:00
|
|
|
|
2011-12-02 12:28:18 +00:00
|
|
|
segment = &basesink->segment;
|
2010-11-25 17:48:09 +00:00
|
|
|
|
|
|
|
/* get the format in the segment */
|
|
|
|
oformat = segment->format;
|
|
|
|
|
|
|
|
/* report with last seen position when EOS */
|
|
|
|
last_seen = basesink->eos;
|
|
|
|
|
|
|
|
/* assume we will use the clock for getting the current position */
|
|
|
|
with_clock = TRUE;
|
2014-11-28 13:17:54 +00:00
|
|
|
if (!basesink->sync)
|
2010-11-25 17:48:09 +00:00
|
|
|
with_clock = FALSE;
|
2008-08-19 16:47:07 +00:00
|
|
|
|
2008-10-20 15:18:14 +00:00
|
|
|
/* and we need a clock */
|
|
|
|
if (G_UNLIKELY ((clock = GST_ELEMENT_CLOCK (basesink)) == NULL))
|
2010-11-25 17:48:09 +00:00
|
|
|
with_clock = FALSE;
|
|
|
|
else
|
|
|
|
gst_object_ref (clock);
|
2006-05-15 11:54:22 +00:00
|
|
|
|
2011-07-04 10:58:54 +00:00
|
|
|
/* mainloop might be querying position when going to playing async,
|
|
|
|
* while (audio) rendering might be quickly advancing stream position,
|
|
|
|
* so use clock asap rather than last reported position */
|
|
|
|
if (in_paused && with_clock && g_atomic_int_get (&basesink->priv->to_playing)) {
|
|
|
|
GST_DEBUG_OBJECT (basesink, "going to PLAYING, so not PAUSED");
|
|
|
|
in_paused = FALSE;
|
|
|
|
}
|
|
|
|
|
2008-10-20 15:18:14 +00:00
|
|
|
/* collect all data we need holding the lock */
|
2010-11-25 17:48:09 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (segment->time))
|
|
|
|
time = segment->time;
|
2008-10-20 15:18:14 +00:00
|
|
|
else
|
|
|
|
time = 0;
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
|
2010-11-25 17:48:09 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (segment->stop))
|
|
|
|
duration = segment->stop - segment->start;
|
2008-10-20 15:18:14 +00:00
|
|
|
else
|
|
|
|
duration = 0;
|
|
|
|
|
2011-05-13 16:07:24 +00:00
|
|
|
base = segment->base;
|
2010-11-25 17:48:09 +00:00
|
|
|
rate = segment->rate * segment->applied_rate;
|
2008-10-20 15:18:14 +00:00
|
|
|
latency = basesink->priv->latency;
|
|
|
|
|
2013-05-30 04:51:24 +00:00
|
|
|
if (in_paused) {
|
|
|
|
/* in paused, use start_time */
|
|
|
|
base_time = GST_ELEMENT_START_TIME (basesink);
|
|
|
|
GST_DEBUG_OBJECT (basesink, "in paused, using start time %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (base_time));
|
|
|
|
} else if (with_clock) {
|
|
|
|
/* else use clock when needed */
|
|
|
|
base_time = GST_ELEMENT_CAST (basesink)->base_time;
|
|
|
|
GST_DEBUG_OBJECT (basesink, "using clock and base time %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (base_time));
|
|
|
|
} else {
|
|
|
|
/* else, no sync or clock -> no base time */
|
|
|
|
GST_DEBUG_OBJECT (basesink, "no sync or no clock");
|
|
|
|
base_time = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* no base_time, we can't calculate running_time, use last seem timestamp to report
|
|
|
|
* time */
|
|
|
|
if (base_time == -1)
|
|
|
|
last_seen = TRUE;
|
|
|
|
|
2010-11-25 17:48:09 +00:00
|
|
|
if (oformat == GST_FORMAT_TIME) {
|
|
|
|
gint64 start, stop;
|
2009-01-05 15:42:53 +00:00
|
|
|
|
2010-11-25 17:48:09 +00:00
|
|
|
start = basesink->priv->current_sstart;
|
|
|
|
stop = basesink->priv->current_sstop;
|
|
|
|
|
2014-03-18 15:47:42 +00:00
|
|
|
if (last_seen) {
|
|
|
|
/* when we don't use the clock, we use the last position as a lower bound */
|
2010-11-25 17:48:09 +00:00
|
|
|
if (stop == -1 || segment->rate > 0.0)
|
|
|
|
last = start;
|
|
|
|
else
|
|
|
|
last = stop;
|
2012-11-20 15:19:52 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (basesink, "in PAUSED using last %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (last));
|
2010-11-25 17:48:09 +00:00
|
|
|
} else {
|
2014-03-18 15:47:42 +00:00
|
|
|
/* in playing and paused, use last stop time as upper bound */
|
2010-11-25 17:48:09 +00:00
|
|
|
if (start == -1 || segment->rate > 0.0)
|
|
|
|
last = stop;
|
|
|
|
else
|
|
|
|
last = start;
|
2012-11-20 15:19:52 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (basesink, "in PLAYING using last %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (last));
|
2010-11-25 17:48:09 +00:00
|
|
|
}
|
|
|
|
} else {
|
2013-05-30 04:51:24 +00:00
|
|
|
/* convert position to stream time */
|
2011-05-13 16:07:24 +00:00
|
|
|
last = gst_segment_to_stream_time (segment, oformat, segment->position);
|
2012-11-20 15:19:52 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (basesink, "in using last %" G_GINT64_FORMAT, last);
|
2010-11-25 17:48:09 +00:00
|
|
|
}
|
|
|
|
|
2009-08-24 15:56:32 +00:00
|
|
|
/* need to release the object lock before we can get the time,
|
2008-10-20 15:18:14 +00:00
|
|
|
* a clock might take the LOCK of the provider, which could be
|
|
|
|
* a basesink subclass. */
|
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
|
2010-11-25 17:48:09 +00:00
|
|
|
if (last_seen) {
|
|
|
|
/* in EOS or when no valid stream_time, report the value of last seen
|
|
|
|
* timestamp */
|
|
|
|
if (last == -1) {
|
|
|
|
/* no timestamp, we need to ask upstream */
|
|
|
|
GST_DEBUG_OBJECT (basesink, "no last seen timestamp, asking upstream");
|
|
|
|
res = FALSE;
|
|
|
|
*upstream = TRUE;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
GST_DEBUG_OBJECT (basesink, "using last seen timestamp %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (last));
|
|
|
|
*cur = last;
|
|
|
|
} else {
|
2011-07-26 23:26:43 +00:00
|
|
|
if (oformat != GST_FORMAT_TIME) {
|
2011-05-13 16:07:24 +00:00
|
|
|
/* convert base, time and duration to time */
|
2011-07-26 23:26:43 +00:00
|
|
|
if (!gst_pad_query_convert (basesink->sinkpad, oformat, base,
|
|
|
|
GST_FORMAT_TIME, &base))
|
2010-11-25 17:48:09 +00:00
|
|
|
goto convert_failed;
|
|
|
|
if (!gst_pad_query_convert (basesink->sinkpad, oformat, duration,
|
2011-07-26 23:26:43 +00:00
|
|
|
GST_FORMAT_TIME, &duration))
|
2010-11-25 17:48:09 +00:00
|
|
|
goto convert_failed;
|
2011-07-26 23:26:43 +00:00
|
|
|
if (!gst_pad_query_convert (basesink->sinkpad, oformat, time,
|
|
|
|
GST_FORMAT_TIME, &time))
|
2010-11-25 17:48:09 +00:00
|
|
|
goto convert_failed;
|
2011-07-26 23:26:43 +00:00
|
|
|
if (!gst_pad_query_convert (basesink->sinkpad, oformat, last,
|
|
|
|
GST_FORMAT_TIME, &last))
|
2010-11-25 17:48:09 +00:00
|
|
|
goto convert_failed;
|
|
|
|
|
|
|
|
/* assume time format from now on */
|
2011-07-26 23:26:43 +00:00
|
|
|
oformat = GST_FORMAT_TIME;
|
2010-11-25 17:48:09 +00:00
|
|
|
}
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
|
2010-11-25 17:48:09 +00:00
|
|
|
if (!in_paused && with_clock) {
|
|
|
|
now = gst_clock_get_time (clock);
|
|
|
|
} else {
|
2011-05-13 16:07:24 +00:00
|
|
|
now = base_time;
|
|
|
|
base_time = 0;
|
2010-11-25 17:48:09 +00:00
|
|
|
}
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
|
2011-05-13 16:07:24 +00:00
|
|
|
/* subtract base time and base time from the clock time.
|
2010-11-25 17:48:09 +00:00
|
|
|
* Make sure we don't go negative. This is the current time in
|
|
|
|
* the segment which we need to scale with the combined
|
|
|
|
* rate and applied rate. */
|
2011-05-13 16:07:24 +00:00
|
|
|
base_time += base;
|
|
|
|
base_time += latency;
|
|
|
|
if (GST_CLOCK_DIFF (base_time, now) < 0)
|
|
|
|
base_time = now;
|
2010-11-25 17:48:09 +00:00
|
|
|
|
|
|
|
/* for negative rates we need to count back from the segment
|
|
|
|
* duration. */
|
|
|
|
if (rate < 0.0)
|
|
|
|
time += duration;
|
|
|
|
|
2011-05-13 16:07:24 +00:00
|
|
|
*cur = time + gst_guint64_to_gdouble (now - base_time) * rate;
|
2010-11-25 17:48:09 +00:00
|
|
|
|
2014-03-18 15:47:42 +00:00
|
|
|
/* never report more than last seen position */
|
2014-10-07 14:44:45 +00:00
|
|
|
if (last != -1) {
|
|
|
|
if (rate > 0.0)
|
|
|
|
*cur = MIN (last, *cur);
|
|
|
|
else
|
|
|
|
*cur = MAX (last, *cur);
|
|
|
|
}
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
|
2010-11-25 17:48:09 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink,
|
2011-05-13 16:07:24 +00:00
|
|
|
"now %" GST_TIME_FORMAT " - base_time %" GST_TIME_FORMAT " - base %"
|
2010-11-25 17:48:09 +00:00
|
|
|
GST_TIME_FORMAT " + time %" GST_TIME_FORMAT " last %" GST_TIME_FORMAT,
|
2011-05-13 16:07:24 +00:00
|
|
|
GST_TIME_ARGS (now), GST_TIME_ARGS (base_time), GST_TIME_ARGS (base),
|
2010-11-25 17:48:09 +00:00
|
|
|
GST_TIME_ARGS (time), GST_TIME_ARGS (last));
|
|
|
|
}
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
2008-10-20 15:18:14 +00:00
|
|
|
if (oformat != format) {
|
2010-11-25 17:48:09 +00:00
|
|
|
/* convert to final format */
|
2011-07-26 23:26:43 +00:00
|
|
|
if (!gst_pad_query_convert (basesink->sinkpad, oformat, *cur, format, cur))
|
2008-10-20 15:18:14 +00:00
|
|
|
goto convert_failed;
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
}
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
2008-10-20 15:18:14 +00:00
|
|
|
res = TRUE;
|
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
done:
|
|
|
|
GST_DEBUG_OBJECT (basesink, "res: %d, POSITION: %" GST_TIME_FORMAT,
|
|
|
|
res, GST_TIME_ARGS (*cur));
|
2010-11-25 17:48:09 +00:00
|
|
|
|
|
|
|
if (clock)
|
|
|
|
gst_object_unref (clock);
|
|
|
|
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
return res;
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
/* special cases */
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
wrong_state:
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
{
|
2008-10-06 08:58:25 +00:00
|
|
|
/* in NULL or READY we always return FALSE and -1 */
|
libs/gst/base/gstbasesink.c: Don't try to report a 0 position when we don't know, return -1 and FALSE instead. This m...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_do_sync), (gst_base_sink_preroll_object),
(gst_base_sink_event), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_change_state):
Don't try to report a 0 position when we don't know, return -1 and FALSE
instead. This mostly happens when we are prerolling.
Make sure we can report the right position before we post the ASYNC_DONE
message so that a message handler can query position without races.
* tests/check/generic/sinks.c: (send_eos), (GST_START_TEST),
(async_done_handoff), (async_done_func), (send_buffer),
(async_done_eos_func), (gst_sinks_suite):
Add two tests for the above.
2007-11-06 10:33:22 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "position in wrong state, return -1");
|
|
|
|
res = FALSE;
|
|
|
|
*cur = -1;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
|
|
|
goto done;
|
|
|
|
}
|
2008-10-20 15:18:14 +00:00
|
|
|
convert_failed:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (basesink, "convert failed, try upstream");
|
|
|
|
*upstream = TRUE;
|
2010-11-25 17:48:09 +00:00
|
|
|
res = FALSE;
|
|
|
|
goto done;
|
2008-10-20 15:18:14 +00:00
|
|
|
}
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
}
|
|
|
|
|
2010-04-15 07:36:52 +00:00
|
|
|
static gboolean
|
|
|
|
gst_base_sink_get_duration (GstBaseSink * basesink, GstFormat format,
|
|
|
|
gint64 * dur, gboolean * upstream)
|
|
|
|
{
|
|
|
|
gboolean res = FALSE;
|
|
|
|
|
2011-11-18 11:35:46 +00:00
|
|
|
if (basesink->pad_mode == GST_PAD_MODE_PULL) {
|
2010-04-15 07:36:52 +00:00
|
|
|
gint64 uduration;
|
|
|
|
|
|
|
|
/* get the duration in bytes, in pull mode that's all we are sure to
|
|
|
|
* know. We have to explicitly get this value from upstream instead of
|
|
|
|
* using our cached value because it might change. Duration caching
|
|
|
|
* should be done at a higher level. */
|
2011-07-26 23:26:43 +00:00
|
|
|
res =
|
2011-11-15 16:50:34 +00:00
|
|
|
gst_pad_peer_query_duration (basesink->sinkpad, GST_FORMAT_BYTES,
|
2011-07-26 23:26:43 +00:00
|
|
|
&uduration);
|
2010-04-15 07:36:52 +00:00
|
|
|
if (res) {
|
2011-05-13 16:07:24 +00:00
|
|
|
basesink->segment.duration = uduration;
|
2011-07-26 23:26:43 +00:00
|
|
|
if (format != GST_FORMAT_BYTES) {
|
2010-04-15 07:36:52 +00:00
|
|
|
/* convert to the requested format */
|
2011-07-26 23:26:43 +00:00
|
|
|
res =
|
|
|
|
gst_pad_query_convert (basesink->sinkpad, GST_FORMAT_BYTES,
|
|
|
|
uduration, format, dur);
|
2010-04-15 07:36:52 +00:00
|
|
|
} else {
|
|
|
|
*dur = uduration;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*upstream = FALSE;
|
|
|
|
} else {
|
|
|
|
*upstream = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2005-09-22 18:07:22 +00:00
|
|
|
static gboolean
|
2011-07-26 10:21:38 +00:00
|
|
|
default_element_query (GstElement * element, GstQuery * query)
|
2005-09-22 18:07:22 +00:00
|
|
|
{
|
|
|
|
gboolean res = FALSE;
|
|
|
|
|
|
|
|
GstBaseSink *basesink = GST_BASE_SINK (element);
|
|
|
|
|
2011-05-17 09:20:05 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
2005-09-22 18:07:22 +00:00
|
|
|
case GST_QUERY_POSITION:
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
{
|
|
|
|
gint64 cur = 0;
|
|
|
|
GstFormat format;
|
2008-10-06 08:58:25 +00:00
|
|
|
gboolean upstream = FALSE;
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
|
2011-05-17 09:20:05 +00:00
|
|
|
gst_query_parse_position (query, &format, NULL);
|
2005-10-20 17:18:12 +00:00
|
|
|
|
2010-04-14 14:46:55 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "position query in format %s",
|
|
|
|
gst_format_get_name (format));
|
2005-10-20 17:18:12 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
/* first try to get the position based on the clock */
|
2008-10-06 08:58:25 +00:00
|
|
|
if ((res =
|
|
|
|
gst_base_sink_get_position (basesink, format, &cur, &upstream))) {
|
2011-05-17 09:20:05 +00:00
|
|
|
gst_query_set_position (query, format, cur);
|
2008-10-06 08:58:25 +00:00
|
|
|
} else if (upstream) {
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
/* fallback to peer query */
|
2010-04-14 14:47:36 +00:00
|
|
|
res = gst_pad_peer_query (basesink->sinkpad, query);
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
}
|
2010-04-15 07:36:52 +00:00
|
|
|
if (!res) {
|
|
|
|
/* we can handle a few things if upstream failed */
|
|
|
|
if (format == GST_FORMAT_PERCENT) {
|
|
|
|
gint64 dur = 0;
|
|
|
|
|
|
|
|
res = gst_base_sink_get_position (basesink, GST_FORMAT_TIME, &cur,
|
|
|
|
&upstream);
|
|
|
|
if (!res && upstream) {
|
2011-07-26 23:26:43 +00:00
|
|
|
res =
|
2011-11-15 16:50:34 +00:00
|
|
|
gst_pad_peer_query_position (basesink->sinkpad, GST_FORMAT_TIME,
|
2010-04-15 07:36:52 +00:00
|
|
|
&cur);
|
|
|
|
}
|
|
|
|
if (res) {
|
|
|
|
res = gst_base_sink_get_duration (basesink, GST_FORMAT_TIME, &dur,
|
|
|
|
&upstream);
|
|
|
|
if (!res && upstream) {
|
2011-07-26 23:26:43 +00:00
|
|
|
res =
|
2011-11-15 16:50:34 +00:00
|
|
|
gst_pad_peer_query_duration (basesink->sinkpad,
|
2011-07-26 23:26:43 +00:00
|
|
|
GST_FORMAT_TIME, &dur);
|
2010-04-15 07:36:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (res) {
|
|
|
|
gint64 pos;
|
|
|
|
|
|
|
|
pos = gst_util_uint64_scale (100 * GST_FORMAT_PERCENT_SCALE, cur,
|
|
|
|
dur);
|
2011-05-17 09:20:05 +00:00
|
|
|
gst_query_set_position (query, GST_FORMAT_PERCENT, pos);
|
2010-04-15 07:36:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-09-22 18:07:22 +00:00
|
|
|
break;
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
}
|
2005-10-19 17:06:56 +00:00
|
|
|
case GST_QUERY_DURATION:
|
2008-10-17 13:27:59 +00:00
|
|
|
{
|
2010-04-15 07:36:52 +00:00
|
|
|
gint64 dur = 0;
|
|
|
|
GstFormat format;
|
|
|
|
gboolean upstream = FALSE;
|
2008-10-17 13:27:59 +00:00
|
|
|
|
2011-05-17 09:20:05 +00:00
|
|
|
gst_query_parse_duration (query, &format, NULL);
|
2008-10-17 13:27:59 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (basesink, "duration query in format %s",
|
|
|
|
gst_format_get_name (format));
|
|
|
|
|
2010-04-15 07:36:52 +00:00
|
|
|
if ((res =
|
|
|
|
gst_base_sink_get_duration (basesink, format, &dur, &upstream))) {
|
2011-05-17 09:20:05 +00:00
|
|
|
gst_query_set_duration (query, format, dur);
|
2010-04-15 07:36:52 +00:00
|
|
|
} else if (upstream) {
|
|
|
|
/* fallback to peer query */
|
2010-04-14 14:47:36 +00:00
|
|
|
res = gst_pad_peer_query (basesink->sinkpad, query);
|
2008-10-17 13:27:59 +00:00
|
|
|
}
|
2010-04-15 07:36:52 +00:00
|
|
|
if (!res) {
|
|
|
|
/* we can handle a few things if upstream failed */
|
|
|
|
if (format == GST_FORMAT_PERCENT) {
|
2011-05-17 09:20:05 +00:00
|
|
|
gst_query_set_duration (query, GST_FORMAT_PERCENT,
|
2010-04-15 07:36:52 +00:00
|
|
|
GST_FORMAT_PERCENT_MAX);
|
|
|
|
res = TRUE;
|
|
|
|
}
|
|
|
|
}
|
2005-10-19 17:06:56 +00:00
|
|
|
break;
|
2008-10-17 13:27:59 +00:00
|
|
|
}
|
2005-09-22 18:07:22 +00:00
|
|
|
case GST_QUERY_LATENCY:
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
{
|
2007-09-24 12:29:23 +00:00
|
|
|
gboolean live, us_live;
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
GstClockTime min, max;
|
|
|
|
|
2007-09-24 12:29:23 +00:00
|
|
|
if ((res = gst_base_sink_query_latency (basesink, &live, &us_live, &min,
|
|
|
|
&max))) {
|
2011-05-17 09:20:05 +00:00
|
|
|
gst_query_set_latency (query, live, min, max);
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
}
|
2005-09-22 18:07:22 +00:00
|
|
|
break;
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
}
|
2005-09-22 18:07:22 +00:00
|
|
|
case GST_QUERY_JITTER:
|
|
|
|
break;
|
|
|
|
case GST_QUERY_RATE:
|
2007-08-16 10:07:48 +00:00
|
|
|
/* gst_query_set_rate (query, basesink->segment_rate); */
|
2005-09-22 18:07:22 +00:00
|
|
|
res = TRUE;
|
|
|
|
break;
|
|
|
|
case GST_QUERY_SEGMENT:
|
|
|
|
{
|
2011-11-18 11:35:46 +00:00
|
|
|
if (basesink->pad_mode == GST_PAD_MODE_PULL) {
|
2013-07-29 10:10:45 +00:00
|
|
|
GstFormat format;
|
|
|
|
gint64 start, stop;
|
|
|
|
|
|
|
|
format = basesink->segment.format;
|
|
|
|
|
|
|
|
start =
|
|
|
|
gst_segment_to_stream_time (&basesink->segment, format,
|
|
|
|
basesink->segment.start);
|
|
|
|
if ((stop = basesink->segment.stop) == -1)
|
|
|
|
stop = basesink->segment.duration;
|
|
|
|
else
|
|
|
|
stop = gst_segment_to_stream_time (&basesink->segment, format, stop);
|
|
|
|
|
|
|
|
gst_query_set_segment (query, basesink->segment.rate, format, start,
|
|
|
|
stop);
|
2010-07-06 08:13:04 +00:00
|
|
|
res = TRUE;
|
|
|
|
} else {
|
|
|
|
res = gst_pad_peer_query (basesink->sinkpad, query);
|
|
|
|
}
|
2005-09-22 18:07:22 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-10-19 17:06:56 +00:00
|
|
|
case GST_QUERY_SEEKING:
|
2005-09-22 18:07:22 +00:00
|
|
|
case GST_QUERY_CONVERT:
|
|
|
|
case GST_QUERY_FORMATS:
|
|
|
|
default:
|
2010-04-14 14:47:36 +00:00
|
|
|
res = gst_pad_peer_query (basesink->sinkpad, query);
|
2005-09-22 18:07:22 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-04-14 14:46:55 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "query %s returns %d",
|
2011-05-17 09:20:05 +00:00
|
|
|
GST_QUERY_TYPE_NAME (query), res);
|
2005-09-22 18:07:22 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2015-03-13 18:53:11 +00:00
|
|
|
static void
|
|
|
|
gst_base_sink_drain (GstBaseSink * basesink)
|
|
|
|
{
|
|
|
|
GstBuffer *old;
|
2015-06-24 05:19:04 +00:00
|
|
|
GstBufferList *old_list;
|
2015-03-13 18:53:11 +00:00
|
|
|
|
|
|
|
GST_OBJECT_LOCK (basesink);
|
|
|
|
if ((old = basesink->priv->last_buffer))
|
|
|
|
basesink->priv->last_buffer = gst_buffer_copy_deep (old);
|
2015-06-24 05:19:04 +00:00
|
|
|
|
|
|
|
if ((old_list = basesink->priv->last_buffer_list))
|
|
|
|
basesink->priv->last_buffer_list = gst_buffer_list_copy_deep (old_list);
|
2015-03-13 18:53:11 +00:00
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
2015-06-24 05:19:04 +00:00
|
|
|
|
2015-03-13 18:53:11 +00:00
|
|
|
if (old)
|
|
|
|
gst_buffer_unref (old);
|
2015-06-24 05:19:04 +00:00
|
|
|
if (old_list)
|
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (old_list));
|
2015-03-13 18:53:11 +00:00
|
|
|
}
|
2011-07-26 10:21:38 +00:00
|
|
|
|
|
|
|
static gboolean
|
2011-12-02 22:13:23 +00:00
|
|
|
gst_base_sink_default_query (GstBaseSink * basesink, GstQuery * query)
|
2011-07-26 10:21:38 +00:00
|
|
|
{
|
|
|
|
gboolean res;
|
|
|
|
GstBaseSinkClass *bclass;
|
|
|
|
|
|
|
|
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_ALLOCATION:
|
|
|
|
{
|
2015-03-13 18:53:11 +00:00
|
|
|
gst_base_sink_drain (basesink);
|
2011-08-26 12:18:33 +00:00
|
|
|
if (bclass->propose_allocation)
|
|
|
|
res = bclass->propose_allocation (basesink, query);
|
2011-07-26 10:21:38 +00:00
|
|
|
else
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
2011-11-15 10:20:48 +00:00
|
|
|
case GST_QUERY_CAPS:
|
|
|
|
{
|
|
|
|
GstCaps *caps, *filter;
|
|
|
|
|
|
|
|
gst_query_parse_caps (query, &filter);
|
|
|
|
caps = gst_base_sink_query_caps (basesink, basesink->sinkpad, filter);
|
|
|
|
gst_query_set_caps_result (query, caps);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
res = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2012-02-10 10:24:28 +00:00
|
|
|
case GST_QUERY_ACCEPT_CAPS:
|
|
|
|
{
|
|
|
|
GstCaps *caps, *allowed;
|
|
|
|
gboolean subset;
|
|
|
|
|
|
|
|
/* slightly faster than the default implementation */
|
|
|
|
gst_query_parse_accept_caps (query, &caps);
|
|
|
|
allowed = gst_base_sink_query_caps (basesink, basesink->sinkpad, NULL);
|
|
|
|
subset = gst_caps_is_subset (caps, allowed);
|
2013-11-25 09:33:42 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "Checking if requested caps %" GST_PTR_FORMAT
|
|
|
|
" are a subset of pad caps %" GST_PTR_FORMAT " result %d", caps,
|
|
|
|
allowed, subset);
|
2012-04-13 09:58:49 +00:00
|
|
|
gst_caps_unref (allowed);
|
2012-02-10 10:24:28 +00:00
|
|
|
gst_query_set_accept_caps_result (query, subset);
|
|
|
|
res = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2012-03-14 15:27:31 +00:00
|
|
|
case GST_QUERY_DRAIN:
|
2014-03-24 15:34:27 +00:00
|
|
|
{
|
2015-03-13 18:53:11 +00:00
|
|
|
gst_base_sink_drain (basesink);
|
2012-03-14 15:27:31 +00:00
|
|
|
res = TRUE;
|
|
|
|
break;
|
2014-03-24 15:34:27 +00:00
|
|
|
}
|
2014-11-03 17:27:21 +00:00
|
|
|
case GST_QUERY_POSITION:
|
|
|
|
{
|
|
|
|
res = default_element_query (GST_ELEMENT (basesink), query);
|
|
|
|
break;
|
|
|
|
}
|
2011-07-26 10:21:38 +00:00
|
|
|
default:
|
2011-11-16 16:22:56 +00:00
|
|
|
res =
|
|
|
|
gst_pad_query_default (basesink->sinkpad, GST_OBJECT_CAST (basesink),
|
|
|
|
query);
|
2011-07-26 10:21:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-11-16 16:22:56 +00:00
|
|
|
gst_base_sink_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
2011-07-26 10:21:38 +00:00
|
|
|
{
|
|
|
|
GstBaseSink *basesink;
|
|
|
|
GstBaseSinkClass *bclass;
|
|
|
|
gboolean res;
|
|
|
|
|
2011-11-16 16:22:56 +00:00
|
|
|
basesink = GST_BASE_SINK_CAST (parent);
|
2011-07-26 10:21:38 +00:00
|
|
|
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
|
|
|
|
|
|
|
if (bclass->query)
|
|
|
|
res = bclass->query (basesink, query);
|
|
|
|
else
|
|
|
|
res = FALSE;
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2005-09-02 15:42:00 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_base_sink_change_state (GstElement * element, GstStateChange transition)
|
2005-03-28 14:54:33 +00:00
|
|
|
{
|
2005-09-02 15:42:00 +00:00
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
2005-07-10 12:03:13 +00:00
|
|
|
GstBaseSink *basesink = GST_BASE_SINK (element);
|
gst/base/: Make basesrc negotiate.
Original commit message from CVS:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_handle_object), (gst_base_sink_loop),
(gst_base_sink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasesrc.c: (gst_base_src_class_init),
(gst_base_src_init), (gst_base_src_setcaps),
(gst_base_src_getcaps), (gst_base_src_loop),
(gst_base_src_default_negotiate), (gst_base_src_negotiate),
(gst_base_src_start), (gst_base_src_change_state):
* gst/base/gstbasesrc.h:
Make basesrc negotiate.
Handle the case where preroll fails in basesink.
Update README.
2005-07-06 13:25:26 +00:00
|
|
|
GstBaseSinkClass *bclass;
|
2007-10-30 18:30:13 +00:00
|
|
|
GstBaseSinkPrivate *priv;
|
|
|
|
|
|
|
|
priv = basesink->priv;
|
gst/base/: Make basesrc negotiate.
Original commit message from CVS:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_handle_object), (gst_base_sink_loop),
(gst_base_sink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasesrc.c: (gst_base_src_class_init),
(gst_base_src_init), (gst_base_src_setcaps),
(gst_base_src_getcaps), (gst_base_src_loop),
(gst_base_src_default_negotiate), (gst_base_src_negotiate),
(gst_base_src_start), (gst_base_src_change_state):
* gst/base/gstbasesrc.h:
Make basesrc negotiate.
Handle the case where preroll fails in basesink.
Update README.
2005-07-06 13:25:26 +00:00
|
|
|
|
2005-07-10 12:03:13 +00:00
|
|
|
bclass = GST_BASE_SINK_GET_CLASS (basesink);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:42:00 +00:00
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
gst/base/: Make basesrc negotiate.
Original commit message from CVS:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_handle_object), (gst_base_sink_loop),
(gst_base_sink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasesrc.c: (gst_base_src_class_init),
(gst_base_src_init), (gst_base_src_setcaps),
(gst_base_src_getcaps), (gst_base_src_loop),
(gst_base_src_default_negotiate), (gst_base_src_negotiate),
(gst_base_src_start), (gst_base_src_change_state):
* gst/base/gstbasesrc.h:
Make basesrc negotiate.
Handle the case where preroll fails in basesink.
Update README.
2005-07-06 13:25:26 +00:00
|
|
|
if (bclass->start)
|
|
|
|
if (!bclass->start (basesink))
|
|
|
|
goto start_failed;
|
2005-03-28 14:54:33 +00:00
|
|
|
break;
|
2005-09-02 15:42:00 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2005-03-28 14:54:33 +00:00
|
|
|
/* need to complete preroll before this state change completes, there
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
* is no data flow in READY so we can safely assume we need to preroll. */
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_LOCK (basesink);
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "READY to PAUSED");
|
2008-08-19 16:47:07 +00:00
|
|
|
basesink->have_newsegment = FALSE;
|
2005-11-29 17:13:44 +00:00
|
|
|
gst_segment_init (&basesink->segment, GST_FORMAT_UNDEFINED);
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
basesink->offset = 0;
|
|
|
|
basesink->have_preroll = FALSE;
|
2009-05-19 17:45:06 +00:00
|
|
|
priv->step_unlock = FALSE;
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
basesink->need_preroll = TRUE;
|
|
|
|
basesink->playing_async = TRUE;
|
2009-10-09 14:11:27 +00:00
|
|
|
priv->current_sstart = GST_CLOCK_TIME_NONE;
|
|
|
|
priv->current_sstop = GST_CLOCK_TIME_NONE;
|
|
|
|
priv->eos_rtime = GST_CLOCK_TIME_NONE;
|
2007-10-30 18:30:13 +00:00
|
|
|
priv->latency = 0;
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
basesink->eos = FALSE;
|
2007-10-30 18:30:13 +00:00
|
|
|
priv->received_eos = FALSE;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
gst_base_sink_reset_qos (basesink);
|
2012-11-09 15:50:50 +00:00
|
|
|
priv->rc_next = -1;
|
2007-10-30 18:30:13 +00:00
|
|
|
priv->commited = FALSE;
|
2009-02-03 14:27:34 +00:00
|
|
|
priv->call_preroll = TRUE;
|
2009-05-14 17:29:08 +00:00
|
|
|
priv->current_step.valid = FALSE;
|
|
|
|
priv->pending_step.valid = FALSE;
|
2007-10-30 18:30:13 +00:00
|
|
|
if (priv->async_enabled) {
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "doing async state change");
|
|
|
|
/* when async enabled, post async-start message and return ASYNC from
|
|
|
|
* the state change function */
|
|
|
|
ret = GST_STATE_CHANGE_ASYNC;
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
2011-06-08 11:40:32 +00:00
|
|
|
gst_message_new_async_start (GST_OBJECT_CAST (basesink)));
|
2007-09-14 23:06:31 +00:00
|
|
|
} else {
|
2007-10-30 18:30:13 +00:00
|
|
|
priv->have_latency = TRUE;
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
}
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (basesink);
|
2005-03-28 14:54:33 +00:00
|
|
|
break;
|
2005-09-02 15:42:00 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_LOCK (basesink);
|
2011-07-04 10:58:54 +00:00
|
|
|
g_atomic_int_set (&basesink->priv->to_playing, TRUE);
|
2007-06-19 21:58:30 +00:00
|
|
|
if (!gst_base_sink_needs_preroll (basesink)) {
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "PAUSED to PLAYING, don't need preroll");
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
/* no preroll needed anymore now. */
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
basesink->playing_async = FALSE;
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
basesink->need_preroll = FALSE;
|
|
|
|
if (basesink->eos) {
|
2008-11-04 15:56:55 +00:00
|
|
|
GstMessage *message;
|
|
|
|
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
/* need to post EOS message here */
|
2005-10-21 17:53:31 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "Now posting EOS");
|
2008-11-04 15:56:55 +00:00
|
|
|
message = gst_message_new_eos (GST_OBJECT_CAST (basesink));
|
|
|
|
gst_message_set_seqnum (message, basesink->priv->seqnum);
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink), message);
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (basesink, "signal preroll");
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_SIGNAL (basesink);
|
2005-10-21 17:53:31 +00:00
|
|
|
}
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
} else {
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "PAUSED to PLAYING, we are not prerolled");
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
basesink->need_preroll = TRUE;
|
|
|
|
basesink->playing_async = TRUE;
|
2009-02-03 14:27:34 +00:00
|
|
|
priv->call_preroll = TRUE;
|
2007-10-30 18:30:13 +00:00
|
|
|
priv->commited = FALSE;
|
|
|
|
if (priv->async_enabled) {
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "doing async state change");
|
|
|
|
ret = GST_STATE_CHANGE_ASYNC;
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
2011-06-08 11:40:32 +00:00
|
|
|
gst_message_new_async_start (GST_OBJECT_CAST (basesink)));
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
}
|
2005-10-21 17:53:31 +00:00
|
|
|
}
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (basesink);
|
2005-03-28 14:54:33 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-08-26 14:21:43 +00:00
|
|
|
{
|
2005-09-02 15:42:00 +00:00
|
|
|
GstStateChangeReturn bret;
|
2005-08-26 14:21:43 +00:00
|
|
|
|
2005-09-02 15:42:00 +00:00
|
|
|
bret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
if (G_UNLIKELY (bret == GST_STATE_CHANGE_FAILURE))
|
2005-08-26 14:21:43 +00:00
|
|
|
goto activate_failed;
|
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
2011-07-13 09:39:15 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
|
|
|
/* completed transition, so need not be marked any longer
|
|
|
|
* And it should be unmarked, since e.g. losing our position upon flush
|
|
|
|
* does not really change state to PAUSED ... */
|
|
|
|
g_atomic_int_set (&basesink->priv->to_playing, FALSE);
|
|
|
|
break;
|
2005-09-02 15:42:00 +00:00
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
2011-07-04 10:58:54 +00:00
|
|
|
g_atomic_int_set (&basesink->priv->to_playing, FALSE);
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "PLAYING to PAUSED");
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
/* FIXME, make sure we cannot enter _render first */
|
2006-05-08 11:49:43 +00:00
|
|
|
|
|
|
|
/* we need to call ::unlock before locking PREROLL_LOCK
|
|
|
|
* since we lock it before going into ::render */
|
|
|
|
if (bclass->unlock)
|
|
|
|
bclass->unlock (basesink);
|
|
|
|
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_LOCK (basesink);
|
2009-11-28 21:29:29 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "got preroll lock");
|
libs/gst/base/: Add ::unlock_stop to basesrc and basesink. This allows an opportunity for sub-classes to correctly cl...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_set_flushing),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
* libs/gst/base/gstbasesrc.c: (gst_base_src_perform_seek),
(gst_base_src_default_event), (gst_base_src_unlock_stop),
(gst_base_src_deactivate):
* libs/gst/base/gstbasesrc.h:
Add ::unlock_stop to basesrc and basesink. This allows an opportunity
for sub-classes to correctly clear any state they set trying to
unlock, such as clearing out unlock commands from a command fd.
* plugins/elements/gstfdsink.c: (gst_fd_sink_class_init),
(gst_fd_sink_render), (gst_fd_sink_unlock),
(gst_fd_sink_unlock_stop):
* plugins/elements/gstfdsrc.c: (gst_fd_src_class_init),
(gst_fd_src_init), (gst_fd_src_unlock), (gst_fd_src_unlock_stop),
(gst_fd_src_create), (gst_fd_src_get_size), (gst_fd_src_do_seek):
Implement unlock_stop in fdsrc and fdsink.
Implement seeking in fdsrc when a seekable fd is passed, as in
gst-launch-0.10 fdsrc ! ... ! xvimagesink < /path/to/file
2007-03-19 15:01:40 +00:00
|
|
|
/* now that we have the PREROLL lock, clear our unlock request */
|
|
|
|
if (bclass->unlock_stop)
|
|
|
|
bclass->unlock_stop (basesink);
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
if (basesink->clock_id) {
|
2009-11-28 21:29:29 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "unschedule clock");
|
2005-03-28 14:54:33 +00:00
|
|
|
gst_clock_id_unschedule (basesink->clock_id);
|
|
|
|
}
|
|
|
|
|
libs/gst/base/gstbasesink.c: Basesink cleanups, remove some old code.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_preroll_queue_empty), (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event),
(gst_base_sink_is_prerolled), (gst_base_sink_wait),
(gst_base_sink_do_sync), (gst_base_sink_handle_event),
(gst_base_sink_handle_buffer), (gst_base_sink_set_flushing),
(gst_base_sink_deactivate), (gst_base_sink_activate),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Basesink cleanups, remove some old code.
Handle the case where a subclass can preroll in the render
method (mostly audiosinks).
Handle more events.
Remove some locks around variables that are now protected
with the PREROLL_LOCK (clock_id, flushing, ..).
Optimize position query some more, do correct locking.
Remove old code to push queue in state change, this is not
needed anymore since preroll blocks on all prerollable items
now.
Almost implemented as described in design doc.
2006-01-30 16:07:48 +00:00
|
|
|
/* if we don't have a preroll buffer we need to wait for a preroll and
|
|
|
|
* return ASYNC. */
|
2007-06-19 21:58:30 +00:00
|
|
|
if (!gst_base_sink_needs_preroll (basesink)) {
|
2007-02-28 16:46:07 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "PLAYING to PAUSED, we are prerolled");
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
basesink->playing_async = FALSE;
|
2015-03-11 15:36:29 +00:00
|
|
|
basesink->need_preroll = FALSE;
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
} else {
|
2007-08-09 21:50:19 +00:00
|
|
|
if (GST_STATE_TARGET (GST_ELEMENT (basesink)) <= GST_STATE_READY) {
|
2009-11-28 21:29:29 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "element is <= READY");
|
2007-08-09 21:50:19 +00:00
|
|
|
ret = GST_STATE_CHANGE_SUCCESS;
|
|
|
|
} else {
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink,
|
|
|
|
"PLAYING to PAUSED, we are not prerolled");
|
2007-08-09 21:50:19 +00:00
|
|
|
basesink->playing_async = TRUE;
|
2015-03-11 15:36:29 +00:00
|
|
|
basesink->need_preroll = TRUE;
|
2007-10-30 18:30:13 +00:00
|
|
|
priv->commited = FALSE;
|
2009-02-03 14:27:34 +00:00
|
|
|
priv->call_preroll = TRUE;
|
2007-10-30 18:30:13 +00:00
|
|
|
if (priv->async_enabled) {
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "doing async state change");
|
|
|
|
ret = GST_STATE_CHANGE_ASYNC;
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
2011-06-08 11:40:32 +00:00
|
|
|
gst_message_new_async_start (GST_OBJECT_CAST (basesink)));
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
}
|
2007-08-09 21:50:19 +00:00
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|
2006-04-28 13:25:58 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "rendered: %" G_GUINT64_FORMAT
|
2007-10-30 18:30:13 +00:00
|
|
|
", dropped: %" G_GUINT64_FORMAT, priv->rendered, priv->dropped);
|
2006-04-28 13:25:58 +00:00
|
|
|
|
libs/gst/base/gstbasesink.c: More QoS measurements as described in the design doc.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_do_sync),
(gst_base_sink_record_qos_observation),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_change_state):
More QoS measurements as described in the design doc.
Get rid of ringbuffer with observations, running average is
more simple and equally good.
Calculates valid proportion now.
Added beginning of flood measurement.
2006-03-30 16:36:12 +00:00
|
|
|
gst_base_sink_reset_qos (basesink);
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (basesink);
|
2005-03-28 14:54:33 +00:00
|
|
|
break;
|
2005-09-02 15:42:00 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_LOCK (basesink);
|
2011-09-07 11:14:38 +00:00
|
|
|
/* start by resetting our position state with the object lock so that the
|
2008-08-19 16:47:07 +00:00
|
|
|
* position query gets the right idea. We do this before we post the
|
|
|
|
* messages so that the message handlers pick this up. */
|
|
|
|
GST_OBJECT_LOCK (basesink);
|
|
|
|
basesink->have_newsegment = FALSE;
|
2009-10-09 14:11:27 +00:00
|
|
|
priv->current_sstart = GST_CLOCK_TIME_NONE;
|
|
|
|
priv->current_sstop = GST_CLOCK_TIME_NONE;
|
2008-08-19 16:47:07 +00:00
|
|
|
priv->have_latency = FALSE;
|
2010-12-05 14:58:48 +00:00
|
|
|
if (priv->cached_clock_id) {
|
|
|
|
gst_clock_id_unref (priv->cached_clock_id);
|
|
|
|
priv->cached_clock_id = NULL;
|
|
|
|
}
|
2011-12-01 15:46:06 +00:00
|
|
|
gst_caps_replace (&basesink->priv->caps, NULL);
|
2008-08-19 16:47:07 +00:00
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
|
|
|
|
|
|
|
gst_base_sink_set_last_buffer (basesink, NULL);
|
2015-06-22 11:02:55 +00:00
|
|
|
gst_base_sink_set_last_buffer_list (basesink, NULL);
|
2009-02-03 14:27:34 +00:00
|
|
|
priv->call_preroll = FALSE;
|
2008-08-19 16:47:07 +00:00
|
|
|
|
2007-10-30 18:30:13 +00:00
|
|
|
if (!priv->commited) {
|
|
|
|
if (priv->async_enabled) {
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "PAUSED to READY, posting async-done");
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
|
|
|
gst_message_new_state_changed (GST_OBJECT_CAST (basesink),
|
|
|
|
GST_STATE_PLAYING, GST_STATE_PAUSED, GST_STATE_READY));
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
2012-06-13 08:52:48 +00:00
|
|
|
gst_message_new_async_done (GST_OBJECT_CAST (basesink),
|
|
|
|
GST_CLOCK_TIME_NONE));
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
}
|
2007-10-30 18:30:13 +00:00
|
|
|
priv->commited = TRUE;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (basesink, "PAUSED to READY, don't need_preroll");
|
|
|
|
}
|
2011-03-04 16:25:02 +00:00
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (basesink);
|
2005-03-28 14:54:33 +00:00
|
|
|
break;
|
2005-09-02 15:42:00 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
2007-10-30 18:30:13 +00:00
|
|
|
if (bclass->stop) {
|
gst/base/: Make basesrc negotiate.
Original commit message from CVS:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_handle_object), (gst_base_sink_loop),
(gst_base_sink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasesrc.c: (gst_base_src_class_init),
(gst_base_src_init), (gst_base_src_setcaps),
(gst_base_src_getcaps), (gst_base_src_loop),
(gst_base_src_default_negotiate), (gst_base_src_negotiate),
(gst_base_src_start), (gst_base_src_change_state):
* gst/base/gstbasesrc.h:
Make basesrc negotiate.
Handle the case where preroll fails in basesink.
Update README.
2005-07-06 13:25:26 +00:00
|
|
|
if (!bclass->stop (basesink)) {
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
GST_WARNING_OBJECT (basesink, "failed to stop");
|
gst/base/: Make basesrc negotiate.
Original commit message from CVS:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_handle_object), (gst_base_sink_loop),
(gst_base_sink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasesrc.c: (gst_base_src_class_init),
(gst_base_src_init), (gst_base_src_setcaps),
(gst_base_src_getcaps), (gst_base_src_loop),
(gst_base_src_default_negotiate), (gst_base_src_negotiate),
(gst_base_src_start), (gst_base_src_change_state):
* gst/base/gstbasesrc.h:
Make basesrc negotiate.
Handle the case where preroll fails in basesink.
Update README.
2005-07-06 13:25:26 +00:00
|
|
|
}
|
2007-10-30 18:30:13 +00:00
|
|
|
}
|
|
|
|
gst_base_sink_set_last_buffer (basesink, NULL);
|
2015-06-22 11:02:55 +00:00
|
|
|
gst_base_sink_set_last_buffer_list (basesink, NULL);
|
2009-02-03 14:27:34 +00:00
|
|
|
priv->call_preroll = FALSE;
|
2005-03-28 14:54:33 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
gst/base/: Make basesrc negotiate.
Original commit message from CVS:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_handle_object), (gst_base_sink_loop),
(gst_base_sink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasesrc.c: (gst_base_src_class_init),
(gst_base_src_init), (gst_base_src_setcaps),
(gst_base_src_getcaps), (gst_base_src_loop),
(gst_base_src_default_negotiate), (gst_base_src_negotiate),
(gst_base_src_start), (gst_base_src_change_state):
* gst/base/gstbasesrc.h:
Make basesrc negotiate.
Handle the case where preroll fails in basesink.
Update README.
2005-07-06 13:25:26 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
start_failed:
|
|
|
|
{
|
2005-09-09 18:05:40 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink, "failed to start");
|
2016-05-14 14:31:51 +00:00
|
|
|
/* subclass is supposed to post a message but we post one as a fallback
|
|
|
|
* just in case */
|
|
|
|
GST_ELEMENT_ERROR (basesink, CORE, STATE_CHANGE, (NULL),
|
|
|
|
("Failed to start"));
|
2005-09-02 15:42:00 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
gst/base/: Make basesrc negotiate.
Original commit message from CVS:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_handle_object), (gst_base_sink_loop),
(gst_base_sink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasesrc.c: (gst_base_src_class_init),
(gst_base_src_init), (gst_base_src_setcaps),
(gst_base_src_getcaps), (gst_base_src_loop),
(gst_base_src_default_negotiate), (gst_base_src_negotiate),
(gst_base_src_start), (gst_base_src_change_state):
* gst/base/gstbasesrc.h:
Make basesrc negotiate.
Handle the case where preroll fails in basesink.
Update README.
2005-07-06 13:25:26 +00:00
|
|
|
}
|
2005-08-26 14:21:43 +00:00
|
|
|
activate_failed:
|
|
|
|
{
|
2005-09-09 18:05:40 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink,
|
|
|
|
"element failed to change states -- activation problem?");
|
2005-09-02 15:42:00 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
2005-08-26 14:21:43 +00:00
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|