An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2005 Wim Taymans <wim@fluendo.com>
|
|
|
|
*
|
2009-09-09 14:19:32 +00:00
|
|
|
* gstbaseaudiosink.c:
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +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
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2006-09-27 11:05:08 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstbaseaudiosink
|
|
|
|
* @short_description: Base class for audio sinks
|
|
|
|
* @see_also: #GstAudioSink, #GstRingBuffer.
|
|
|
|
*
|
|
|
|
* This is the base class for audio sinks. Subclasses need to implement the
|
|
|
|
* ::create_ringbuffer vmethod. This base class will then take care of
|
|
|
|
* writing samples to the ringbuffer, synchronisation, clipping and flushing.
|
|
|
|
*
|
|
|
|
* Last reviewed on 2006-09-27 (0.10.12)
|
|
|
|
*/
|
|
|
|
|
2005-04-28 16:15:42 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
#include "gstbaseaudiosink.h"
|
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_base_audio_sink_debug);
|
|
|
|
#define GST_CAT_DEFAULT gst_base_audio_sink_debug
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
#define GST_BASE_AUDIO_SINK_GET_PRIVATE(obj) \
|
|
|
|
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BASE_AUDIO_SINK, GstBaseAudioSinkPrivate))
|
|
|
|
|
|
|
|
struct _GstBaseAudioSinkPrivate
|
|
|
|
{
|
|
|
|
/* upstream latency */
|
|
|
|
GstClockTime us_latency;
|
|
|
|
/* the clock slaving algorithm in use */
|
|
|
|
GstBaseAudioSinkSlaveMethod slave_method;
|
|
|
|
/* running average of clock skew */
|
|
|
|
GstClockTimeDiff avg_skew;
|
2007-09-03 19:17:33 +00:00
|
|
|
/* the number of samples we aligned last time */
|
|
|
|
gint64 last_align;
|
2008-05-20 11:09:06 +00:00
|
|
|
|
|
|
|
gboolean sync_latency;
|
2008-11-25 10:32:49 +00:00
|
|
|
|
|
|
|
GstClockTime eos_time;
|
2009-09-10 10:38:16 +00:00
|
|
|
|
2011-05-21 12:49:20 +00:00
|
|
|
/* number of microseconds we allow clock slaving to drift
|
2009-11-04 15:16:31 +00:00
|
|
|
* before resyncing */
|
|
|
|
guint64 drift_tolerance;
|
2011-05-21 12:49:20 +00:00
|
|
|
|
|
|
|
/* number of nanoseconds we allow timestamps to drift
|
|
|
|
* before resyncing */
|
|
|
|
GstClockTime alignment_threshold;
|
2011-05-02 10:05:28 +00:00
|
|
|
|
|
|
|
/* time of the previous detected discont candidate */
|
|
|
|
GstClockTime discont_time;
|
|
|
|
|
|
|
|
/* number of nanoseconds to wait until creating a discontinuity */
|
|
|
|
GstClockTime discont_wait;
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
};
|
|
|
|
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
/* BaseAudioSink signals and args */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2006-06-03 21:06:49 +00:00
|
|
|
/* FIXME: 0.11, store the buffer_time and latency_time in nanoseconds */
|
|
|
|
#define DEFAULT_BUFFER_TIME ((200 * GST_MSECOND) / GST_USECOND)
|
|
|
|
#define DEFAULT_LATENCY_TIME ((10 * GST_MSECOND) / GST_USECOND)
|
2005-12-06 19:42:02 +00:00
|
|
|
#define DEFAULT_PROVIDE_CLOCK TRUE
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
#define DEFAULT_SLAVE_METHOD GST_BASE_AUDIO_SINK_SLAVE_SKEW
|
gst-libs/gst/audio/gstaudioclock.c: This clock can be slaved to a master clock now.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudioclock.c: (gst_audio_clock_init):
This clock can be slaved to a master clock now.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_dispose), (gst_base_audio_sink_provide_clock),
(gst_base_audio_sink_set_clock),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_preroll),
(gst_base_audio_sink_render), (gst_base_audio_sink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Handle slaving the internal clock to the clock selected in the
pipeline.
Add property to make the basesink not provide a clock.
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_class_init), (gst_base_rtp_depayload_init),
(gst_base_rtp_depayload_wait):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
We can use the clock in GstElement, no need to store it ourselves.
2005-11-22 18:32:09 +00:00
|
|
|
|
2009-01-21 11:33:59 +00:00
|
|
|
/* FIXME, enable pull mode when clock slaving and trick modes are figured out */
|
|
|
|
#define DEFAULT_CAN_ACTIVATE_PULL FALSE
|
|
|
|
|
2011-05-02 10:05:28 +00:00
|
|
|
/* when timestamps drift for more than 40ms we resync. This should
|
|
|
|
* be anough to compensate for timestamp rounding errors. */
|
|
|
|
#define DEFAULT_ALIGNMENT_THRESHOLD (40 * GST_MSECOND)
|
|
|
|
|
2011-05-21 12:49:20 +00:00
|
|
|
/* when clock slaving drift for more than 40ms we resync. This is
|
2009-11-04 15:16:31 +00:00
|
|
|
* a reasonable default */
|
2009-12-19 21:40:44 +00:00
|
|
|
#define DEFAULT_DRIFT_TOLERANCE ((40 * GST_MSECOND) / GST_USECOND)
|
2009-11-04 15:16:31 +00:00
|
|
|
|
2011-05-02 10:05:28 +00:00
|
|
|
/* allow for one second before resyncing to see if the timestamps drift will
|
|
|
|
* fix itself, or is a permanent offset */
|
|
|
|
#define DEFAULT_DISCONT_WAIT (1 * GST_SECOND)
|
2011-05-21 12:49:20 +00:00
|
|
|
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2009-11-04 15:16:31 +00:00
|
|
|
|
2005-04-28 16:15:42 +00:00
|
|
|
PROP_BUFFER_TIME,
|
|
|
|
PROP_LATENCY_TIME,
|
gst-libs/gst/audio/gstaudioclock.c: This clock can be slaved to a master clock now.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudioclock.c: (gst_audio_clock_init):
This clock can be slaved to a master clock now.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_dispose), (gst_base_audio_sink_provide_clock),
(gst_base_audio_sink_set_clock),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_preroll),
(gst_base_audio_sink_render), (gst_base_audio_sink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Handle slaving the internal clock to the clock selected in the
pipeline.
Add property to make the basesink not provide a clock.
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_class_init), (gst_base_rtp_depayload_init),
(gst_base_rtp_depayload_wait):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
We can use the clock in GstElement, no need to store it ourselves.
2005-11-22 18:32:09 +00:00
|
|
|
PROP_PROVIDE_CLOCK,
|
2009-01-21 11:33:59 +00:00
|
|
|
PROP_SLAVE_METHOD,
|
2009-11-04 15:16:31 +00:00
|
|
|
PROP_CAN_ACTIVATE_PULL,
|
2011-05-21 12:49:20 +00:00
|
|
|
PROP_ALIGNMENT_THRESHOLD,
|
2009-11-04 15:16:31 +00:00
|
|
|
PROP_DRIFT_TOLERANCE,
|
2011-05-02 10:05:28 +00:00
|
|
|
PROP_DISCONT_WAIT,
|
2009-11-04 15:16:31 +00:00
|
|
|
|
|
|
|
PROP_LAST
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
};
|
|
|
|
|
2008-12-13 06:57:09 +00:00
|
|
|
GType
|
|
|
|
gst_base_audio_sink_slave_method_get_type (void)
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
{
|
2010-10-08 08:48:50 +00:00
|
|
|
static volatile gsize slave_method_type = 0;
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
static const GEnumValue slave_method[] = {
|
2010-10-08 08:45:30 +00:00
|
|
|
{GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE, "GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE",
|
|
|
|
"resample"},
|
|
|
|
{GST_BASE_AUDIO_SINK_SLAVE_SKEW, "GST_BASE_AUDIO_SINK_SLAVE_SKEW", "skew"},
|
|
|
|
{GST_BASE_AUDIO_SINK_SLAVE_NONE, "GST_BASE_AUDIO_SINK_SLAVE_NONE", "none"},
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
{0, NULL, NULL},
|
|
|
|
};
|
|
|
|
|
2010-10-08 08:48:50 +00:00
|
|
|
if (g_once_init_enter (&slave_method_type)) {
|
|
|
|
GType tmp =
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
g_enum_register_static ("GstBaseAudioSinkSlaveMethod", slave_method);
|
2010-10-08 08:48:50 +00:00
|
|
|
g_once_init_leave (&slave_method_type, tmp);
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
}
|
2010-10-08 08:48:50 +00:00
|
|
|
|
|
|
|
return (GType) slave_method_type;
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-04-19 08:52:00 +00:00
|
|
|
#define _do_init \
|
2005-07-10 12:03:58 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_base_audio_sink_debug, "baseaudiosink", 0, "baseaudiosink element");
|
2011-04-19 08:52:00 +00:00
|
|
|
#define gst_base_audio_sink_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstBaseAudioSink, gst_base_audio_sink,
|
2005-07-10 12:03:58 +00:00
|
|
|
GST_TYPE_BASE_SINK, _do_init);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
static void gst_base_audio_sink_dispose (GObject * object);
|
2005-06-29 11:17:33 +00:00
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
static void gst_base_audio_sink_set_property (GObject * object, guint prop_id,
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
const GValue * value, GParamSpec * pspec);
|
2005-07-10 12:03:58 +00:00
|
|
|
static void gst_base_audio_sink_get_property (GObject * object, guint prop_id,
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
2011-02-23 12:42:16 +00:00
|
|
|
#if 0
|
2006-03-23 16:24:23 +00:00
|
|
|
static GstStateChangeReturn gst_base_audio_sink_async_play (GstBaseSink *
|
|
|
|
basesink);
|
2011-02-23 12:42:16 +00:00
|
|
|
#endif
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn gst_base_audio_sink_change_state (GstElement *
|
|
|
|
element, GstStateChange transition);
|
2007-01-06 17:28:40 +00:00
|
|
|
static gboolean gst_base_audio_sink_activate_pull (GstBaseSink * basesink,
|
|
|
|
gboolean active);
|
2011-05-17 09:25:31 +00:00
|
|
|
static gboolean gst_base_audio_sink_query (GstElement * element, GstQuery *
|
2007-02-15 12:06:25 +00:00
|
|
|
query);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
2005-09-28 13:41:29 +00:00
|
|
|
static GstClock *gst_base_audio_sink_provide_clock (GstElement * elem);
|
2005-07-10 12:03:58 +00:00
|
|
|
static GstClockTime gst_base_audio_sink_get_time (GstClock * clock,
|
2005-04-28 16:15:42 +00:00
|
|
|
GstBaseAudioSink * sink);
|
2005-07-20 09:08:05 +00:00
|
|
|
static void gst_base_audio_sink_callback (GstRingBuffer * rbuf, guint8 * data,
|
|
|
|
guint len, gpointer user_data);
|
2005-04-28 16:15:42 +00:00
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
static GstFlowReturn gst_base_audio_sink_preroll (GstBaseSink * bsink,
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
GstBuffer * buffer);
|
2005-07-10 12:03:58 +00:00
|
|
|
static GstFlowReturn gst_base_audio_sink_render (GstBaseSink * bsink,
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
GstBuffer * buffer);
|
2005-07-10 12:03:58 +00:00
|
|
|
static gboolean gst_base_audio_sink_event (GstBaseSink * bsink,
|
|
|
|
GstEvent * event);
|
|
|
|
static void gst_base_audio_sink_get_times (GstBaseSink * bsink,
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
|
2005-07-10 12:03:58 +00:00
|
|
|
static gboolean gst_base_audio_sink_setcaps (GstBaseSink * bsink,
|
|
|
|
GstCaps * caps);
|
2007-01-12 21:19:35 +00:00
|
|
|
static void gst_base_audio_sink_fixate (GstBaseSink * bsink, GstCaps * caps);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
2011-07-26 10:37:04 +00:00
|
|
|
static gboolean gst_base_audio_sink_query_pad (GstBaseSink * bsink,
|
|
|
|
GstQuery * query);
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
|
|
|
|
|
gst-libs/gst/audio/: Do the delay calculation in the source/sink base classes as this is specific for the capture/pla...
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_callback):
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time), (gst_base_audio_src_fixate),
(gst_base_audio_src_get_times), (gst_base_audio_src_get_offset),
(gst_base_audio_src_create), (gst_base_audio_src_change_state):
Do the delay calculation in the source/sink base classes as this is
specific for the capture/playback mode.
Try to fixate a bit better, like round depth up to a multiple of 8
bigger than width.
Handle underruns correctly by marking DISCONT on buffers and adjusting
timestamps to handle the gap.
Set offset/offset_end correctly on buffers.
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_pause),
(gst_ring_buffer_samples_done), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
Remove resync and underrun recovery from the ringbuffer.
Fix ringbuffer read code on under/overrun.
2006-09-15 14:53:44 +00:00
|
|
|
/* static guint gst_base_audio_sink_signals[LAST_SIGNAL] = { 0 }; */
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
|
|
|
static void
|
2005-07-10 12:03:58 +00:00
|
|
|
gst_base_audio_sink_class_init (GstBaseAudioSinkClass * klass)
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
GstBaseSinkClass *gstbasesink_class;
|
|
|
|
|
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
|
|
|
gstbasesink_class = (GstBaseSinkClass *) klass;
|
|
|
|
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
g_type_class_add_private (klass, sizeof (GstBaseAudioSinkPrivate));
|
|
|
|
|
2009-10-28 00:59:35 +00:00
|
|
|
gobject_class->set_property = gst_base_audio_sink_set_property;
|
|
|
|
gobject_class->get_property = gst_base_audio_sink_get_property;
|
|
|
|
gobject_class->dispose = gst_base_audio_sink_dispose;
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
2006-07-06 15:54:50 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_BUFFER_TIME,
|
2006-06-03 21:06:49 +00:00
|
|
|
g_param_spec_int64 ("buffer-time", "Buffer Time",
|
|
|
|
"Size of audio buffer in microseconds", 1,
|
2008-03-22 15:00:53 +00:00
|
|
|
G_MAXINT64, DEFAULT_BUFFER_TIME,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-06-03 21:06:49 +00:00
|
|
|
|
2006-07-06 15:54:50 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_LATENCY_TIME,
|
2006-06-03 21:06:49 +00:00
|
|
|
g_param_spec_int64 ("latency-time", "Latency Time",
|
|
|
|
"Audio latency in microseconds", 1,
|
2008-03-22 15:00:53 +00:00
|
|
|
G_MAXINT64, DEFAULT_LATENCY_TIME,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-06-03 21:06:49 +00:00
|
|
|
|
2006-07-06 15:54:50 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_PROVIDE_CLOCK,
|
gst-libs/gst/audio/gstaudioclock.c: This clock can be slaved to a master clock now.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudioclock.c: (gst_audio_clock_init):
This clock can be slaved to a master clock now.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_dispose), (gst_base_audio_sink_provide_clock),
(gst_base_audio_sink_set_clock),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_preroll),
(gst_base_audio_sink_render), (gst_base_audio_sink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Handle slaving the internal clock to the clock selected in the
pipeline.
Add property to make the basesink not provide a clock.
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_class_init), (gst_base_rtp_depayload_init),
(gst_base_rtp_depayload_wait):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
We can use the clock in GstElement, no need to store it ourselves.
2005-11-22 18:32:09 +00:00
|
|
|
g_param_spec_boolean ("provide-clock", "Provide Clock",
|
|
|
|
"Provide a clock to be used as the global pipeline clock",
|
2008-03-22 15:00:53 +00:00
|
|
|
DEFAULT_PROVIDE_CLOCK, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_SLAVE_METHOD,
|
|
|
|
g_param_spec_enum ("slave-method", "Slave Method",
|
|
|
|
"Algorithm to use to match the rate of the masterclock",
|
2008-12-13 06:57:09 +00:00
|
|
|
GST_TYPE_BASE_AUDIO_SINK_SLAVE_METHOD, DEFAULT_SLAVE_METHOD,
|
2008-03-22 15:00:53 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
|
2009-01-21 11:33:59 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_CAN_ACTIVATE_PULL,
|
|
|
|
g_param_spec_boolean ("can-activate-pull", "Allow Pull Scheduling",
|
|
|
|
"Allow pull-based scheduling", DEFAULT_CAN_ACTIVATE_PULL,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2009-11-04 15:16:31 +00:00
|
|
|
/**
|
|
|
|
* GstBaseAudioSink:drift-tolerance
|
|
|
|
*
|
2011-05-21 12:49:20 +00:00
|
|
|
* Controls the amount of time in microseconds that clocks are allowed
|
2009-11-04 15:16:31 +00:00
|
|
|
* to drift before resynchronisation happens.
|
|
|
|
*
|
|
|
|
* Since: 0.10.26
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_DRIFT_TOLERANCE,
|
|
|
|
g_param_spec_int64 ("drift-tolerance", "Drift Tolerance",
|
2011-05-21 12:49:20 +00:00
|
|
|
"Tolerance for clock drift in microseconds", 1,
|
2009-11-04 15:16:31 +00:00
|
|
|
G_MAXINT64, DEFAULT_DRIFT_TOLERANCE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2011-05-21 12:49:20 +00:00
|
|
|
/**
|
|
|
|
* GstBaseAudioSink:alignment_threshold
|
|
|
|
*
|
|
|
|
* Controls the amount of time in nanoseconds that timestamps are allowed
|
|
|
|
* to drift from their ideal time before choosing not to align them.
|
|
|
|
*
|
2011-11-07 23:05:44 +00:00
|
|
|
* Since: 0.10.36
|
2011-05-21 12:49:20 +00:00
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_ALIGNMENT_THRESHOLD,
|
|
|
|
g_param_spec_int64 ("alignment-threshold", "Alignment Threshold",
|
|
|
|
"Timestamp alignment threshold in nanoseconds", 1,
|
|
|
|
G_MAXINT64, DEFAULT_ALIGNMENT_THRESHOLD,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2009-01-21 11:33:59 +00:00
|
|
|
|
2011-05-02 10:05:28 +00:00
|
|
|
/**
|
|
|
|
* GstBaseAudioSink:discont-wait
|
|
|
|
*
|
|
|
|
* A window of time in nanoseconds to wait before creating a discontinuity as
|
|
|
|
* a result of breaching the drift-tolerance.
|
2011-11-07 23:05:44 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.36
|
2011-05-02 10:05:28 +00:00
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_DISCONT_WAIT,
|
|
|
|
g_param_spec_int64 ("discont-wait", "Discont Wait",
|
|
|
|
"Window of time in nanoseconds to wait before "
|
|
|
|
"creating a discontinuity", 0,
|
|
|
|
G_MAXINT64, DEFAULT_DISCONT_WAIT,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2009-01-21 11:33:59 +00:00
|
|
|
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
gstelement_class->change_state =
|
2005-07-10 12:03:58 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_base_audio_sink_change_state);
|
2005-09-28 13:41:29 +00:00
|
|
|
gstelement_class->provide_clock =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_base_audio_sink_provide_clock);
|
2007-02-15 12:06:25 +00:00
|
|
|
gstelement_class->query = GST_DEBUG_FUNCPTR (gst_base_audio_sink_query);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_base_audio_sink_event);
|
|
|
|
gstbasesink_class->preroll = GST_DEBUG_FUNCPTR (gst_base_audio_sink_preroll);
|
2011-07-26 10:37:04 +00:00
|
|
|
gstbasesink_class->query = GST_DEBUG_FUNCPTR (gst_base_audio_sink_query_pad);
|
2005-07-10 12:03:58 +00:00
|
|
|
gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_base_audio_sink_render);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
gstbasesink_class->get_times =
|
2005-07-10 12:03:58 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_base_audio_sink_get_times);
|
|
|
|
gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_base_audio_sink_setcaps);
|
2007-01-12 21:19:35 +00:00
|
|
|
gstbasesink_class->fixate = GST_DEBUG_FUNCPTR (gst_base_audio_sink_fixate);
|
2011-02-23 12:42:16 +00:00
|
|
|
#if 0
|
2006-03-23 16:24:23 +00:00
|
|
|
gstbasesink_class->async_play =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_base_audio_sink_async_play);
|
2011-02-23 12:42:16 +00:00
|
|
|
#endif
|
2007-01-06 17:28:40 +00:00
|
|
|
gstbasesink_class->activate_pull =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_base_audio_sink_activate_pull);
|
2008-01-10 17:55:53 +00:00
|
|
|
|
|
|
|
/* ref class from a thread-safe context to work around missing bit of
|
|
|
|
* thread-safety in GObject */
|
|
|
|
g_type_class_ref (GST_TYPE_AUDIO_CLOCK);
|
2008-04-06 20:16:27 +00:00
|
|
|
g_type_class_ref (GST_TYPE_RING_BUFFER);
|
2009-09-10 10:38:16 +00:00
|
|
|
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-04-19 08:52:00 +00:00
|
|
|
gst_base_audio_sink_init (GstBaseAudioSink * baseaudiosink)
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
{
|
2011-01-02 17:21:54 +00:00
|
|
|
GstBaseSink *basesink;
|
2009-09-10 10:38:16 +00:00
|
|
|
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
baseaudiosink->priv = GST_BASE_AUDIO_SINK_GET_PRIVATE (baseaudiosink);
|
|
|
|
|
2005-04-28 16:15:42 +00:00
|
|
|
baseaudiosink->buffer_time = DEFAULT_BUFFER_TIME;
|
|
|
|
baseaudiosink->latency_time = DEFAULT_LATENCY_TIME;
|
gst-libs/gst/audio/gstaudioclock.c: This clock can be slaved to a master clock now.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudioclock.c: (gst_audio_clock_init):
This clock can be slaved to a master clock now.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_dispose), (gst_base_audio_sink_provide_clock),
(gst_base_audio_sink_set_clock),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_preroll),
(gst_base_audio_sink_render), (gst_base_audio_sink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Handle slaving the internal clock to the clock selected in the
pipeline.
Add property to make the basesink not provide a clock.
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_class_init), (gst_base_rtp_depayload_init),
(gst_base_rtp_depayload_wait):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
We can use the clock in GstElement, no need to store it ourselves.
2005-11-22 18:32:09 +00:00
|
|
|
baseaudiosink->provide_clock = DEFAULT_PROVIDE_CLOCK;
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
baseaudiosink->priv->slave_method = DEFAULT_SLAVE_METHOD;
|
2011-01-02 17:21:54 +00:00
|
|
|
baseaudiosink->priv->drift_tolerance = DEFAULT_DRIFT_TOLERANCE;
|
2011-05-21 12:49:20 +00:00
|
|
|
baseaudiosink->priv->alignment_threshold = DEFAULT_ALIGNMENT_THRESHOLD;
|
2011-05-02 10:05:28 +00:00
|
|
|
baseaudiosink->priv->discont_wait = DEFAULT_DISCONT_WAIT;
|
2005-04-28 16:15:42 +00:00
|
|
|
|
2010-09-07 16:09:12 +00:00
|
|
|
baseaudiosink->provided_clock = gst_audio_clock_new ("GstAudioSinkClock",
|
2011-11-10 12:50:08 +00:00
|
|
|
(GstAudioClockGetTimeFunc) gst_base_audio_sink_get_time, baseaudiosink,
|
|
|
|
NULL);
|
2010-06-03 11:44:40 +00:00
|
|
|
|
2011-01-02 17:21:54 +00:00
|
|
|
basesink = GST_BASE_SINK_CAST (baseaudiosink);
|
|
|
|
basesink->can_activate_push = TRUE;
|
|
|
|
basesink->can_activate_pull = DEFAULT_CAN_ACTIVATE_PULL;
|
|
|
|
|
|
|
|
gst_base_sink_set_last_buffer_enabled (basesink, FALSE);
|
2005-04-28 16:15:42 +00:00
|
|
|
}
|
|
|
|
|
2005-06-29 11:17:33 +00:00
|
|
|
static void
|
2005-07-10 12:03:58 +00:00
|
|
|
gst_base_audio_sink_dispose (GObject * object)
|
2005-06-29 11:17:33 +00:00
|
|
|
{
|
|
|
|
GstBaseAudioSink *sink;
|
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
sink = GST_BASE_AUDIO_SINK (object);
|
2005-06-29 11:17:33 +00:00
|
|
|
|
2010-09-07 16:09:12 +00:00
|
|
|
if (sink->provided_clock) {
|
|
|
|
gst_audio_clock_invalidate (sink->provided_clock);
|
2010-06-03 11:44:40 +00:00
|
|
|
gst_object_unref (sink->provided_clock);
|
2010-09-07 16:09:12 +00:00
|
|
|
sink->provided_clock = NULL;
|
|
|
|
}
|
2010-06-03 11:44:40 +00:00
|
|
|
|
2006-03-22 12:33:09 +00:00
|
|
|
if (sink->ringbuffer) {
|
|
|
|
gst_object_unparent (GST_OBJECT_CAST (sink->ringbuffer));
|
|
|
|
sink->ringbuffer = NULL;
|
|
|
|
}
|
2005-07-20 09:08:05 +00:00
|
|
|
|
2005-06-29 11:17:33 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
|
2005-04-28 16:15:42 +00:00
|
|
|
static GstClock *
|
2005-09-28 13:41:29 +00:00
|
|
|
gst_base_audio_sink_provide_clock (GstElement * elem)
|
2005-04-28 16:15:42 +00:00
|
|
|
{
|
|
|
|
GstBaseAudioSink *sink;
|
2005-11-16 16:48:35 +00:00
|
|
|
GstClock *clock;
|
2005-04-28 16:15:42 +00:00
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
sink = GST_BASE_AUDIO_SINK (elem);
|
2005-04-28 16:15:42 +00:00
|
|
|
|
2006-07-06 15:54:50 +00:00
|
|
|
/* we have no ringbuffer (must be NULL state) */
|
2006-02-28 11:06:24 +00:00
|
|
|
if (sink->ringbuffer == NULL)
|
|
|
|
goto wrong_state;
|
|
|
|
|
2006-02-02 18:13:26 +00:00
|
|
|
if (!gst_ring_buffer_is_acquired (sink->ringbuffer))
|
|
|
|
goto wrong_state;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
2006-02-02 18:18:31 +00:00
|
|
|
if (!sink->provide_clock)
|
2006-02-02 18:13:26 +00:00
|
|
|
goto clock_disabled;
|
|
|
|
|
|
|
|
clock = GST_CLOCK_CAST (gst_object_ref (sink->provided_clock));
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
2005-11-16 16:48:35 +00:00
|
|
|
|
|
|
|
return clock;
|
2006-02-02 18:13:26 +00:00
|
|
|
|
2006-07-24 15:14:17 +00:00
|
|
|
/* ERRORS */
|
2006-02-02 18:13:26 +00:00
|
|
|
wrong_state:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (sink, "ringbuffer not acquired");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
clock_disabled:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (sink, "clock provide disabled");
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-04-28 16:15:42 +00:00
|
|
|
}
|
|
|
|
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
static gboolean
|
2011-07-26 10:37:04 +00:00
|
|
|
gst_base_audio_sink_query_pad (GstBaseSink * bsink, GstQuery * query)
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
{
|
|
|
|
gboolean res = FALSE;
|
|
|
|
GstBaseAudioSink *basesink;
|
|
|
|
|
2011-07-26 10:37:04 +00:00
|
|
|
basesink = GST_BASE_AUDIO_SINK (bsink);
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
case GST_QUERY_CONVERT:
|
|
|
|
{
|
|
|
|
GstFormat src_fmt, dest_fmt;
|
|
|
|
gint64 src_val, dest_val;
|
|
|
|
|
2011-07-26 10:37:04 +00:00
|
|
|
GST_LOG_OBJECT (basesink, "query convert");
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
|
|
|
|
if (basesink->ringbuffer) {
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, NULL);
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
res = gst_ring_buffer_convert (basesink->ringbuffer, src_fmt, src_val,
|
|
|
|
dest_fmt, &dest_val);
|
|
|
|
if (res) {
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2011-07-26 10:42:22 +00:00
|
|
|
res = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2007-02-15 12:06:25 +00:00
|
|
|
static gboolean
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_base_audio_sink_query (GstElement * element, GstQuery * query)
|
2007-02-15 12:06:25 +00:00
|
|
|
{
|
|
|
|
gboolean res = FALSE;
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
GstBaseAudioSink *basesink;
|
2007-02-15 12:06:25 +00:00
|
|
|
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
basesink = GST_BASE_AUDIO_SINK (element);
|
2007-02-15 12:06:25 +00:00
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
2007-02-15 12:06:25 +00:00
|
|
|
case GST_QUERY_LATENCY:
|
|
|
|
{
|
|
|
|
gboolean live, us_live;
|
|
|
|
GstClockTime min_l, max_l;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (basesink, "latency query");
|
|
|
|
|
|
|
|
/* ask parent first, it will do an upstream query for us. */
|
|
|
|
if ((res =
|
|
|
|
gst_base_sink_query_latency (GST_BASE_SINK_CAST (basesink), &live,
|
|
|
|
&us_live, &min_l, &max_l))) {
|
2011-07-20 16:10:57 +00:00
|
|
|
GstClockTime base_latency, min_latency, max_latency;
|
2007-02-15 12:06:25 +00:00
|
|
|
|
|
|
|
/* we and upstream are both live, adjust the min_latency */
|
2007-02-28 15:02:25 +00:00
|
|
|
if (live && us_live) {
|
2007-02-15 12:06:25 +00:00
|
|
|
GstRingBufferSpec *spec;
|
|
|
|
|
2010-11-25 16:01:04 +00:00
|
|
|
GST_OBJECT_LOCK (basesink);
|
2011-08-18 17:15:03 +00:00
|
|
|
if (!basesink->ringbuffer || !basesink->ringbuffer->spec.info.rate) {
|
2010-11-25 16:01:04 +00:00
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (basesink,
|
|
|
|
"we are not yet negotiated, can't report latency yet");
|
|
|
|
res = FALSE;
|
|
|
|
goto done;
|
|
|
|
}
|
2007-02-15 12:06:25 +00:00
|
|
|
spec = &basesink->ringbuffer->spec;
|
|
|
|
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
basesink->priv->us_latency = min_l;
|
|
|
|
|
2011-07-20 16:10:57 +00:00
|
|
|
base_latency =
|
2008-05-07 15:47:03 +00:00
|
|
|
gst_util_uint64_scale_int (spec->seglatency * spec->segsize,
|
2011-08-18 17:15:03 +00:00
|
|
|
GST_SECOND, spec->info.rate * spec->info.bpf);
|
2010-11-25 16:01:04 +00:00
|
|
|
GST_OBJECT_UNLOCK (basesink);
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
|
|
|
|
/* we cannot go lower than the buffer size and the min peer latency */
|
2011-07-20 16:10:57 +00:00
|
|
|
min_latency = base_latency + min_l;
|
2007-02-28 15:02:25 +00:00
|
|
|
/* the max latency is the max of the peer, we can delay an infinite
|
|
|
|
* amount of time. */
|
2011-07-20 16:10:57 +00:00
|
|
|
max_latency = (max_l == -1) ? -1 : (base_latency + max_l);
|
2007-02-15 12:06:25 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (basesink,
|
|
|
|
"peer min %" GST_TIME_FORMAT ", our min latency: %"
|
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (min_l),
|
|
|
|
GST_TIME_ARGS (min_latency));
|
2011-07-28 09:44:20 +00:00
|
|
|
GST_DEBUG_OBJECT (basesink,
|
|
|
|
"peer max %" GST_TIME_FORMAT ", our max latency: %"
|
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (max_l),
|
|
|
|
GST_TIME_ARGS (max_latency));
|
2007-02-15 12:06:25 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (basesink,
|
|
|
|
"peer or we are not live, don't care about latency");
|
2008-06-20 09:09:37 +00:00
|
|
|
min_latency = min_l;
|
|
|
|
max_latency = max_l;
|
2007-02-15 12:06:25 +00:00
|
|
|
}
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_set_latency (query, live, min_latency, max_latency);
|
2007-02-15 12:06:25 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
case GST_QUERY_CONVERT:
|
|
|
|
{
|
|
|
|
GstFormat src_fmt, dest_fmt;
|
|
|
|
gint64 src_val, dest_val;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (basesink, "query convert");
|
|
|
|
|
|
|
|
if (basesink->ringbuffer) {
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, NULL);
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
res = gst_ring_buffer_convert (basesink->ringbuffer, src_fmt, src_val,
|
|
|
|
dest_fmt, &dest_val);
|
|
|
|
if (res) {
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2007-02-15 12:06:25 +00:00
|
|
|
default:
|
|
|
|
res = GST_ELEMENT_CLASS (parent_class)->query (element, query);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-02-28 15:02:25 +00:00
|
|
|
done:
|
2007-02-15 12:06:25 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-28 16:15:42 +00:00
|
|
|
static GstClockTime
|
2005-07-10 12:03:58 +00:00
|
|
|
gst_base_audio_sink_get_time (GstClock * clock, GstBaseAudioSink * sink)
|
2005-04-28 16:15:42 +00:00
|
|
|
{
|
gst-libs/gst/audio/: Do the delay calculation in the source/sink base classes as this is specific for the capture/pla...
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_callback):
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time), (gst_base_audio_src_fixate),
(gst_base_audio_src_get_times), (gst_base_audio_src_get_offset),
(gst_base_audio_src_create), (gst_base_audio_src_change_state):
Do the delay calculation in the source/sink base classes as this is
specific for the capture/playback mode.
Try to fixate a bit better, like round depth up to a multiple of 8
bigger than width.
Handle underruns correctly by marking DISCONT on buffers and adjusting
timestamps to handle the gap.
Set offset/offset_end correctly on buffers.
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_pause),
(gst_ring_buffer_samples_done), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
Remove resync and underrun recovery from the ringbuffer.
Fix ringbuffer read code on under/overrun.
2006-09-15 14:53:44 +00:00
|
|
|
guint64 raw, samples;
|
|
|
|
guint delay;
|
2008-05-09 16:38:10 +00:00
|
|
|
GstClockTime result;
|
2005-04-28 16:15:42 +00:00
|
|
|
|
2011-08-18 17:15:03 +00:00
|
|
|
if (sink->ringbuffer == NULL || sink->ringbuffer->spec.info.rate == 0)
|
2005-07-20 09:08:05 +00:00
|
|
|
return GST_CLOCK_TIME_NONE;
|
2005-04-28 16:15:42 +00:00
|
|
|
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
/* our processed samples are always increasing */
|
gst-libs/gst/audio/: Do the delay calculation in the source/sink base classes as this is specific for the capture/pla...
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_callback):
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time), (gst_base_audio_src_fixate),
(gst_base_audio_src_get_times), (gst_base_audio_src_get_offset),
(gst_base_audio_src_create), (gst_base_audio_src_change_state):
Do the delay calculation in the source/sink base classes as this is
specific for the capture/playback mode.
Try to fixate a bit better, like round depth up to a multiple of 8
bigger than width.
Handle underruns correctly by marking DISCONT on buffers and adjusting
timestamps to handle the gap.
Set offset/offset_end correctly on buffers.
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_pause),
(gst_ring_buffer_samples_done), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
Remove resync and underrun recovery from the ringbuffer.
Fix ringbuffer read code on under/overrun.
2006-09-15 14:53:44 +00:00
|
|
|
raw = samples = gst_ring_buffer_samples_done (sink->ringbuffer);
|
|
|
|
|
|
|
|
/* the number of samples not yet processed, this is still queued in the
|
|
|
|
* device (not played for playback). */
|
|
|
|
delay = gst_ring_buffer_delay (sink->ringbuffer);
|
|
|
|
|
|
|
|
if (G_LIKELY (samples >= delay))
|
|
|
|
samples -= delay;
|
|
|
|
else
|
|
|
|
samples = 0;
|
2005-04-28 16:15:42 +00:00
|
|
|
|
2006-02-12 14:54:55 +00:00
|
|
|
result = gst_util_uint64_scale_int (samples, GST_SECOND,
|
2011-08-18 17:15:03 +00:00
|
|
|
sink->ringbuffer->spec.info.rate);
|
2005-04-28 16:15:42 +00:00
|
|
|
|
gst-libs/gst/audio/: Do the delay calculation in the source/sink base classes as this is specific for the capture/pla...
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_callback):
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time), (gst_base_audio_src_fixate),
(gst_base_audio_src_get_times), (gst_base_audio_src_get_offset),
(gst_base_audio_src_create), (gst_base_audio_src_change_state):
Do the delay calculation in the source/sink base classes as this is
specific for the capture/playback mode.
Try to fixate a bit better, like round depth up to a multiple of 8
bigger than width.
Handle underruns correctly by marking DISCONT on buffers and adjusting
timestamps to handle the gap.
Set offset/offset_end correctly on buffers.
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_pause),
(gst_ring_buffer_samples_done), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
Remove resync and underrun recovery from the ringbuffer.
Fix ringbuffer read code on under/overrun.
2006-09-15 14:53:44 +00:00
|
|
|
GST_DEBUG_OBJECT (sink,
|
2009-04-14 21:02:39 +00:00
|
|
|
"processed samples: raw %" G_GUINT64_FORMAT ", delay %u, real %"
|
|
|
|
G_GUINT64_FORMAT ", time %" GST_TIME_FORMAT,
|
|
|
|
raw, delay, samples, GST_TIME_ARGS (result));
|
gst-libs/gst/audio/: Do the delay calculation in the source/sink base classes as this is specific for the capture/pla...
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_callback):
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time), (gst_base_audio_src_fixate),
(gst_base_audio_src_get_times), (gst_base_audio_src_get_offset),
(gst_base_audio_src_create), (gst_base_audio_src_change_state):
Do the delay calculation in the source/sink base classes as this is
specific for the capture/playback mode.
Try to fixate a bit better, like round depth up to a multiple of 8
bigger than width.
Handle underruns correctly by marking DISCONT on buffers and adjusting
timestamps to handle the gap.
Set offset/offset_end correctly on buffers.
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_pause),
(gst_ring_buffer_samples_done), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
Remove resync and underrun recovery from the ringbuffer.
Fix ringbuffer read code on under/overrun.
2006-09-15 14:53:44 +00:00
|
|
|
|
2005-04-28 16:15:42 +00:00
|
|
|
return result;
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
}
|
|
|
|
|
Expose methods for some object properties so that subclasses can more easily configure them.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_set_provide_clock),
(gst_base_audio_sink_get_provide_clock),
(gst_base_audio_sink_set_slave_method),
(gst_base_audio_sink_get_slave_method),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_drain),
(gst_base_audio_sink_none_slaving),
(gst_base_audio_sink_handle_slaving):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
Added slave method none, that completely disables slaving to the
internal clock.
API: gst_base_audio_sink_set_provide_clock()
API: gst_base_audio_sink_get_provide_clock()
API: gst_base_audio_sink_set_slave_method()
API: gst_base_audio_sink_get_slave_method()
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_set_provide_clock),
(gst_base_audio_src_get_provide_clock),
(gst_base_audio_src_set_property),
(gst_base_audio_src_get_property), (gst_base_audio_src_create):
* gst-libs/gst/audio/gstbaseaudiosrc.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
API: gst_base_audio_src_set_provide_clock()
API: gst_base_audio_src_get_provide_clock()
2007-11-21 13:04:17 +00:00
|
|
|
/**
|
|
|
|
* gst_base_audio_sink_set_provide_clock:
|
|
|
|
* @sink: a #GstBaseAudioSink
|
|
|
|
* @provide: new state
|
|
|
|
*
|
2009-09-09 14:19:32 +00:00
|
|
|
* Controls whether @sink will provide a clock or not. If @provide is %TRUE,
|
Expose methods for some object properties so that subclasses can more easily configure them.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_set_provide_clock),
(gst_base_audio_sink_get_provide_clock),
(gst_base_audio_sink_set_slave_method),
(gst_base_audio_sink_get_slave_method),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_drain),
(gst_base_audio_sink_none_slaving),
(gst_base_audio_sink_handle_slaving):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
Added slave method none, that completely disables slaving to the
internal clock.
API: gst_base_audio_sink_set_provide_clock()
API: gst_base_audio_sink_get_provide_clock()
API: gst_base_audio_sink_set_slave_method()
API: gst_base_audio_sink_get_slave_method()
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_set_provide_clock),
(gst_base_audio_src_get_provide_clock),
(gst_base_audio_src_set_property),
(gst_base_audio_src_get_property), (gst_base_audio_src_create):
* gst-libs/gst/audio/gstbaseaudiosrc.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
API: gst_base_audio_src_set_provide_clock()
API: gst_base_audio_src_get_provide_clock()
2007-11-21 13:04:17 +00:00
|
|
|
* gst_element_provide_clock() will return a clock that reflects the datarate
|
|
|
|
* of @sink. If @provide is %FALSE, gst_element_provide_clock() will return NULL.
|
|
|
|
*
|
|
|
|
* Since: 0.10.16
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_base_audio_sink_set_provide_clock (GstBaseAudioSink * sink,
|
|
|
|
gboolean provide)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_BASE_AUDIO_SINK (sink));
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
sink->provide_clock = provide;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_audio_sink_get_provide_clock:
|
|
|
|
* @sink: a #GstBaseAudioSink
|
|
|
|
*
|
|
|
|
* Queries whether @sink will provide a clock or not. See also
|
|
|
|
* gst_base_audio_sink_set_provide_clock.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if @sink will provide a clock.
|
|
|
|
*
|
|
|
|
* Since: 0.10.16
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_base_audio_sink_get_provide_clock (GstBaseAudioSink * sink)
|
|
|
|
{
|
|
|
|
gboolean result;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BASE_AUDIO_SINK (sink), FALSE);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
result = sink->provide_clock;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_audio_sink_set_slave_method:
|
|
|
|
* @sink: a #GstBaseAudioSink
|
|
|
|
* @method: the new slave method
|
|
|
|
*
|
2009-09-09 14:19:32 +00:00
|
|
|
* Controls how clock slaving will be performed in @sink.
|
Expose methods for some object properties so that subclasses can more easily configure them.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_set_provide_clock),
(gst_base_audio_sink_get_provide_clock),
(gst_base_audio_sink_set_slave_method),
(gst_base_audio_sink_get_slave_method),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_drain),
(gst_base_audio_sink_none_slaving),
(gst_base_audio_sink_handle_slaving):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
Added slave method none, that completely disables slaving to the
internal clock.
API: gst_base_audio_sink_set_provide_clock()
API: gst_base_audio_sink_get_provide_clock()
API: gst_base_audio_sink_set_slave_method()
API: gst_base_audio_sink_get_slave_method()
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_set_provide_clock),
(gst_base_audio_src_get_provide_clock),
(gst_base_audio_src_set_property),
(gst_base_audio_src_get_property), (gst_base_audio_src_create):
* gst-libs/gst/audio/gstbaseaudiosrc.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
API: gst_base_audio_src_set_provide_clock()
API: gst_base_audio_src_get_provide_clock()
2007-11-21 13:04:17 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.16
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_base_audio_sink_set_slave_method (GstBaseAudioSink * sink,
|
|
|
|
GstBaseAudioSinkSlaveMethod method)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_BASE_AUDIO_SINK (sink));
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
sink->priv->slave_method = method;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_audio_sink_get_slave_method:
|
|
|
|
* @sink: a #GstBaseAudioSink
|
|
|
|
*
|
|
|
|
* Get the current slave method used by @sink.
|
|
|
|
*
|
|
|
|
* Returns: The current slave method used by @sink.
|
|
|
|
*
|
|
|
|
* Since: 0.10.16
|
|
|
|
*/
|
|
|
|
GstBaseAudioSinkSlaveMethod
|
|
|
|
gst_base_audio_sink_get_slave_method (GstBaseAudioSink * sink)
|
|
|
|
{
|
|
|
|
GstBaseAudioSinkSlaveMethod result;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BASE_AUDIO_SINK (sink), -1);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
result = sink->priv->slave_method;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2010-07-30 11:54:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_audio_sink_set_drift_tolerance:
|
|
|
|
* @sink: a #GstBaseAudioSink
|
|
|
|
* @drift_tolerance: the new drift tolerance in microseconds
|
|
|
|
*
|
2010-09-24 11:09:28 +00:00
|
|
|
* Controls the sink's drift tolerance.
|
|
|
|
*
|
|
|
|
* Since: 0.10.31
|
2010-07-30 11:54:42 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_base_audio_sink_set_drift_tolerance (GstBaseAudioSink * sink,
|
|
|
|
gint64 drift_tolerance)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_BASE_AUDIO_SINK (sink));
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
sink->priv->drift_tolerance = drift_tolerance;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_audio_sink_get_drift_tolerance
|
|
|
|
* @sink: a #GstBaseAudioSink
|
|
|
|
*
|
|
|
|
* Get the current drift tolerance, in microseconds, used by @sink.
|
|
|
|
*
|
|
|
|
* Returns: The current drift tolerance used by @sink.
|
2010-09-24 11:09:28 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.31
|
2010-07-30 11:54:42 +00:00
|
|
|
*/
|
|
|
|
gint64
|
|
|
|
gst_base_audio_sink_get_drift_tolerance (GstBaseAudioSink * sink)
|
|
|
|
{
|
|
|
|
gint64 result;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BASE_AUDIO_SINK (sink), -1);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
result = sink->priv->drift_tolerance;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2011-05-21 12:49:20 +00:00
|
|
|
/**
|
|
|
|
* gst_base_audio_sink_set_alignment_threshold:
|
|
|
|
* @sink: a #GstBaseAudioSink
|
|
|
|
* @alignment_threshold: the new alignment threshold in nanoseconds
|
|
|
|
*
|
|
|
|
* Controls the sink's alignment threshold.
|
|
|
|
*
|
2011-11-07 23:05:44 +00:00
|
|
|
* Since: 0.10.36
|
2011-05-21 12:49:20 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_base_audio_sink_set_alignment_threshold (GstBaseAudioSink * sink,
|
|
|
|
GstClockTime alignment_threshold)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_BASE_AUDIO_SINK (sink));
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
sink->priv->alignment_threshold = alignment_threshold;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_audio_sink_get_alignment_threshold
|
|
|
|
* @sink: a #GstBaseAudioSink
|
|
|
|
*
|
|
|
|
* Get the current alignment threshold, in nanoseconds, used by @sink.
|
|
|
|
*
|
|
|
|
* Returns: The current alignment threshold used by @sink.
|
|
|
|
*
|
2011-11-07 23:05:44 +00:00
|
|
|
* Since: 0.10.36
|
2011-05-21 12:49:20 +00:00
|
|
|
*/
|
|
|
|
GstClockTime
|
|
|
|
gst_base_audio_sink_get_alignment_threshold (GstBaseAudioSink * sink)
|
|
|
|
{
|
|
|
|
gint64 result;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BASE_AUDIO_SINK (sink), -1);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
result = sink->priv->alignment_threshold;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2011-05-02 10:05:28 +00:00
|
|
|
/**
|
|
|
|
* gst_base_audio_sink_set_discont_wait:
|
|
|
|
* @sink: a #GstBaseAudioSink
|
|
|
|
* @discont_wait: the new discont wait in nanoseconds
|
|
|
|
*
|
|
|
|
* Controls how long the sink will wait before creating a discontinuity.
|
|
|
|
*
|
2011-11-07 23:05:44 +00:00
|
|
|
* Since: 0.10.36
|
2011-05-02 10:05:28 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_base_audio_sink_set_discont_wait (GstBaseAudioSink * sink,
|
|
|
|
GstClockTime discont_wait)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_BASE_AUDIO_SINK (sink));
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
sink->priv->discont_wait = discont_wait;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_audio_sink_get_discont_wait
|
|
|
|
* @sink: a #GstBaseAudioSink
|
|
|
|
*
|
|
|
|
* Get the current discont wait, in nanoseconds, used by @sink.
|
|
|
|
*
|
|
|
|
* Returns: The current discont wait used by @sink.
|
|
|
|
*
|
2011-11-07 23:05:44 +00:00
|
|
|
* Since: 0.10.36
|
2011-05-02 10:05:28 +00:00
|
|
|
*/
|
|
|
|
GstClockTime
|
|
|
|
gst_base_audio_sink_get_discont_wait (GstBaseAudioSink * sink)
|
|
|
|
{
|
|
|
|
GstClockTime result;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BASE_AUDIO_SINK (sink), -1);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
result = sink->priv->discont_wait;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
static void
|
2005-07-10 12:03:58 +00:00
|
|
|
gst_base_audio_sink_set_property (GObject * object, guint prop_id,
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstBaseAudioSink *sink;
|
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
sink = GST_BASE_AUDIO_SINK (object);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2005-04-28 16:15:42 +00:00
|
|
|
case PROP_BUFFER_TIME:
|
|
|
|
sink->buffer_time = g_value_get_int64 (value);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
break;
|
2005-04-28 16:15:42 +00:00
|
|
|
case PROP_LATENCY_TIME:
|
|
|
|
sink->latency_time = g_value_get_int64 (value);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
break;
|
gst-libs/gst/audio/gstaudioclock.c: This clock can be slaved to a master clock now.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudioclock.c: (gst_audio_clock_init):
This clock can be slaved to a master clock now.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_dispose), (gst_base_audio_sink_provide_clock),
(gst_base_audio_sink_set_clock),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_preroll),
(gst_base_audio_sink_render), (gst_base_audio_sink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Handle slaving the internal clock to the clock selected in the
pipeline.
Add property to make the basesink not provide a clock.
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_class_init), (gst_base_rtp_depayload_init),
(gst_base_rtp_depayload_wait):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
We can use the clock in GstElement, no need to store it ourselves.
2005-11-22 18:32:09 +00:00
|
|
|
case PROP_PROVIDE_CLOCK:
|
Expose methods for some object properties so that subclasses can more easily configure them.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_set_provide_clock),
(gst_base_audio_sink_get_provide_clock),
(gst_base_audio_sink_set_slave_method),
(gst_base_audio_sink_get_slave_method),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_drain),
(gst_base_audio_sink_none_slaving),
(gst_base_audio_sink_handle_slaving):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
Added slave method none, that completely disables slaving to the
internal clock.
API: gst_base_audio_sink_set_provide_clock()
API: gst_base_audio_sink_get_provide_clock()
API: gst_base_audio_sink_set_slave_method()
API: gst_base_audio_sink_get_slave_method()
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_set_provide_clock),
(gst_base_audio_src_get_provide_clock),
(gst_base_audio_src_set_property),
(gst_base_audio_src_get_property), (gst_base_audio_src_create):
* gst-libs/gst/audio/gstbaseaudiosrc.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
API: gst_base_audio_src_set_provide_clock()
API: gst_base_audio_src_get_provide_clock()
2007-11-21 13:04:17 +00:00
|
|
|
gst_base_audio_sink_set_provide_clock (sink, g_value_get_boolean (value));
|
gst-libs/gst/audio/gstaudioclock.c: This clock can be slaved to a master clock now.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudioclock.c: (gst_audio_clock_init):
This clock can be slaved to a master clock now.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_dispose), (gst_base_audio_sink_provide_clock),
(gst_base_audio_sink_set_clock),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_preroll),
(gst_base_audio_sink_render), (gst_base_audio_sink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Handle slaving the internal clock to the clock selected in the
pipeline.
Add property to make the basesink not provide a clock.
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_class_init), (gst_base_rtp_depayload_init),
(gst_base_rtp_depayload_wait):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
We can use the clock in GstElement, no need to store it ourselves.
2005-11-22 18:32:09 +00:00
|
|
|
break;
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
case PROP_SLAVE_METHOD:
|
Expose methods for some object properties so that subclasses can more easily configure them.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_set_provide_clock),
(gst_base_audio_sink_get_provide_clock),
(gst_base_audio_sink_set_slave_method),
(gst_base_audio_sink_get_slave_method),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_drain),
(gst_base_audio_sink_none_slaving),
(gst_base_audio_sink_handle_slaving):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
Added slave method none, that completely disables slaving to the
internal clock.
API: gst_base_audio_sink_set_provide_clock()
API: gst_base_audio_sink_get_provide_clock()
API: gst_base_audio_sink_set_slave_method()
API: gst_base_audio_sink_get_slave_method()
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_set_provide_clock),
(gst_base_audio_src_get_provide_clock),
(gst_base_audio_src_set_property),
(gst_base_audio_src_get_property), (gst_base_audio_src_create):
* gst-libs/gst/audio/gstbaseaudiosrc.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
API: gst_base_audio_src_set_provide_clock()
API: gst_base_audio_src_get_provide_clock()
2007-11-21 13:04:17 +00:00
|
|
|
gst_base_audio_sink_set_slave_method (sink, g_value_get_enum (value));
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
break;
|
2009-01-21 11:33:59 +00:00
|
|
|
case PROP_CAN_ACTIVATE_PULL:
|
|
|
|
GST_BASE_SINK (sink)->can_activate_pull = g_value_get_boolean (value);
|
|
|
|
break;
|
2009-11-04 15:16:31 +00:00
|
|
|
case PROP_DRIFT_TOLERANCE:
|
2010-07-30 11:54:42 +00:00
|
|
|
gst_base_audio_sink_set_drift_tolerance (sink, g_value_get_int64 (value));
|
2009-11-04 15:16:31 +00:00
|
|
|
break;
|
2011-05-21 12:49:20 +00:00
|
|
|
case PROP_ALIGNMENT_THRESHOLD:
|
|
|
|
gst_base_audio_sink_set_alignment_threshold (sink,
|
|
|
|
g_value_get_uint64 (value));
|
|
|
|
break;
|
2011-05-02 10:05:28 +00:00
|
|
|
case PROP_DISCONT_WAIT:
|
|
|
|
gst_base_audio_sink_set_discont_wait (sink, g_value_get_uint64 (value));
|
|
|
|
break;
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-07-10 12:03:58 +00:00
|
|
|
gst_base_audio_sink_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
{
|
|
|
|
GstBaseAudioSink *sink;
|
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
sink = GST_BASE_AUDIO_SINK (object);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2005-04-28 16:15:42 +00:00
|
|
|
case PROP_BUFFER_TIME:
|
|
|
|
g_value_set_int64 (value, sink->buffer_time);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
break;
|
2005-04-28 16:15:42 +00:00
|
|
|
case PROP_LATENCY_TIME:
|
|
|
|
g_value_set_int64 (value, sink->latency_time);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
break;
|
gst-libs/gst/audio/gstaudioclock.c: This clock can be slaved to a master clock now.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudioclock.c: (gst_audio_clock_init):
This clock can be slaved to a master clock now.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_dispose), (gst_base_audio_sink_provide_clock),
(gst_base_audio_sink_set_clock),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_preroll),
(gst_base_audio_sink_render), (gst_base_audio_sink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Handle slaving the internal clock to the clock selected in the
pipeline.
Add property to make the basesink not provide a clock.
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_class_init), (gst_base_rtp_depayload_init),
(gst_base_rtp_depayload_wait):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
We can use the clock in GstElement, no need to store it ourselves.
2005-11-22 18:32:09 +00:00
|
|
|
case PROP_PROVIDE_CLOCK:
|
Expose methods for some object properties so that subclasses can more easily configure them.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_set_provide_clock),
(gst_base_audio_sink_get_provide_clock),
(gst_base_audio_sink_set_slave_method),
(gst_base_audio_sink_get_slave_method),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_drain),
(gst_base_audio_sink_none_slaving),
(gst_base_audio_sink_handle_slaving):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
Added slave method none, that completely disables slaving to the
internal clock.
API: gst_base_audio_sink_set_provide_clock()
API: gst_base_audio_sink_get_provide_clock()
API: gst_base_audio_sink_set_slave_method()
API: gst_base_audio_sink_get_slave_method()
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_set_provide_clock),
(gst_base_audio_src_get_provide_clock),
(gst_base_audio_src_set_property),
(gst_base_audio_src_get_property), (gst_base_audio_src_create):
* gst-libs/gst/audio/gstbaseaudiosrc.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
API: gst_base_audio_src_set_provide_clock()
API: gst_base_audio_src_get_provide_clock()
2007-11-21 13:04:17 +00:00
|
|
|
g_value_set_boolean (value, gst_base_audio_sink_get_provide_clock (sink));
|
gst-libs/gst/audio/gstaudioclock.c: This clock can be slaved to a master clock now.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudioclock.c: (gst_audio_clock_init):
This clock can be slaved to a master clock now.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_dispose), (gst_base_audio_sink_provide_clock),
(gst_base_audio_sink_set_clock),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_preroll),
(gst_base_audio_sink_render), (gst_base_audio_sink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Handle slaving the internal clock to the clock selected in the
pipeline.
Add property to make the basesink not provide a clock.
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_class_init), (gst_base_rtp_depayload_init),
(gst_base_rtp_depayload_wait):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
We can use the clock in GstElement, no need to store it ourselves.
2005-11-22 18:32:09 +00:00
|
|
|
break;
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
case PROP_SLAVE_METHOD:
|
Expose methods for some object properties so that subclasses can more easily configure them.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_set_provide_clock),
(gst_base_audio_sink_get_provide_clock),
(gst_base_audio_sink_set_slave_method),
(gst_base_audio_sink_get_slave_method),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_drain),
(gst_base_audio_sink_none_slaving),
(gst_base_audio_sink_handle_slaving):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
Added slave method none, that completely disables slaving to the
internal clock.
API: gst_base_audio_sink_set_provide_clock()
API: gst_base_audio_sink_get_provide_clock()
API: gst_base_audio_sink_set_slave_method()
API: gst_base_audio_sink_get_slave_method()
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_set_provide_clock),
(gst_base_audio_src_get_provide_clock),
(gst_base_audio_src_set_property),
(gst_base_audio_src_get_property), (gst_base_audio_src_create):
* gst-libs/gst/audio/gstbaseaudiosrc.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
API: gst_base_audio_src_set_provide_clock()
API: gst_base_audio_src_get_provide_clock()
2007-11-21 13:04:17 +00:00
|
|
|
g_value_set_enum (value, gst_base_audio_sink_get_slave_method (sink));
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
break;
|
2009-01-21 11:33:59 +00:00
|
|
|
case PROP_CAN_ACTIVATE_PULL:
|
|
|
|
g_value_set_boolean (value, GST_BASE_SINK (sink)->can_activate_pull);
|
|
|
|
break;
|
2009-11-04 15:16:31 +00:00
|
|
|
case PROP_DRIFT_TOLERANCE:
|
2010-07-30 11:54:42 +00:00
|
|
|
g_value_set_int64 (value, gst_base_audio_sink_get_drift_tolerance (sink));
|
2009-11-04 15:16:31 +00:00
|
|
|
break;
|
2011-05-21 12:49:20 +00:00
|
|
|
case PROP_ALIGNMENT_THRESHOLD:
|
|
|
|
g_value_set_uint64 (value,
|
|
|
|
gst_base_audio_sink_get_alignment_threshold (sink));
|
|
|
|
break;
|
2011-05-02 10:05:28 +00:00
|
|
|
case PROP_DISCONT_WAIT:
|
|
|
|
g_value_set_uint64 (value, gst_base_audio_sink_get_discont_wait (sink));
|
|
|
|
break;
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2005-07-10 12:03:58 +00:00
|
|
|
gst_base_audio_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
{
|
2005-07-10 12:03:58 +00:00
|
|
|
GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (bsink);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
GstRingBufferSpec *spec;
|
2009-09-09 16:24:44 +00:00
|
|
|
GstClockTime now;
|
2010-02-19 11:54:18 +00:00
|
|
|
GstClockTime crate_num, crate_denom;
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
2006-10-13 14:15:42 +00:00
|
|
|
if (!sink->ringbuffer)
|
|
|
|
return FALSE;
|
|
|
|
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
spec = &sink->ringbuffer->spec;
|
|
|
|
|
2006-01-25 09:27:01 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "release old ringbuffer");
|
2005-04-28 16:15:42 +00:00
|
|
|
|
2011-03-28 08:25:38 +00:00
|
|
|
/* get current time, updates the last_time. When the subclass has a clock that
|
|
|
|
* restarts from 0 when a new format is negotiated, it will call
|
|
|
|
* gst_audio_clock_reset() which will use this last_time to create an offset
|
|
|
|
* so that time from the clock keeps on increasing monotonically. */
|
2009-09-09 16:24:44 +00:00
|
|
|
now = gst_clock_get_time (sink->provided_clock);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sink, "time was %" GST_TIME_FORMAT, GST_TIME_ARGS (now));
|
|
|
|
|
2005-07-06 15:27:17 +00:00
|
|
|
/* release old ringbuffer */
|
2008-12-20 12:45:03 +00:00
|
|
|
gst_ring_buffer_pause (sink->ringbuffer);
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
gst_ring_buffer_activate (sink->ringbuffer, FALSE);
|
2005-07-10 12:03:58 +00:00
|
|
|
gst_ring_buffer_release (sink->ringbuffer);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
2006-01-25 09:27:01 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "parse caps");
|
2005-04-28 16:15:42 +00:00
|
|
|
|
|
|
|
spec->buffer_time = sink->buffer_time;
|
|
|
|
spec->latency_time = sink->latency_time;
|
|
|
|
|
2005-07-06 15:27:17 +00:00
|
|
|
/* parse new caps */
|
2005-07-10 12:03:58 +00:00
|
|
|
if (!gst_ring_buffer_parse_caps (spec, caps))
|
2005-07-06 15:27:17 +00:00
|
|
|
goto parse_error;
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
gst_ring_buffer_debug_spec_buff (spec);
|
2005-04-28 16:15:42 +00:00
|
|
|
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "acquire ringbuffer");
|
2005-07-10 12:03:58 +00:00
|
|
|
if (!gst_ring_buffer_acquire (sink->ringbuffer, spec))
|
2005-04-28 16:15:42 +00:00
|
|
|
goto acquire_error;
|
|
|
|
|
2011-11-01 00:34:28 +00:00
|
|
|
if (bsink->pad_mode == GST_PAD_ACTIVATE_PUSH) {
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "activate ringbuffer");
|
|
|
|
gst_ring_buffer_activate (sink->ringbuffer, TRUE);
|
|
|
|
}
|
|
|
|
|
2010-02-19 11:54:18 +00:00
|
|
|
/* due to possible changes in the spec file we should recalibrate the clock */
|
|
|
|
gst_clock_get_calibration (sink->provided_clock, NULL, NULL,
|
|
|
|
&crate_num, &crate_denom);
|
|
|
|
gst_clock_set_calibration (sink->provided_clock,
|
|
|
|
gst_clock_get_internal_time (sink->provided_clock), now, crate_num,
|
|
|
|
crate_denom);
|
|
|
|
|
2009-09-09 14:19:32 +00:00
|
|
|
/* calculate actual latency and buffer times.
|
2006-06-03 21:06:49 +00:00
|
|
|
* FIXME: In 0.11, store the latency_time internally in ns */
|
|
|
|
spec->latency_time = gst_util_uint64_scale (spec->segsize,
|
2011-08-18 17:15:03 +00:00
|
|
|
(GST_SECOND / GST_USECOND), spec->info.rate * spec->info.bpf);
|
2006-06-03 21:06:49 +00:00
|
|
|
|
|
|
|
spec->buffer_time = spec->segtotal * spec->latency_time;
|
2005-04-28 16:15:42 +00:00
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
gst_ring_buffer_debug_spec_buff (spec);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2005-04-28 16:15:42 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
parse_error:
|
|
|
|
{
|
2006-01-25 09:27:01 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "could not parse caps");
|
|
|
|
GST_ELEMENT_ERROR (sink, STREAM, FORMAT,
|
2006-02-12 14:54:55 +00:00
|
|
|
(NULL), ("cannot parse audio format."));
|
2005-04-28 16:15:42 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
acquire_error:
|
|
|
|
{
|
2006-01-25 09:27:01 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "could not acquire ringbuffer");
|
2005-04-28 16:15:42 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
}
|
|
|
|
|
2007-01-12 21:19:35 +00:00
|
|
|
static void
|
|
|
|
gst_base_audio_sink_fixate (GstBaseSink * bsink, GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstStructure *s;
|
|
|
|
gint width, depth;
|
|
|
|
|
|
|
|
s = gst_caps_get_structure (caps, 0);
|
|
|
|
|
|
|
|
/* fields for all formats */
|
|
|
|
gst_structure_fixate_field_nearest_int (s, "rate", 44100);
|
|
|
|
gst_structure_fixate_field_nearest_int (s, "channels", 2);
|
|
|
|
gst_structure_fixate_field_nearest_int (s, "width", 16);
|
|
|
|
|
|
|
|
/* fields for int */
|
|
|
|
if (gst_structure_has_field (s, "depth")) {
|
|
|
|
gst_structure_get_int (s, "width", &width);
|
|
|
|
/* round width to nearest multiple of 8 for the depth */
|
|
|
|
depth = GST_ROUND_UP_8 (width);
|
|
|
|
gst_structure_fixate_field_nearest_int (s, "depth", depth);
|
|
|
|
}
|
|
|
|
if (gst_structure_has_field (s, "signed"))
|
|
|
|
gst_structure_fixate_field_boolean (s, "signed", TRUE);
|
|
|
|
if (gst_structure_has_field (s, "endianness"))
|
|
|
|
gst_structure_fixate_field_nearest_int (s, "endianness", G_BYTE_ORDER);
|
|
|
|
}
|
|
|
|
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
static void
|
2005-07-10 12:03:58 +00:00
|
|
|
gst_base_audio_sink_get_times (GstBaseSink * bsink, GstBuffer * buffer,
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
GstClockTime * start, GstClockTime * end)
|
|
|
|
{
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
/* our clock sync is a bit too much for the base class to handle so
|
|
|
|
* we implement it ourselves. */
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
*start = GST_CLOCK_TIME_NONE;
|
|
|
|
*end = GST_CLOCK_TIME_NONE;
|
|
|
|
}
|
|
|
|
|
2007-10-10 15:36:56 +00:00
|
|
|
/* This waits for the drain to happen and can be canceled */
|
2006-02-02 12:14:35 +00:00
|
|
|
static gboolean
|
|
|
|
gst_base_audio_sink_drain (GstBaseAudioSink * sink)
|
|
|
|
{
|
|
|
|
if (!sink->ringbuffer)
|
|
|
|
return TRUE;
|
2011-08-18 17:15:03 +00:00
|
|
|
if (!sink->ringbuffer->spec.info.rate)
|
2006-02-02 12:14:35 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2011-03-28 20:00:25 +00:00
|
|
|
/* if PLAYING is interrupted,
|
|
|
|
* arrange to have clock running when going to PLAYING again */
|
2011-06-21 16:17:59 +00:00
|
|
|
g_atomic_int_set (&sink->eos_rendering, 1);
|
2011-03-28 20:00:25 +00:00
|
|
|
|
2006-04-28 15:08:09 +00:00
|
|
|
/* need to start playback before we can drain, but only when
|
2007-10-10 15:36:56 +00:00
|
|
|
* we have successfully negotiated a format and thus acquired the
|
2006-04-28 15:08:09 +00:00
|
|
|
* ringbuffer. */
|
|
|
|
if (gst_ring_buffer_is_acquired (sink->ringbuffer))
|
|
|
|
gst_ring_buffer_start (sink->ringbuffer);
|
|
|
|
|
2008-11-25 10:32:49 +00:00
|
|
|
if (sink->priv->eos_time != -1) {
|
2007-10-10 15:36:56 +00:00
|
|
|
GST_DEBUG_OBJECT (sink,
|
2008-11-25 10:32:49 +00:00
|
|
|
"last sample time %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (sink->priv->eos_time));
|
2006-02-02 12:14:35 +00:00
|
|
|
|
2007-10-10 15:36:56 +00:00
|
|
|
/* wait for the EOS time to be reached, this is the time when the last
|
|
|
|
* sample is played. */
|
2008-11-25 10:32:49 +00:00
|
|
|
gst_base_sink_wait_eos (GST_BASE_SINK (sink), sink->priv->eos_time, NULL);
|
2006-02-12 14:54:55 +00:00
|
|
|
|
2008-11-24 12:56:54 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "drained audio");
|
2006-02-02 12:14:35 +00:00
|
|
|
}
|
2011-06-21 16:17:59 +00:00
|
|
|
g_atomic_int_set (&sink->eos_rendering, 0);
|
2006-02-02 12:14:35 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
More work on the audiosink, mostly debugging and a race in shutdown.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_class_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_class_init), (gst_baseaudiosink_init),
(gst_baseaudiosink_get_clock), (gst_baseaudiosink_get_time),
(gst_baseaudiosink_set_property), (build_linear_format),
(debug_spec_caps), (debug_spec_buffer),
(gst_baseaudiosink_setcaps), (gst_baseaudiosink_get_times),
(gst_baseaudiosink_event), (gst_baseaudiosink_preroll),
(gst_baseaudiosink_render), (gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play),
(gst_ringbuffer_pause), (gst_ringbuffer_stop),
(gst_ringbuffer_delay), (gst_ringbuffer_played_samples),
(gst_ringbuffer_set_sample), (wait_segment),
(gst_ringbuffer_commit), (gst_ringbuffer_prepare_read),
(gst_ringbuffer_advance), (gst_ringbuffer_clear):
More work on the audiosink, mostly debugging and a race in
shutdown.
2005-05-05 09:37:46 +00:00
|
|
|
static gboolean
|
2005-07-10 12:03:58 +00:00
|
|
|
gst_base_audio_sink_event (GstBaseSink * bsink, GstEvent * event)
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
{
|
2005-07-10 12:03:58 +00:00
|
|
|
GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (bsink);
|
2005-04-28 16:15:42 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2005-07-27 19:10:20 +00:00
|
|
|
case GST_EVENT_FLUSH_START:
|
2006-04-28 15:08:09 +00:00
|
|
|
if (sink->ringbuffer)
|
|
|
|
gst_ring_buffer_set_flushing (sink->ringbuffer, TRUE);
|
2005-07-27 19:10:20 +00:00
|
|
|
break;
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
2005-09-24 13:06:03 +00:00
|
|
|
/* always resync on sample after a flush */
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
sink->priv->avg_skew = -1;
|
2005-09-24 13:06:03 +00:00
|
|
|
sink->next_sample = -1;
|
2008-11-25 10:32:49 +00:00
|
|
|
sink->priv->eos_time = -1;
|
baseaudiosink: delay the resyncing of timestamp vs ringbuffertime
A common problem for audio-playback is that the timestamps might not
be completely linear. This is specially common when doing streaming over
a network, where you can have jittery and/or bursty packettransmission,
which again will often be reflected on the buffertimestamps.
Now, the current implementation have a threshold that says how far the
buffertimestamp is allowed o drift from the ideal aligned time in the
ringbuffer. This was an instant reaction, and ment that if one buffer
arrived with a timestamp that would breach the drift-tolerance, a resync
would take place, and the result would be an audible gap for the
listener.
The annoying thing would be that in the case of a "timestamp-outlier",
you would first resync one way, say +100ms, and then, if the next
timestamp was "back on track", you would end up resyncing the other way
(-100ms) So in fact, when you had only one buffer with slightly off
timestamping, you would end up with *two* audible gaps. This is the
problem this patch addresses.
The way to "fix" this problem with the previous implementation, would
have been to increase the "drift-tolerance" to a value that was greater
than the largest timestamp-outlier one would normally expect. The big
problem with this approach, however, is that it will allow normal
operations with a huge offset timestamp vs running-time, which is
detrimental to lip-sync. If the drift-tolerance is set to 200ms, it
basically means that lip-sync can easily end up being off by that much.
This patch will basically start a timer when the first breach of
drift-tolerance is detected. If any following timestamp for the next n
nanoseconds gets "back on track" within the threshold, it has basically
eliminated the effect of an outlier, and the timer is stopped. If,
however, all timestamps within this time-limit are breaching the
threshold, we are probably facing a more permanent offset in the
timestamps, and a resync is allowed to happen.
So basically this patch offers something as rare as both higher
accuracy, it terms of allowing smaller drift-tolerances, as well as much
smoother, less glitchy playback!
Commit message and improvments by Havard Graff.
Fixes bug #640859.
2011-11-07 10:31:47 +00:00
|
|
|
sink->priv->discont_time = -1;
|
2006-04-28 15:08:09 +00:00
|
|
|
if (sink->ringbuffer)
|
|
|
|
gst_ring_buffer_set_flushing (sink->ringbuffer, FALSE);
|
2005-04-28 16:15:42 +00:00
|
|
|
break;
|
2005-07-20 09:08:05 +00:00
|
|
|
case GST_EVENT_EOS:
|
2006-01-25 09:27:01 +00:00
|
|
|
/* now wait till we played everything */
|
2006-02-02 12:14:35 +00:00
|
|
|
gst_base_audio_sink_drain (sink);
|
2005-07-20 09:08:05 +00:00
|
|
|
break;
|
2005-04-28 16:15:42 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
More work on the audiosink, mostly debugging and a race in shutdown.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_class_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_class_init), (gst_baseaudiosink_init),
(gst_baseaudiosink_get_clock), (gst_baseaudiosink_get_time),
(gst_baseaudiosink_set_property), (build_linear_format),
(debug_spec_caps), (debug_spec_buffer),
(gst_baseaudiosink_setcaps), (gst_baseaudiosink_get_times),
(gst_baseaudiosink_event), (gst_baseaudiosink_preroll),
(gst_baseaudiosink_render), (gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play),
(gst_ringbuffer_pause), (gst_ringbuffer_stop),
(gst_ringbuffer_delay), (gst_ringbuffer_played_samples),
(gst_ringbuffer_set_sample), (wait_segment),
(gst_ringbuffer_commit), (gst_ringbuffer_prepare_read),
(gst_ringbuffer_advance), (gst_ringbuffer_clear):
More work on the audiosink, mostly debugging and a race in
shutdown.
2005-05-05 09:37:46 +00:00
|
|
|
return TRUE;
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2005-07-10 12:03:58 +00:00
|
|
|
gst_base_audio_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer)
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
{
|
2005-07-10 12:03:58 +00:00
|
|
|
GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (bsink);
|
2005-07-06 15:27:17 +00:00
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
if (!gst_ring_buffer_is_acquired (sink->ringbuffer))
|
2005-07-06 15:27:17 +00:00
|
|
|
goto wrong_state;
|
|
|
|
|
2005-05-05 10:42:41 +00:00
|
|
|
/* we don't really do anything when prerolling. We could make a
|
|
|
|
* property to play this buffer to have some sort of scrubbing
|
|
|
|
* support. */
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
return GST_FLOW_OK;
|
2005-07-06 15:27:17 +00:00
|
|
|
|
|
|
|
wrong_state:
|
|
|
|
{
|
2006-01-25 09:27:01 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "ringbuffer in wrong state");
|
2006-02-12 14:54:55 +00:00
|
|
|
GST_ELEMENT_ERROR (sink, STREAM, FORMAT, (NULL), ("sink not negotiated."));
|
gst-libs/gst/audio/gstaudioclock.c: This clock can be slaved to a master clock now.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudioclock.c: (gst_audio_clock_init):
This clock can be slaved to a master clock now.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_dispose), (gst_base_audio_sink_provide_clock),
(gst_base_audio_sink_set_clock),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_preroll),
(gst_base_audio_sink_render), (gst_base_audio_sink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Handle slaving the internal clock to the clock selected in the
pipeline.
Add property to make the basesink not provide a clock.
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_class_init), (gst_base_rtp_depayload_init),
(gst_base_rtp_depayload_wait):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
We can use the clock in GstElement, no need to store it ourselves.
2005-11-22 18:32:09 +00:00
|
|
|
return GST_FLOW_NOT_NEGOTIATED;
|
2005-07-06 15:27:17 +00:00
|
|
|
}
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
}
|
|
|
|
|
2005-10-24 14:52:22 +00:00
|
|
|
static guint64
|
|
|
|
gst_base_audio_sink_get_offset (GstBaseAudioSink * sink)
|
|
|
|
{
|
|
|
|
guint64 sample;
|
|
|
|
gint writeseg, segdone, sps;
|
|
|
|
gint diff;
|
|
|
|
|
|
|
|
/* assume we can append to the previous sample */
|
|
|
|
sample = sink->next_sample;
|
2006-02-17 10:15:52 +00:00
|
|
|
/* no previous sample, try to insert at position 0 */
|
|
|
|
if (sample == -1)
|
|
|
|
sample = 0;
|
2005-10-24 14:52:22 +00:00
|
|
|
|
|
|
|
sps = sink->ringbuffer->samples_per_seg;
|
|
|
|
|
|
|
|
/* figure out the segment and the offset inside the segment where
|
|
|
|
* the sample should be written. */
|
|
|
|
writeseg = sample / sps;
|
|
|
|
|
|
|
|
/* get the currently processed segment */
|
|
|
|
segdone = g_atomic_int_get (&sink->ringbuffer->segdone)
|
|
|
|
- sink->ringbuffer->segbase;
|
|
|
|
|
|
|
|
/* see how far away it is from the write segment */
|
|
|
|
diff = writeseg - segdone;
|
|
|
|
if (diff < 0) {
|
|
|
|
/* sample would be dropped, position to next playable position */
|
|
|
|
sample = (segdone + 1) * sps;
|
|
|
|
}
|
|
|
|
|
|
|
|
return sample;
|
|
|
|
}
|
|
|
|
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
static GstClockTime
|
|
|
|
clock_convert_external (GstClockTime external, GstClockTime cinternal,
|
2008-05-09 16:38:10 +00:00
|
|
|
GstClockTime cexternal, GstClockTime crate_num, GstClockTime crate_denom)
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
{
|
|
|
|
/* adjust for rate and speed */
|
|
|
|
if (external >= cexternal) {
|
|
|
|
external =
|
|
|
|
gst_util_uint64_scale (external - cexternal, crate_denom, crate_num);
|
|
|
|
external += cinternal;
|
|
|
|
} else {
|
2008-11-24 12:56:54 +00:00
|
|
|
external =
|
|
|
|
gst_util_uint64_scale (cexternal - external, crate_denom, crate_num);
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
if (cinternal > external)
|
|
|
|
external = cinternal - external;
|
|
|
|
else
|
|
|
|
external = 0;
|
|
|
|
}
|
|
|
|
return external;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* algorithm to calculate sample positions that will result in resampling to
|
|
|
|
* match the clock rate of the master */
|
|
|
|
static void
|
|
|
|
gst_base_audio_sink_resample_slaving (GstBaseAudioSink * sink,
|
|
|
|
GstClockTime render_start, GstClockTime render_stop,
|
|
|
|
GstClockTime * srender_start, GstClockTime * srender_stop)
|
|
|
|
{
|
|
|
|
GstClockTime cinternal, cexternal;
|
|
|
|
GstClockTime crate_num, crate_denom;
|
|
|
|
|
2008-05-20 11:09:06 +00:00
|
|
|
/* FIXME, we can sample and add observations here or use the timeouts on the
|
|
|
|
* clock. No idea which one is better or more stable. The timeout seems more
|
|
|
|
* arbitrary but this one seems more demanding and does not work when there is
|
|
|
|
* no data comming in to the sink. */
|
|
|
|
#if 0
|
|
|
|
GstClockTime etime, itime;
|
|
|
|
gdouble r_squared;
|
|
|
|
|
|
|
|
/* sample clocks and figure out clock skew */
|
|
|
|
etime = gst_clock_get_time (GST_ELEMENT_CLOCK (sink));
|
2009-04-14 11:12:59 +00:00
|
|
|
itime = gst_audio_clock_get_time (sink->provided_clock);
|
2008-05-20 11:09:06 +00:00
|
|
|
|
|
|
|
/* add new observation */
|
|
|
|
gst_clock_add_observation (sink->provided_clock, itime, etime, &r_squared);
|
|
|
|
#endif
|
|
|
|
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
/* get calibration parameters to compensate for speed and offset differences
|
|
|
|
* when we are slaved */
|
|
|
|
gst_clock_get_calibration (sink->provided_clock, &cinternal, &cexternal,
|
|
|
|
&crate_num, &crate_denom);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sink, "internal %" GST_TIME_FORMAT " external %"
|
|
|
|
GST_TIME_FORMAT " %" G_GUINT64_FORMAT "/%" G_GUINT64_FORMAT " = %f",
|
|
|
|
GST_TIME_ARGS (cinternal), GST_TIME_ARGS (cexternal), crate_num,
|
|
|
|
crate_denom, gst_guint64_to_gdouble (crate_num) /
|
|
|
|
gst_guint64_to_gdouble (crate_denom));
|
|
|
|
|
|
|
|
if (crate_num == 0)
|
|
|
|
crate_denom = crate_num = 1;
|
|
|
|
|
|
|
|
/* bring external time to internal time */
|
|
|
|
render_start = clock_convert_external (render_start, cinternal, cexternal,
|
2008-05-09 16:38:10 +00:00
|
|
|
crate_num, crate_denom);
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
render_stop = clock_convert_external (render_stop, cinternal, cexternal,
|
2008-05-09 16:38:10 +00:00
|
|
|
crate_num, crate_denom);
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"after slaving: start %" GST_TIME_FORMAT " - stop %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (render_start), GST_TIME_ARGS (render_stop));
|
|
|
|
|
|
|
|
*srender_start = render_start;
|
|
|
|
*srender_stop = render_stop;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* algorithm to calculate sample positions that will result in changing the
|
|
|
|
* playout pointer to match the clock rate of the master */
|
|
|
|
static void
|
|
|
|
gst_base_audio_sink_skew_slaving (GstBaseAudioSink * sink,
|
|
|
|
GstClockTime render_start, GstClockTime render_stop,
|
|
|
|
GstClockTime * srender_start, GstClockTime * srender_stop)
|
|
|
|
{
|
|
|
|
GstClockTime cinternal, cexternal, crate_num, crate_denom;
|
|
|
|
GstClockTime etime, itime;
|
2009-11-04 15:16:31 +00:00
|
|
|
GstClockTimeDiff skew, mdrift, mdrift2;
|
|
|
|
gint driftsamples;
|
2007-09-03 19:17:33 +00:00
|
|
|
gint64 last_align;
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
|
|
|
|
/* get calibration parameters to compensate for offsets */
|
|
|
|
gst_clock_get_calibration (sink->provided_clock, &cinternal, &cexternal,
|
|
|
|
&crate_num, &crate_denom);
|
|
|
|
|
|
|
|
/* sample clocks and figure out clock skew */
|
|
|
|
etime = gst_clock_get_time (GST_ELEMENT_CLOCK (sink));
|
2009-04-14 11:12:59 +00:00
|
|
|
itime = gst_audio_clock_get_time (sink->provided_clock);
|
2009-11-25 16:26:16 +00:00
|
|
|
itime = gst_audio_clock_adjust (sink->provided_clock, itime);
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
|
2008-05-20 11:09:06 +00:00
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"internal %" GST_TIME_FORMAT " external %" GST_TIME_FORMAT
|
|
|
|
" cinternal %" GST_TIME_FORMAT " cexternal %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (itime), GST_TIME_ARGS (etime),
|
|
|
|
GST_TIME_ARGS (cinternal), GST_TIME_ARGS (cexternal));
|
|
|
|
|
2008-04-03 10:37:03 +00:00
|
|
|
/* make sure we never go below 0 */
|
|
|
|
etime = etime > cexternal ? etime - cexternal : 0;
|
|
|
|
itime = itime > cinternal ? itime - cinternal : 0;
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
|
2008-05-09 16:38:10 +00:00
|
|
|
/* do itime - etime.
|
|
|
|
* positive value means external clock goes slower
|
|
|
|
* negative value means external clock goes faster */
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
skew = GST_CLOCK_DIFF (etime, itime);
|
|
|
|
if (sink->priv->avg_skew == -1) {
|
|
|
|
/* first observation */
|
|
|
|
sink->priv->avg_skew = skew;
|
|
|
|
} else {
|
|
|
|
/* next observations use a moving average */
|
|
|
|
sink->priv->avg_skew = (31 * sink->priv->avg_skew + skew) / 32;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sink, "internal %" GST_TIME_FORMAT " external %"
|
|
|
|
GST_TIME_FORMAT " skew %" G_GINT64_FORMAT " avg %" G_GINT64_FORMAT,
|
|
|
|
GST_TIME_ARGS (itime), GST_TIME_ARGS (etime), skew, sink->priv->avg_skew);
|
|
|
|
|
2009-11-04 15:16:31 +00:00
|
|
|
/* the max drift we allow */
|
|
|
|
mdrift = sink->priv->drift_tolerance * 1000;
|
|
|
|
mdrift2 = mdrift / 2;
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
|
|
|
|
/* adjust playout pointer based on skew */
|
2009-11-04 15:16:31 +00:00
|
|
|
if (sink->priv->avg_skew > mdrift2) {
|
2007-04-05 15:44:40 +00:00
|
|
|
/* master is running slower, move internal time forward */
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
GST_WARNING_OBJECT (sink,
|
|
|
|
"correct clock skew %" G_GINT64_FORMAT " > %" G_GINT64_FORMAT,
|
2009-11-04 15:16:31 +00:00
|
|
|
sink->priv->avg_skew, mdrift2);
|
|
|
|
cexternal = cexternal > mdrift ? cexternal - mdrift : 0;
|
|
|
|
sink->priv->avg_skew -= mdrift;
|
2007-09-03 19:17:33 +00:00
|
|
|
|
2011-08-18 17:15:03 +00:00
|
|
|
driftsamples = (sink->ringbuffer->spec.info.rate * mdrift) / GST_SECOND;
|
2007-09-03 19:17:33 +00:00
|
|
|
last_align = sink->priv->last_align;
|
|
|
|
|
|
|
|
/* if we were aligning in the wrong direction or we aligned more than what we
|
|
|
|
* will correct, resync */
|
2009-11-04 15:16:31 +00:00
|
|
|
if (last_align < 0 || last_align > driftsamples)
|
2007-09-03 19:17:33 +00:00
|
|
|
sink->next_sample = -1;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sink,
|
2009-11-04 15:16:31 +00:00
|
|
|
"last_align %" G_GINT64_FORMAT " driftsamples %u, next %"
|
|
|
|
G_GUINT64_FORMAT, last_align, driftsamples, sink->next_sample);
|
2007-09-03 19:17:33 +00:00
|
|
|
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
gst_clock_set_calibration (sink->provided_clock, cinternal, cexternal,
|
|
|
|
crate_num, crate_denom);
|
2009-11-04 15:16:31 +00:00
|
|
|
} else if (sink->priv->avg_skew < -mdrift2) {
|
2007-04-05 15:44:40 +00:00
|
|
|
/* master is running faster, move external time forwards */
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
GST_WARNING_OBJECT (sink,
|
|
|
|
"correct clock skew %" G_GINT64_FORMAT " < %" G_GINT64_FORMAT,
|
2009-11-04 15:16:31 +00:00
|
|
|
sink->priv->avg_skew, -mdrift2);
|
|
|
|
cexternal += mdrift;
|
|
|
|
sink->priv->avg_skew += mdrift;
|
2007-09-03 19:17:33 +00:00
|
|
|
|
2011-08-18 17:15:03 +00:00
|
|
|
driftsamples = (sink->ringbuffer->spec.info.rate * mdrift) / GST_SECOND;
|
2007-09-03 19:17:33 +00:00
|
|
|
last_align = sink->priv->last_align;
|
|
|
|
|
|
|
|
/* if we were aligning in the wrong direction or we aligned more than what we
|
|
|
|
* will correct, resync */
|
2009-11-04 15:16:31 +00:00
|
|
|
if (last_align > 0 || -last_align > driftsamples)
|
2007-09-03 19:17:33 +00:00
|
|
|
sink->next_sample = -1;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sink,
|
2009-11-04 15:16:31 +00:00
|
|
|
"last_align %" G_GINT64_FORMAT " driftsamples %u, next %"
|
|
|
|
G_GUINT64_FORMAT, last_align, driftsamples, sink->next_sample);
|
2007-09-03 19:17:33 +00:00
|
|
|
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
gst_clock_set_calibration (sink->provided_clock, cinternal, cexternal,
|
|
|
|
crate_num, crate_denom);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* convert, ignoring speed */
|
|
|
|
render_start = clock_convert_external (render_start, cinternal, cexternal,
|
2008-05-09 16:38:10 +00:00
|
|
|
crate_num, crate_denom);
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
render_stop = clock_convert_external (render_stop, cinternal, cexternal,
|
2008-05-09 16:38:10 +00:00
|
|
|
crate_num, crate_denom);
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
|
|
|
|
*srender_start = render_start;
|
|
|
|
*srender_stop = render_stop;
|
|
|
|
}
|
|
|
|
|
Expose methods for some object properties so that subclasses can more easily configure them.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_set_provide_clock),
(gst_base_audio_sink_get_provide_clock),
(gst_base_audio_sink_set_slave_method),
(gst_base_audio_sink_get_slave_method),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_drain),
(gst_base_audio_sink_none_slaving),
(gst_base_audio_sink_handle_slaving):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
Added slave method none, that completely disables slaving to the
internal clock.
API: gst_base_audio_sink_set_provide_clock()
API: gst_base_audio_sink_get_provide_clock()
API: gst_base_audio_sink_set_slave_method()
API: gst_base_audio_sink_get_slave_method()
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_set_provide_clock),
(gst_base_audio_src_get_provide_clock),
(gst_base_audio_src_set_property),
(gst_base_audio_src_get_property), (gst_base_audio_src_create):
* gst-libs/gst/audio/gstbaseaudiosrc.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
API: gst_base_audio_src_set_provide_clock()
API: gst_base_audio_src_get_provide_clock()
2007-11-21 13:04:17 +00:00
|
|
|
/* apply the clock offset but do no slaving otherwise */
|
|
|
|
static void
|
|
|
|
gst_base_audio_sink_none_slaving (GstBaseAudioSink * sink,
|
|
|
|
GstClockTime render_start, GstClockTime render_stop,
|
|
|
|
GstClockTime * srender_start, GstClockTime * srender_stop)
|
|
|
|
{
|
|
|
|
GstClockTime cinternal, cexternal, crate_num, crate_denom;
|
|
|
|
|
|
|
|
/* get calibration parameters to compensate for offsets */
|
|
|
|
gst_clock_get_calibration (sink->provided_clock, &cinternal, &cexternal,
|
|
|
|
&crate_num, &crate_denom);
|
|
|
|
|
|
|
|
/* convert, ignoring speed */
|
|
|
|
render_start = clock_convert_external (render_start, cinternal, cexternal,
|
2008-05-09 16:38:10 +00:00
|
|
|
crate_num, crate_denom);
|
Expose methods for some object properties so that subclasses can more easily configure them.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_set_provide_clock),
(gst_base_audio_sink_get_provide_clock),
(gst_base_audio_sink_set_slave_method),
(gst_base_audio_sink_get_slave_method),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_drain),
(gst_base_audio_sink_none_slaving),
(gst_base_audio_sink_handle_slaving):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
Added slave method none, that completely disables slaving to the
internal clock.
API: gst_base_audio_sink_set_provide_clock()
API: gst_base_audio_sink_get_provide_clock()
API: gst_base_audio_sink_set_slave_method()
API: gst_base_audio_sink_get_slave_method()
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_set_provide_clock),
(gst_base_audio_src_get_provide_clock),
(gst_base_audio_src_set_property),
(gst_base_audio_src_get_property), (gst_base_audio_src_create):
* gst-libs/gst/audio/gstbaseaudiosrc.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
API: gst_base_audio_src_set_provide_clock()
API: gst_base_audio_src_get_provide_clock()
2007-11-21 13:04:17 +00:00
|
|
|
render_stop = clock_convert_external (render_stop, cinternal, cexternal,
|
2008-05-09 16:38:10 +00:00
|
|
|
crate_num, crate_denom);
|
Expose methods for some object properties so that subclasses can more easily configure them.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_set_provide_clock),
(gst_base_audio_sink_get_provide_clock),
(gst_base_audio_sink_set_slave_method),
(gst_base_audio_sink_get_slave_method),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_drain),
(gst_base_audio_sink_none_slaving),
(gst_base_audio_sink_handle_slaving):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
Added slave method none, that completely disables slaving to the
internal clock.
API: gst_base_audio_sink_set_provide_clock()
API: gst_base_audio_sink_get_provide_clock()
API: gst_base_audio_sink_set_slave_method()
API: gst_base_audio_sink_get_slave_method()
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_set_provide_clock),
(gst_base_audio_src_get_provide_clock),
(gst_base_audio_src_set_property),
(gst_base_audio_src_get_property), (gst_base_audio_src_create):
* gst-libs/gst/audio/gstbaseaudiosrc.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
API: gst_base_audio_src_set_provide_clock()
API: gst_base_audio_src_get_provide_clock()
2007-11-21 13:04:17 +00:00
|
|
|
|
|
|
|
*srender_start = render_start;
|
|
|
|
*srender_stop = render_stop;
|
|
|
|
}
|
|
|
|
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
/* converts render_start and render_stop to their slaved values */
|
|
|
|
static void
|
|
|
|
gst_base_audio_sink_handle_slaving (GstBaseAudioSink * sink,
|
|
|
|
GstClockTime render_start, GstClockTime render_stop,
|
|
|
|
GstClockTime * srender_start, GstClockTime * srender_stop)
|
|
|
|
{
|
|
|
|
switch (sink->priv->slave_method) {
|
|
|
|
case GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE:
|
|
|
|
gst_base_audio_sink_resample_slaving (sink, render_start, render_stop,
|
|
|
|
srender_start, srender_stop);
|
|
|
|
break;
|
|
|
|
case GST_BASE_AUDIO_SINK_SLAVE_SKEW:
|
|
|
|
gst_base_audio_sink_skew_slaving (sink, render_start, render_stop,
|
|
|
|
srender_start, srender_stop);
|
|
|
|
break;
|
Expose methods for some object properties so that subclasses can more easily configure them.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_set_provide_clock),
(gst_base_audio_sink_get_provide_clock),
(gst_base_audio_sink_set_slave_method),
(gst_base_audio_sink_get_slave_method),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_drain),
(gst_base_audio_sink_none_slaving),
(gst_base_audio_sink_handle_slaving):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
Added slave method none, that completely disables slaving to the
internal clock.
API: gst_base_audio_sink_set_provide_clock()
API: gst_base_audio_sink_get_provide_clock()
API: gst_base_audio_sink_set_slave_method()
API: gst_base_audio_sink_get_slave_method()
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_set_provide_clock),
(gst_base_audio_src_get_provide_clock),
(gst_base_audio_src_set_property),
(gst_base_audio_src_get_property), (gst_base_audio_src_create):
* gst-libs/gst/audio/gstbaseaudiosrc.h:
Expose methods for some object properties so that subclasses can more
easily configure them.
API: gst_base_audio_src_set_provide_clock()
API: gst_base_audio_src_get_provide_clock()
2007-11-21 13:04:17 +00:00
|
|
|
case GST_BASE_AUDIO_SINK_SLAVE_NONE:
|
|
|
|
gst_base_audio_sink_none_slaving (sink, render_start, render_stop,
|
|
|
|
srender_start, srender_stop);
|
|
|
|
break;
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
default:
|
|
|
|
g_warning ("unknown slaving method %d", sink->priv->slave_method);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-20 11:09:06 +00:00
|
|
|
/* must be called with LOCK */
|
|
|
|
static GstFlowReturn
|
2008-11-10 14:22:09 +00:00
|
|
|
gst_base_audio_sink_sync_latency (GstBaseSink * bsink, GstMiniObject * obj)
|
2008-05-20 11:09:06 +00:00
|
|
|
{
|
|
|
|
GstClock *clock;
|
|
|
|
GstClockReturn status;
|
2010-09-24 10:54:47 +00:00
|
|
|
GstClockTime time, render_delay;
|
2008-05-20 11:09:06 +00:00
|
|
|
GstFlowReturn ret;
|
|
|
|
GstBaseAudioSink *sink;
|
|
|
|
GstClockTime itime, etime;
|
|
|
|
GstClockTime rate_num, rate_denom;
|
2008-05-20 16:26:53 +00:00
|
|
|
GstClockTimeDiff jitter;
|
2008-05-20 11:09:06 +00:00
|
|
|
|
|
|
|
sink = GST_BASE_AUDIO_SINK (bsink);
|
|
|
|
|
|
|
|
clock = GST_ELEMENT_CLOCK (sink);
|
|
|
|
if (G_UNLIKELY (clock == NULL))
|
|
|
|
goto no_clock;
|
|
|
|
|
|
|
|
/* we provided the global clock, don't need to do anything special */
|
|
|
|
if (clock == sink->provided_clock)
|
|
|
|
goto no_slaving;
|
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
|
|
|
do {
|
|
|
|
GST_DEBUG_OBJECT (sink, "checking preroll");
|
|
|
|
|
2008-11-10 14:22:09 +00:00
|
|
|
ret = gst_base_sink_do_preroll (bsink, obj);
|
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto flushing;
|
2008-05-20 11:09:06 +00:00
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
time = sink->priv->us_latency;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
2010-09-24 10:54:47 +00:00
|
|
|
/* Renderdelay is added onto our own latency, and needs
|
|
|
|
* to be subtracted as well */
|
|
|
|
render_delay = gst_base_sink_get_render_delay (bsink);
|
|
|
|
|
|
|
|
if (G_LIKELY (time > render_delay))
|
|
|
|
time -= render_delay;
|
|
|
|
else
|
|
|
|
time = 0;
|
|
|
|
|
2008-05-20 11:09:06 +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));
|
|
|
|
|
2009-09-09 14:19:32 +00:00
|
|
|
/* wait for the clock, this can be interrupted because we got shut down or
|
2008-05-20 11:09:06 +00:00
|
|
|
* we PAUSED. */
|
|
|
|
status = gst_base_sink_wait_clock (bsink, time, &jitter);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sink, "clock returned %d %" GST_TIME_FORMAT, status,
|
|
|
|
GST_TIME_ARGS (jitter));
|
|
|
|
|
|
|
|
/* 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 (bsink->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_OBJECT_LOCK (sink);
|
|
|
|
GST_DEBUG_OBJECT (sink, "latency synced");
|
|
|
|
|
2008-05-20 16:26:53 +00:00
|
|
|
/* when we prerolled in time, we can accurately set the calibration,
|
|
|
|
* our internal clock should exactly have been the latency (== the running
|
|
|
|
* time of the external clock) */
|
|
|
|
etime = GST_ELEMENT_CAST (sink)->base_time + time;
|
2009-04-14 11:12:59 +00:00
|
|
|
itime = gst_audio_clock_get_time (sink->provided_clock);
|
2009-11-18 16:09:28 +00:00
|
|
|
itime = gst_audio_clock_adjust (sink->provided_clock, itime);
|
2008-05-20 16:26:53 +00:00
|
|
|
|
|
|
|
if (status == GST_CLOCK_EARLY) {
|
|
|
|
/* when we prerolled late, we have to take into account the lateness */
|
|
|
|
GST_DEBUG_OBJECT (sink, "late preroll, adding jitter");
|
|
|
|
etime += jitter;
|
2008-05-20 11:09:06 +00:00
|
|
|
}
|
2008-05-20 16:26:53 +00:00
|
|
|
|
|
|
|
/* start ringbuffer so we can start slaving right away when we need to */
|
|
|
|
gst_ring_buffer_start (sink->ringbuffer);
|
|
|
|
|
2008-05-20 11:09:06 +00:00
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"internal time: %" GST_TIME_FORMAT " external time: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (itime), GST_TIME_ARGS (etime));
|
|
|
|
|
|
|
|
/* copy the original calibrated rate but update the internal and external
|
|
|
|
* times. */
|
|
|
|
gst_clock_get_calibration (sink->provided_clock, NULL, NULL, &rate_num,
|
|
|
|
&rate_denom);
|
|
|
|
gst_clock_set_calibration (sink->provided_clock, itime, etime,
|
|
|
|
rate_num, rate_denom);
|
|
|
|
|
|
|
|
switch (sink->priv->slave_method) {
|
|
|
|
case GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE:
|
|
|
|
/* only set as master when we are resampling */
|
|
|
|
GST_DEBUG_OBJECT (sink, "Setting clock as master");
|
|
|
|
gst_clock_set_master (sink->provided_clock, clock);
|
|
|
|
break;
|
|
|
|
case GST_BASE_AUDIO_SINK_SLAVE_SKEW:
|
|
|
|
case GST_BASE_AUDIO_SINK_SLAVE_NONE:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
sink->priv->avg_skew = -1;
|
|
|
|
sink->next_sample = -1;
|
2008-11-25 10:32:49 +00:00
|
|
|
sink->priv->eos_time = -1;
|
baseaudiosink: delay the resyncing of timestamp vs ringbuffertime
A common problem for audio-playback is that the timestamps might not
be completely linear. This is specially common when doing streaming over
a network, where you can have jittery and/or bursty packettransmission,
which again will often be reflected on the buffertimestamps.
Now, the current implementation have a threshold that says how far the
buffertimestamp is allowed o drift from the ideal aligned time in the
ringbuffer. This was an instant reaction, and ment that if one buffer
arrived with a timestamp that would breach the drift-tolerance, a resync
would take place, and the result would be an audible gap for the
listener.
The annoying thing would be that in the case of a "timestamp-outlier",
you would first resync one way, say +100ms, and then, if the next
timestamp was "back on track", you would end up resyncing the other way
(-100ms) So in fact, when you had only one buffer with slightly off
timestamping, you would end up with *two* audible gaps. This is the
problem this patch addresses.
The way to "fix" this problem with the previous implementation, would
have been to increase the "drift-tolerance" to a value that was greater
than the largest timestamp-outlier one would normally expect. The big
problem with this approach, however, is that it will allow normal
operations with a huge offset timestamp vs running-time, which is
detrimental to lip-sync. If the drift-tolerance is set to 200ms, it
basically means that lip-sync can easily end up being off by that much.
This patch will basically start a timer when the first breach of
drift-tolerance is detected. If any following timestamp for the next n
nanoseconds gets "back on track" within the threshold, it has basically
eliminated the effect of an outlier, and the timer is stopped. If,
however, all timestamps within this time-limit are breaching the
threshold, we are probably facing a more permanent offset in the
timestamps, and a resync is allowed to happen.
So basically this patch offers something as rare as both higher
accuracy, it terms of allowing smaller drift-tolerances, as well as much
smoother, less glitchy playback!
Commit message and improvments by Havard Graff.
Fixes bug #640859.
2011-11-07 10:31:47 +00:00
|
|
|
sink->priv->discont_time = -1;
|
2008-05-20 11:09:06 +00:00
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_clock:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (sink, "we have no clock");
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
no_slaving:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (sink, "we are not slaved");
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
flushing:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (sink, "we are flushing");
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
return GST_FLOW_WRONG_STATE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-08 17:27:43 +00:00
|
|
|
static gint64
|
2011-04-04 09:31:33 +00:00
|
|
|
gst_base_audio_sink_get_alignment (GstBaseAudioSink * sink,
|
|
|
|
GstClockTime sample_offset)
|
2011-02-08 17:27:43 +00:00
|
|
|
{
|
|
|
|
GstRingBuffer *ringbuf = sink->ringbuffer;
|
|
|
|
gint64 align;
|
2011-11-07 10:18:34 +00:00
|
|
|
gint64 sample_diff;
|
|
|
|
gint64 max_sample_diff;
|
2011-02-08 17:27:43 +00:00
|
|
|
gint segdone = g_atomic_int_get (&ringbuf->segdone) - ringbuf->segbase;
|
|
|
|
gint64 samples_done = segdone * ringbuf->samples_per_seg;
|
|
|
|
gint64 headroom = sample_offset - samples_done;
|
|
|
|
gboolean allow_align = TRUE;
|
baseaudiosink: delay the resyncing of timestamp vs ringbuffertime
A common problem for audio-playback is that the timestamps might not
be completely linear. This is specially common when doing streaming over
a network, where you can have jittery and/or bursty packettransmission,
which again will often be reflected on the buffertimestamps.
Now, the current implementation have a threshold that says how far the
buffertimestamp is allowed o drift from the ideal aligned time in the
ringbuffer. This was an instant reaction, and ment that if one buffer
arrived with a timestamp that would breach the drift-tolerance, a resync
would take place, and the result would be an audible gap for the
listener.
The annoying thing would be that in the case of a "timestamp-outlier",
you would first resync one way, say +100ms, and then, if the next
timestamp was "back on track", you would end up resyncing the other way
(-100ms) So in fact, when you had only one buffer with slightly off
timestamping, you would end up with *two* audible gaps. This is the
problem this patch addresses.
The way to "fix" this problem with the previous implementation, would
have been to increase the "drift-tolerance" to a value that was greater
than the largest timestamp-outlier one would normally expect. The big
problem with this approach, however, is that it will allow normal
operations with a huge offset timestamp vs running-time, which is
detrimental to lip-sync. If the drift-tolerance is set to 200ms, it
basically means that lip-sync can easily end up being off by that much.
This patch will basically start a timer when the first breach of
drift-tolerance is detected. If any following timestamp for the next n
nanoseconds gets "back on track" within the threshold, it has basically
eliminated the effect of an outlier, and the timer is stopped. If,
however, all timestamps within this time-limit are breaching the
threshold, we are probably facing a more permanent offset in the
timestamps, and a resync is allowed to happen.
So basically this patch offers something as rare as both higher
accuracy, it terms of allowing smaller drift-tolerances, as well as much
smoother, less glitchy playback!
Commit message and improvments by Havard Graff.
Fixes bug #640859.
2011-11-07 10:31:47 +00:00
|
|
|
gboolean discont = FALSE;
|
2011-08-18 17:15:03 +00:00
|
|
|
gint rate;
|
2011-02-08 17:27:43 +00:00
|
|
|
|
|
|
|
/* now try to align the sample to the previous one, first see how big the
|
|
|
|
* difference is. */
|
|
|
|
if (sample_offset >= sink->next_sample)
|
2011-11-07 10:18:34 +00:00
|
|
|
sample_diff = sample_offset - sink->next_sample;
|
2011-02-08 17:27:43 +00:00
|
|
|
else
|
2011-11-07 10:18:34 +00:00
|
|
|
sample_diff = sink->next_sample - sample_offset;
|
2011-02-08 17:27:43 +00:00
|
|
|
|
2011-08-18 17:15:03 +00:00
|
|
|
rate = GST_AUDIO_INFO_RATE (&ringbuf->spec.info);
|
|
|
|
|
2011-05-21 12:49:20 +00:00
|
|
|
/* calculate the max allowed drift in units of samples. */
|
2011-05-21 13:16:42 +00:00
|
|
|
max_sample_diff = gst_util_uint64_scale_int (sink->priv->alignment_threshold,
|
2011-11-07 11:23:15 +00:00
|
|
|
rate, GST_SECOND);
|
2011-02-08 17:27:43 +00:00
|
|
|
|
|
|
|
/* calc align with previous sample */
|
|
|
|
align = sink->next_sample - sample_offset;
|
|
|
|
|
|
|
|
/* don't align if it means writing behind the read-segment */
|
2011-11-07 10:18:34 +00:00
|
|
|
if (sample_diff > headroom && align < 0)
|
2011-02-08 17:27:43 +00:00
|
|
|
allow_align = FALSE;
|
|
|
|
|
baseaudiosink: delay the resyncing of timestamp vs ringbuffertime
A common problem for audio-playback is that the timestamps might not
be completely linear. This is specially common when doing streaming over
a network, where you can have jittery and/or bursty packettransmission,
which again will often be reflected on the buffertimestamps.
Now, the current implementation have a threshold that says how far the
buffertimestamp is allowed o drift from the ideal aligned time in the
ringbuffer. This was an instant reaction, and ment that if one buffer
arrived with a timestamp that would breach the drift-tolerance, a resync
would take place, and the result would be an audible gap for the
listener.
The annoying thing would be that in the case of a "timestamp-outlier",
you would first resync one way, say +100ms, and then, if the next
timestamp was "back on track", you would end up resyncing the other way
(-100ms) So in fact, when you had only one buffer with slightly off
timestamping, you would end up with *two* audible gaps. This is the
problem this patch addresses.
The way to "fix" this problem with the previous implementation, would
have been to increase the "drift-tolerance" to a value that was greater
than the largest timestamp-outlier one would normally expect. The big
problem with this approach, however, is that it will allow normal
operations with a huge offset timestamp vs running-time, which is
detrimental to lip-sync. If the drift-tolerance is set to 200ms, it
basically means that lip-sync can easily end up being off by that much.
This patch will basically start a timer when the first breach of
drift-tolerance is detected. If any following timestamp for the next n
nanoseconds gets "back on track" within the threshold, it has basically
eliminated the effect of an outlier, and the timer is stopped. If,
however, all timestamps within this time-limit are breaching the
threshold, we are probably facing a more permanent offset in the
timestamps, and a resync is allowed to happen.
So basically this patch offers something as rare as both higher
accuracy, it terms of allowing smaller drift-tolerances, as well as much
smoother, less glitchy playback!
Commit message and improvments by Havard Graff.
Fixes bug #640859.
2011-11-07 10:31:47 +00:00
|
|
|
if (G_UNLIKELY (sample_diff >= max_sample_diff)) {
|
2011-05-02 10:05:28 +00:00
|
|
|
/* wait before deciding to make a discontinuity */
|
|
|
|
if (sink->priv->discont_wait > 0) {
|
|
|
|
GstClockTime time = gst_util_uint64_scale_int (sample_offset,
|
2011-11-07 11:23:15 +00:00
|
|
|
GST_SECOND, rate);
|
2011-05-02 10:05:28 +00:00
|
|
|
if (sink->priv->discont_time == -1) {
|
|
|
|
/* discont candidate */
|
|
|
|
sink->priv->discont_time = time;
|
|
|
|
} else if (time - sink->priv->discont_time >= sink->priv->discont_wait) {
|
|
|
|
/* discont_wait expired, discontinuity detected */
|
|
|
|
discont = TRUE;
|
|
|
|
sink->priv->discont_time = -1;
|
|
|
|
}
|
|
|
|
} else {
|
baseaudiosink: delay the resyncing of timestamp vs ringbuffertime
A common problem for audio-playback is that the timestamps might not
be completely linear. This is specially common when doing streaming over
a network, where you can have jittery and/or bursty packettransmission,
which again will often be reflected on the buffertimestamps.
Now, the current implementation have a threshold that says how far the
buffertimestamp is allowed o drift from the ideal aligned time in the
ringbuffer. This was an instant reaction, and ment that if one buffer
arrived with a timestamp that would breach the drift-tolerance, a resync
would take place, and the result would be an audible gap for the
listener.
The annoying thing would be that in the case of a "timestamp-outlier",
you would first resync one way, say +100ms, and then, if the next
timestamp was "back on track", you would end up resyncing the other way
(-100ms) So in fact, when you had only one buffer with slightly off
timestamping, you would end up with *two* audible gaps. This is the
problem this patch addresses.
The way to "fix" this problem with the previous implementation, would
have been to increase the "drift-tolerance" to a value that was greater
than the largest timestamp-outlier one would normally expect. The big
problem with this approach, however, is that it will allow normal
operations with a huge offset timestamp vs running-time, which is
detrimental to lip-sync. If the drift-tolerance is set to 200ms, it
basically means that lip-sync can easily end up being off by that much.
This patch will basically start a timer when the first breach of
drift-tolerance is detected. If any following timestamp for the next n
nanoseconds gets "back on track" within the threshold, it has basically
eliminated the effect of an outlier, and the timer is stopped. If,
however, all timestamps within this time-limit are breaching the
threshold, we are probably facing a more permanent offset in the
timestamps, and a resync is allowed to happen.
So basically this patch offers something as rare as both higher
accuracy, it terms of allowing smaller drift-tolerances, as well as much
smoother, less glitchy playback!
Commit message and improvments by Havard Graff.
Fixes bug #640859.
2011-11-07 10:31:47 +00:00
|
|
|
discont = TRUE;
|
|
|
|
}
|
|
|
|
} else if (G_UNLIKELY (sink->priv->discont_time != -1)) {
|
|
|
|
/* we have had a discont, but are now back on track! */
|
|
|
|
sink->priv->discont_time = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (G_LIKELY (!discont && allow_align)) {
|
2011-02-08 17:27:43 +00:00
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"align with prev sample, ABS (%" G_GINT64_FORMAT ") < %"
|
2011-11-07 10:18:34 +00:00
|
|
|
G_GINT64_FORMAT, align, max_sample_diff);
|
2011-02-08 17:27:43 +00:00
|
|
|
} else {
|
2011-10-18 23:32:13 +00:00
|
|
|
gint64 diff_s G_GNUC_UNUSED;
|
|
|
|
|
2011-02-08 17:27:43 +00:00
|
|
|
/* calculate sample diff in seconds for error message */
|
2011-11-07 11:23:15 +00:00
|
|
|
diff_s = gst_util_uint64_scale_int (sample_diff, GST_SECOND, rate);
|
2011-10-18 23:32:13 +00:00
|
|
|
|
2011-02-08 17:27:43 +00:00
|
|
|
/* timestamps drifted apart from previous samples too much, we need to
|
|
|
|
* resync. We log this as an element warning. */
|
|
|
|
GST_WARNING_OBJECT (sink,
|
|
|
|
"Unexpected discontinuity in audio timestamps of "
|
|
|
|
"%s%" GST_TIME_FORMAT ", resyncing",
|
2011-04-04 09:31:33 +00:00
|
|
|
sample_offset > sink->next_sample ? "+" : "-", GST_TIME_ARGS (diff_s));
|
2011-02-08 17:27:43 +00:00
|
|
|
align = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return align;
|
|
|
|
}
|
|
|
|
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
static GstFlowReturn
|
2005-07-10 12:03:58 +00:00
|
|
|
gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
{
|
2007-02-15 12:06:25 +00:00
|
|
|
guint64 in_offset;
|
2006-11-13 17:30:17 +00:00
|
|
|
GstClockTime time, stop, render_start, render_stop, sample_offset;
|
2008-06-20 09:09:37 +00:00
|
|
|
GstClockTimeDiff sync_offset, ts_offset;
|
2011-03-09 05:42:39 +00:00
|
|
|
GstBaseAudioSinkClass *bclass;
|
2005-10-11 18:32:01 +00:00
|
|
|
GstBaseAudioSink *sink;
|
|
|
|
GstRingBuffer *ringbuf;
|
2011-05-16 11:48:11 +00:00
|
|
|
gint64 diff, align;
|
|
|
|
guint64 ctime, cstop;
|
2011-03-27 11:55:15 +00:00
|
|
|
gsize offset;
|
2005-08-31 10:57:35 +00:00
|
|
|
guint8 *data;
|
2011-03-27 11:55:15 +00:00
|
|
|
gsize size;
|
2006-01-30 16:19:33 +00:00
|
|
|
guint samples, written;
|
2011-08-18 17:15:03 +00:00
|
|
|
gint bpf, rate;
|
2006-11-13 17:30:17 +00:00
|
|
|
gint accum;
|
|
|
|
gint out_samples;
|
2008-06-20 09:09:37 +00:00
|
|
|
GstClockTime base_time, render_delay, latency;
|
2006-09-28 15:08:15 +00:00
|
|
|
GstClock *clock;
|
2007-05-24 16:22:23 +00:00
|
|
|
gboolean sync, slaved, align_next;
|
2008-05-20 11:09:06 +00:00
|
|
|
GstFlowReturn ret;
|
2008-06-20 09:09:37 +00:00
|
|
|
GstSegment clip_seg;
|
2009-09-09 14:19:32 +00:00
|
|
|
gint64 time_offset;
|
2011-03-09 05:42:39 +00:00
|
|
|
GstBuffer *out = NULL;
|
2005-10-11 18:32:01 +00:00
|
|
|
|
|
|
|
sink = GST_BASE_AUDIO_SINK (bsink);
|
2011-03-09 05:42:39 +00:00
|
|
|
bclass = GST_BASE_AUDIO_SINK_GET_CLASS (sink);
|
2005-10-11 18:32:01 +00:00
|
|
|
|
|
|
|
ringbuf = sink->ringbuffer;
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
/* can't do anything when we don't have the device */
|
2006-02-12 14:54:55 +00:00
|
|
|
if (G_UNLIKELY (!gst_ring_buffer_is_acquired (ringbuf)))
|
2005-05-06 16:18:24 +00:00
|
|
|
goto wrong_state;
|
2005-04-28 16:15:42 +00:00
|
|
|
|
2008-05-20 11:09:06 +00:00
|
|
|
/* Wait for upstream latency before starting the ringbuffer, we do this so
|
|
|
|
* that we can align the first sample of the ringbuffer to the base_time +
|
|
|
|
* latency. */
|
|
|
|
GST_OBJECT_LOCK (sink);
|
2008-06-20 09:09:37 +00:00
|
|
|
base_time = GST_ELEMENT_CAST (sink)->base_time;
|
2008-05-20 11:09:06 +00:00
|
|
|
if (G_UNLIKELY (sink->priv->sync_latency)) {
|
2008-11-10 14:22:09 +00:00
|
|
|
ret = gst_base_audio_sink_sync_latency (bsink, GST_MINI_OBJECT_CAST (buf));
|
2008-05-20 11:09:06 +00:00
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
if (G_UNLIKELY (ret != GST_FLOW_OK))
|
|
|
|
goto sync_latency_failed;
|
2008-11-10 14:22:09 +00:00
|
|
|
/* only do this once until we are set back to PLAYING */
|
|
|
|
sink->priv->sync_latency = FALSE;
|
2008-05-20 11:09:06 +00:00
|
|
|
} else {
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
}
|
|
|
|
|
2011-03-09 05:42:39 +00:00
|
|
|
/* Before we go on, let's see if we need to payload the data. If yes, we also
|
|
|
|
* need to unref the output buffer before leaving. */
|
|
|
|
if (bclass->payload) {
|
|
|
|
out = bclass->payload (sink, buf);
|
|
|
|
|
|
|
|
if (!out)
|
|
|
|
goto payload_failed;
|
|
|
|
|
|
|
|
buf = out;
|
|
|
|
}
|
|
|
|
|
2011-08-18 17:15:03 +00:00
|
|
|
bpf = GST_AUDIO_INFO_BPF (&ringbuf->spec.info);
|
|
|
|
rate = GST_AUDIO_INFO_RATE (&ringbuf->spec.info);
|
2005-10-11 18:32:01 +00:00
|
|
|
|
2011-03-27 11:55:15 +00:00
|
|
|
size = gst_buffer_get_size (buf);
|
2011-08-18 17:15:03 +00:00
|
|
|
if (G_UNLIKELY (size % bpf) != 0)
|
2005-10-11 18:32:01 +00:00
|
|
|
goto wrong_size;
|
|
|
|
|
2011-08-18 17:15:03 +00:00
|
|
|
samples = size / bpf;
|
2006-11-13 17:30:17 +00:00
|
|
|
out_samples = samples;
|
2005-10-11 18:32:01 +00:00
|
|
|
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
in_offset = GST_BUFFER_OFFSET (buf);
|
|
|
|
time = GST_BUFFER_TIMESTAMP (buf);
|
|
|
|
|
2006-01-25 09:27:01 +00:00
|
|
|
GST_DEBUG_OBJECT (sink,
|
2009-04-14 21:02:39 +00:00
|
|
|
"time %" GST_TIME_FORMAT ", offset %" G_GUINT64_FORMAT ", start %"
|
|
|
|
GST_TIME_FORMAT ", samples %u", GST_TIME_ARGS (time), in_offset,
|
2006-11-13 17:30:17 +00:00
|
|
|
GST_TIME_ARGS (bsink->segment.start), samples);
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
|
2011-03-27 11:55:15 +00:00
|
|
|
offset = 0;
|
2006-10-18 13:42:49 +00:00
|
|
|
|
2006-09-28 15:08:15 +00:00
|
|
|
/* if not valid timestamp or we can't clip or sync, try to play
|
2005-10-24 14:59:55 +00:00
|
|
|
* sample ASAP */
|
2006-09-28 15:08:15 +00:00
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (time)) {
|
2006-11-13 17:30:17 +00:00
|
|
|
render_start = gst_base_audio_sink_get_offset (sink);
|
|
|
|
render_stop = render_start + samples;
|
2011-08-09 14:39:31 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "Buffer of size %" G_GSIZE_FORMAT " has no time."
|
|
|
|
" Using render_start=%" G_GUINT64_FORMAT, size, render_start);
|
2008-06-20 09:09:37 +00:00
|
|
|
/* we don't have a start so we don't know stop either */
|
|
|
|
stop = -1;
|
2005-10-21 15:14:36 +00:00
|
|
|
goto no_sync;
|
|
|
|
}
|
|
|
|
|
2008-06-20 09:09:37 +00:00
|
|
|
/* let's calc stop based on the number of samples in the buffer instead
|
|
|
|
* of trusting the DURATION */
|
2011-08-18 17:15:03 +00:00
|
|
|
stop = time + gst_util_uint64_scale_int (samples, GST_SECOND, rate);
|
2008-06-20 09:09:37 +00:00
|
|
|
|
|
|
|
/* prepare the clipping segment. Since we will be subtracting ts-offset and
|
|
|
|
* device-delay later we scale the start and stop with those values so that we
|
|
|
|
* can correctly clip them */
|
|
|
|
clip_seg.format = GST_FORMAT_TIME;
|
|
|
|
clip_seg.start = bsink->segment.start;
|
|
|
|
clip_seg.stop = bsink->segment.stop;
|
|
|
|
clip_seg.duration = -1;
|
|
|
|
|
|
|
|
/* the sync offset is the combination of ts-offset and device-delay */
|
|
|
|
latency = gst_base_sink_get_latency (bsink);
|
|
|
|
ts_offset = gst_base_sink_get_ts_offset (bsink);
|
|
|
|
render_delay = gst_base_sink_get_render_delay (bsink);
|
|
|
|
sync_offset = ts_offset - render_delay + latency;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"sync-offset %" G_GINT64_FORMAT ", render-delay %" GST_TIME_FORMAT
|
|
|
|
", ts-offset %" G_GINT64_FORMAT, sync_offset,
|
|
|
|
GST_TIME_ARGS (render_delay), ts_offset);
|
|
|
|
|
|
|
|
/* compensate for ts-offset and device-delay when negative we need to
|
|
|
|
* clip. */
|
|
|
|
if (sync_offset < 0) {
|
|
|
|
clip_seg.start += -sync_offset;
|
|
|
|
if (clip_seg.stop != -1)
|
|
|
|
clip_seg.stop += -sync_offset;
|
|
|
|
}
|
|
|
|
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
/* samples should be rendered based on their timestamp. All samples
|
2009-09-09 14:19:32 +00:00
|
|
|
* arriving before the segment.start or after segment.stop are to be
|
|
|
|
* thrown away. All samples should also be clipped to the segment
|
2006-01-25 09:27:01 +00:00
|
|
|
* boundaries */
|
2008-06-20 09:09:37 +00:00
|
|
|
if (!gst_segment_clip (&clip_seg, GST_FORMAT_TIME, time, stop, &ctime,
|
2006-01-25 09:27:01 +00:00
|
|
|
&cstop))
|
2005-10-21 15:14:36 +00:00
|
|
|
goto out_of_segment;
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
|
2006-01-25 09:27:01 +00:00
|
|
|
/* see if some clipping happened */
|
|
|
|
diff = ctime - time;
|
|
|
|
if (diff > 0) {
|
2006-02-12 14:54:55 +00:00
|
|
|
/* bring clipped time to samples */
|
2011-08-18 17:15:03 +00:00
|
|
|
diff = gst_util_uint64_scale_int (diff, rate, GST_SECOND);
|
2006-01-25 09:27:01 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "clipping start to %" GST_TIME_FORMAT " %"
|
|
|
|
G_GUINT64_FORMAT " samples", GST_TIME_ARGS (ctime), diff);
|
|
|
|
samples -= diff;
|
2011-08-18 17:15:03 +00:00
|
|
|
offset += diff * bpf;
|
2006-01-25 09:27:01 +00:00
|
|
|
time = ctime;
|
|
|
|
}
|
|
|
|
diff = stop - cstop;
|
|
|
|
if (diff > 0) {
|
2006-02-12 14:54:55 +00:00
|
|
|
/* bring clipped time to samples */
|
2011-08-18 17:15:03 +00:00
|
|
|
diff = gst_util_uint64_scale_int (diff, rate, GST_SECOND);
|
2006-01-25 09:27:01 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "clipping stop to %" GST_TIME_FORMAT " %"
|
|
|
|
G_GUINT64_FORMAT " samples", GST_TIME_ARGS (cstop), diff);
|
|
|
|
samples -= diff;
|
|
|
|
stop = cstop;
|
|
|
|
}
|
|
|
|
|
2006-09-28 15:08:15 +00:00
|
|
|
/* figure out how to sync */
|
|
|
|
if ((clock = GST_ELEMENT_CLOCK (bsink)))
|
|
|
|
sync = bsink->sync;
|
|
|
|
else
|
|
|
|
sync = FALSE;
|
|
|
|
|
|
|
|
if (!sync) {
|
|
|
|
/* no sync needed, play sample ASAP */
|
2006-11-13 17:30:17 +00:00
|
|
|
render_start = gst_base_audio_sink_get_offset (sink);
|
|
|
|
render_stop = render_start + samples;
|
2006-09-28 15:08:15 +00:00
|
|
|
GST_DEBUG_OBJECT (sink,
|
2006-11-13 17:30:17 +00:00
|
|
|
"no sync needed. Using render_start=%" G_GUINT64_FORMAT, render_start);
|
2006-09-28 15:08:15 +00:00
|
|
|
goto no_sync;
|
|
|
|
}
|
|
|
|
|
2006-11-13 17:30:17 +00:00
|
|
|
/* bring buffer start and stop times to running time */
|
|
|
|
render_start =
|
2006-01-25 09:27:01 +00:00
|
|
|
gst_segment_to_running_time (&bsink->segment, GST_FORMAT_TIME, time);
|
2006-11-13 17:30:17 +00:00
|
|
|
render_stop =
|
|
|
|
gst_segment_to_running_time (&bsink->segment, GST_FORMAT_TIME, stop);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"running: start %" GST_TIME_FORMAT " - stop %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (render_start), GST_TIME_ARGS (render_stop));
|
2006-10-18 13:42:49 +00:00
|
|
|
|
2008-11-25 10:32:49 +00:00
|
|
|
/* store the time of the last sample, we'll use this to perform sync on the
|
|
|
|
* last sample when draining the buffer */
|
|
|
|
if (bsink->segment.rate >= 0.0) {
|
|
|
|
sink->priv->eos_time = render_stop;
|
|
|
|
} else {
|
|
|
|
sink->priv->eos_time = render_start;
|
|
|
|
}
|
2007-02-15 12:06:25 +00:00
|
|
|
|
2008-06-20 09:09:37 +00:00
|
|
|
/* compensate for ts-offset and delay we know this will not underflow because we
|
|
|
|
* clipped above. */
|
2007-03-01 17:01:43 +00:00
|
|
|
GST_DEBUG_OBJECT (sink,
|
2008-06-20 09:09:37 +00:00
|
|
|
"compensating for sync-offset %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (sync_offset));
|
|
|
|
render_start += sync_offset;
|
|
|
|
render_stop += sync_offset;
|
2007-02-15 12:06:25 +00:00
|
|
|
|
2008-11-25 10:32:49 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "adding base_time %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (base_time));
|
|
|
|
|
|
|
|
/* add base time to sync against the clock */
|
|
|
|
render_start += base_time;
|
|
|
|
render_stop += base_time;
|
|
|
|
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
GST_DEBUG_OBJECT (sink,
|
2008-06-20 09:09:37 +00:00
|
|
|
"after compensation: start %" GST_TIME_FORMAT " - stop %" GST_TIME_FORMAT,
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
GST_TIME_ARGS (render_start), GST_TIME_ARGS (render_stop));
|
2006-10-18 13:42:49 +00:00
|
|
|
|
2007-09-03 19:17:33 +00:00
|
|
|
if ((slaved = clock != sink->provided_clock)) {
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
/* handle clock slaving */
|
|
|
|
gst_base_audio_sink_handle_slaving (sink, render_start, render_stop,
|
|
|
|
&render_start, &render_stop);
|
2008-04-03 10:37:03 +00:00
|
|
|
} else {
|
|
|
|
/* no slaving needed but we need to adapt to the clock calibration
|
|
|
|
* parameters */
|
|
|
|
gst_base_audio_sink_none_slaving (sink, render_start, render_stop,
|
|
|
|
&render_start, &render_stop);
|
2007-03-01 17:01:43 +00:00
|
|
|
}
|
2006-11-13 17:30:17 +00:00
|
|
|
|
2009-11-18 16:09:28 +00:00
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"final timestamps: start %" GST_TIME_FORMAT " - stop %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (render_start), GST_TIME_ARGS (render_stop));
|
|
|
|
|
2009-09-09 14:19:32 +00:00
|
|
|
/* bring to position in the ringbuffer */
|
2011-06-21 16:17:59 +00:00
|
|
|
time_offset = GST_AUDIO_CLOCK_CAST (sink->provided_clock)->time_offset;
|
2011-04-19 08:52:00 +00:00
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"time offset %" GST_TIME_FORMAT, GST_TIME_ARGS (time_offset));
|
|
|
|
if (render_start > time_offset)
|
|
|
|
render_start -= time_offset;
|
|
|
|
else
|
|
|
|
render_start = 0;
|
|
|
|
if (render_stop > time_offset)
|
|
|
|
render_stop -= time_offset;
|
|
|
|
else
|
|
|
|
render_stop = 0;
|
2009-09-09 14:19:32 +00:00
|
|
|
|
2011-06-01 08:21:39 +00:00
|
|
|
/* in some clock slaving cases, all late samples end up at 0 first,
|
|
|
|
* and subsequent ones align with that until threshold exceeded,
|
|
|
|
* and then sync back to 0 and so on, so avoid that altogether */
|
|
|
|
if (G_UNLIKELY (render_start == 0 && render_stop == 0))
|
|
|
|
goto too_late;
|
|
|
|
|
2006-11-13 17:30:17 +00:00
|
|
|
/* and bring the time to the rate corrected offset in the buffer */
|
2011-08-18 17:15:03 +00:00
|
|
|
render_start = gst_util_uint64_scale_int (render_start, rate, GST_SECOND);
|
|
|
|
render_stop = gst_util_uint64_scale_int (render_stop, rate, GST_SECOND);
|
2006-11-13 17:30:17 +00:00
|
|
|
|
2008-05-09 16:38:10 +00:00
|
|
|
/* positive playback rate, first sample is render_start, negative rate, first
|
|
|
|
* sample is render_stop. When no rate conversion is active, render exactly
|
|
|
|
* the amount of input samples to avoid aligning to rounding errors. */
|
|
|
|
if (bsink->segment.rate >= 0.0) {
|
|
|
|
sample_offset = render_start;
|
|
|
|
if (bsink->segment.rate == 1.0)
|
|
|
|
render_stop = sample_offset + samples;
|
|
|
|
} else {
|
|
|
|
sample_offset = render_stop;
|
|
|
|
if (bsink->segment.rate == -1.0)
|
|
|
|
render_start = sample_offset + samples;
|
|
|
|
}
|
|
|
|
|
2006-07-24 15:14:17 +00:00
|
|
|
/* always resync after a discont */
|
|
|
|
if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT))) {
|
2006-01-25 09:27:01 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "resync after discont");
|
2006-07-24 15:14:17 +00:00
|
|
|
goto no_align;
|
|
|
|
}
|
|
|
|
|
2008-05-09 16:38:10 +00:00
|
|
|
/* resync when we don't know what to align the sample with */
|
2006-07-24 16:47:10 +00:00
|
|
|
if (G_UNLIKELY (sink->next_sample == -1)) {
|
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"no align possible: no previous sample position known");
|
|
|
|
goto no_align;
|
|
|
|
}
|
|
|
|
|
2011-02-08 17:27:43 +00:00
|
|
|
align = gst_base_audio_sink_get_alignment (sink, sample_offset);
|
2007-09-03 19:17:33 +00:00
|
|
|
sink->priv->last_align = align;
|
2005-10-11 18:32:01 +00:00
|
|
|
|
2006-11-13 17:30:17 +00:00
|
|
|
/* apply alignment */
|
|
|
|
render_start += align;
|
2006-10-18 13:42:49 +00:00
|
|
|
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
/* only align stop if we are not slaved to resample */
|
|
|
|
if (slaved && sink->priv->slave_method == GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE) {
|
2006-11-13 17:30:17 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "no stop time align needed: we are slaved");
|
|
|
|
goto no_align;
|
2006-10-18 13:42:49 +00:00
|
|
|
}
|
2006-11-13 17:30:17 +00:00
|
|
|
render_stop += align;
|
2006-01-25 09:27:01 +00:00
|
|
|
|
2006-11-13 17:30:17 +00:00
|
|
|
no_align:
|
|
|
|
/* number of target samples is difference between start and stop */
|
|
|
|
out_samples = render_stop - render_start;
|
2005-09-24 13:06:03 +00:00
|
|
|
|
2006-11-13 17:30:17 +00:00
|
|
|
no_sync:
|
|
|
|
/* we render the first or last sample first, depending on the rate */
|
2008-03-24 11:24:22 +00:00
|
|
|
if (bsink->segment.rate >= 0.0)
|
2006-11-13 17:30:17 +00:00
|
|
|
sample_offset = render_start;
|
|
|
|
else
|
|
|
|
sample_offset = render_stop;
|
2005-10-11 18:32:01 +00:00
|
|
|
|
gst-libs/gst/audio/gstbaseaudiosink.*: Store private stuff in GstBaseAudioSinkPrivate.
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c: (slave_method_get_type),
(gst_base_audio_sink_class_init), (gst_base_audio_sink_init),
(gst_base_audio_sink_query), (gst_base_audio_sink_get_time),
(gst_base_audio_sink_set_property),
(gst_base_audio_sink_get_property), (gst_base_audio_sink_event),
(clock_convert_external), (gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_handle_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
* gst-libs/gst/audio/gstbaseaudiosink.h:
Store private stuff in GstBaseAudioSinkPrivate.
Add configurable clock slaving modes property.
API:: GstBaseAudioSink::slave-method property
Some more latency reporting tweaks.
Added skew based clock slaving correction and make it the default until
the resampling method is more robust.
2007-03-28 14:50:47 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "rendering at %" G_GUINT64_FORMAT " %d/%d",
|
|
|
|
sample_offset, samples, out_samples);
|
|
|
|
|
2006-11-13 17:30:17 +00:00
|
|
|
/* we need to accumulate over different runs for when we get interrupted */
|
|
|
|
accum = 0;
|
2007-05-24 16:22:23 +00:00
|
|
|
align_next = TRUE;
|
2011-03-27 11:55:15 +00:00
|
|
|
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
2006-01-30 16:19:33 +00:00
|
|
|
do {
|
2006-10-18 13:42:49 +00:00
|
|
|
written =
|
2011-03-27 11:55:15 +00:00
|
|
|
gst_ring_buffer_commit_full (ringbuf, &sample_offset, data + offset,
|
|
|
|
samples, out_samples, &accum);
|
2006-10-18 13:42:49 +00:00
|
|
|
|
2006-11-13 17:30:17 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "wrote %u of %u", written, samples);
|
2006-01-30 16:19:33 +00:00
|
|
|
/* if we wrote all, we're done */
|
|
|
|
if (written == samples)
|
|
|
|
break;
|
|
|
|
|
2006-09-15 09:13:50 +00:00
|
|
|
/* else something interrupted us and we wait for preroll. */
|
2009-05-19 15:17:37 +00:00
|
|
|
if ((ret = gst_base_sink_wait_preroll (bsink)) != GST_FLOW_OK)
|
2006-01-30 16:19:33 +00:00
|
|
|
goto stopping;
|
|
|
|
|
2007-05-24 16:22:23 +00:00
|
|
|
/* if we got interrupted, we cannot assume that the next sample should
|
|
|
|
* be aligned to this one */
|
|
|
|
align_next = FALSE;
|
|
|
|
|
2009-04-08 16:04:22 +00:00
|
|
|
/* update the output samples. FIXME, this will just skip them when pausing
|
|
|
|
* during trick mode */
|
2009-06-11 10:17:16 +00:00
|
|
|
if (out_samples > written) {
|
2009-04-08 16:04:22 +00:00
|
|
|
out_samples -= written;
|
2009-06-11 10:17:16 +00:00
|
|
|
accum = 0;
|
|
|
|
} else
|
2009-04-08 16:04:22 +00:00
|
|
|
break;
|
|
|
|
|
2006-01-30 16:19:33 +00:00
|
|
|
samples -= written;
|
2011-08-18 17:15:03 +00:00
|
|
|
offset += written * bpf;
|
2006-01-30 16:19:33 +00:00
|
|
|
} while (TRUE);
|
2011-03-27 11:55:15 +00:00
|
|
|
gst_buffer_unmap (buf, data, size);
|
2005-10-11 18:32:01 +00:00
|
|
|
|
2007-05-24 16:22:23 +00:00
|
|
|
if (align_next)
|
|
|
|
sink->next_sample = sample_offset;
|
|
|
|
else
|
|
|
|
sink->next_sample = -1;
|
2006-11-13 17:30:17 +00:00
|
|
|
|
2006-10-18 13:42:49 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "next sample expected at %" G_GUINT64_FORMAT,
|
|
|
|
sink->next_sample);
|
|
|
|
|
2006-01-25 09:27:01 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (stop) && stop >= bsink->segment.stop) {
|
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"start playback because we are at the end of segment");
|
2005-10-11 18:32:01 +00:00
|
|
|
gst_ring_buffer_start (ringbuf);
|
|
|
|
}
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
2011-03-09 05:42:39 +00:00
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
|
|
|
|
done:
|
|
|
|
if (out)
|
|
|
|
gst_buffer_unref (out);
|
|
|
|
|
|
|
|
return ret;
|
2005-05-06 16:18:24 +00:00
|
|
|
|
2006-02-12 14:54:55 +00:00
|
|
|
/* SPECIAL cases */
|
2005-10-21 15:14:36 +00:00
|
|
|
out_of_segment:
|
|
|
|
{
|
2006-01-25 09:27:01 +00:00
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"dropping sample out of segment time %" GST_TIME_FORMAT ", start %"
|
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (time),
|
|
|
|
GST_TIME_ARGS (bsink->segment.start));
|
2011-03-09 05:42:39 +00:00
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
goto done;
|
2005-10-21 15:14:36 +00:00
|
|
|
}
|
2011-06-01 08:21:39 +00:00
|
|
|
too_late:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (sink, "dropping late sample");
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
2006-02-12 14:54:55 +00:00
|
|
|
/* ERRORS */
|
2011-03-09 05:42:39 +00:00
|
|
|
payload_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (sink, STREAM, FORMAT, (NULL), ("failed to payload."));
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto done;
|
|
|
|
}
|
2005-05-06 16:18:24 +00:00
|
|
|
wrong_state:
|
|
|
|
{
|
2006-01-25 09:27:01 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "ringbuffer not negotiated");
|
2006-02-12 14:54:55 +00:00
|
|
|
GST_ELEMENT_ERROR (sink, STREAM, FORMAT, (NULL), ("sink not negotiated."));
|
2011-03-09 05:42:39 +00:00
|
|
|
ret = GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
goto done;
|
2005-05-06 16:18:24 +00:00
|
|
|
}
|
2005-10-11 18:32:01 +00:00
|
|
|
wrong_size:
|
|
|
|
{
|
2006-01-25 09:27:01 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "wrong size");
|
2006-02-12 14:54:55 +00:00
|
|
|
GST_ELEMENT_ERROR (sink, STREAM, WRONG_TYPE,
|
|
|
|
(NULL), ("sink received buffer of wrong size."));
|
2011-03-09 05:42:39 +00:00
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto done;
|
2005-10-11 18:32:01 +00:00
|
|
|
}
|
2006-01-30 16:19:33 +00:00
|
|
|
stopping:
|
|
|
|
{
|
2009-05-21 08:48:49 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "preroll got interrupted: %d (%s)", ret,
|
|
|
|
gst_flow_get_name (ret));
|
2011-03-27 11:55:15 +00:00
|
|
|
gst_buffer_unmap (buf, data, size);
|
2011-03-09 05:42:39 +00:00
|
|
|
goto done;
|
2006-01-30 16:19:33 +00:00
|
|
|
}
|
2008-05-20 11:09:06 +00:00
|
|
|
sync_latency_failed:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (sink, "failed waiting for latency");
|
2011-03-09 05:42:39 +00:00
|
|
|
goto done;
|
2008-05-20 11:09:06 +00:00
|
|
|
}
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
}
|
|
|
|
|
2006-09-27 11:05:08 +00:00
|
|
|
/**
|
|
|
|
* gst_base_audio_sink_create_ringbuffer:
|
|
|
|
* @sink: a #GstBaseAudioSink.
|
|
|
|
*
|
|
|
|
* Create and return the #GstRingBuffer for @sink. This function will call the
|
|
|
|
* ::create_ringbuffer vmethod and will set @sink as the parent of the returned
|
|
|
|
* buffer (see gst_object_set_parent()).
|
|
|
|
*
|
|
|
|
* Returns: The new ringbuffer of @sink.
|
|
|
|
*/
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
GstRingBuffer *
|
2005-07-10 12:03:58 +00:00
|
|
|
gst_base_audio_sink_create_ringbuffer (GstBaseAudioSink * sink)
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
{
|
|
|
|
GstBaseAudioSinkClass *bclass;
|
|
|
|
GstRingBuffer *buffer = NULL;
|
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
bclass = GST_BASE_AUDIO_SINK_GET_CLASS (sink);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
if (bclass->create_ringbuffer)
|
|
|
|
buffer = bclass->create_ringbuffer (sink);
|
|
|
|
|
2005-07-20 09:08:05 +00:00
|
|
|
if (buffer)
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
gst_object_set_parent (GST_OBJECT (buffer), GST_OBJECT (sink));
|
|
|
|
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2005-07-20 09:08:05 +00:00
|
|
|
static void
|
2005-07-10 12:03:58 +00:00
|
|
|
gst_base_audio_sink_callback (GstRingBuffer * rbuf, guint8 * data, guint len,
|
2005-04-28 16:15:42 +00:00
|
|
|
gpointer user_data)
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
{
|
2007-01-06 17:28:40 +00:00
|
|
|
GstBaseSink *basesink;
|
|
|
|
GstBaseAudioSink *sink;
|
|
|
|
GstBuffer *buf;
|
|
|
|
GstFlowReturn ret;
|
2011-03-27 11:55:15 +00:00
|
|
|
gsize size;
|
2007-01-06 17:28:40 +00:00
|
|
|
|
2007-01-12 21:19:35 +00:00
|
|
|
basesink = GST_BASE_SINK (user_data);
|
|
|
|
sink = GST_BASE_AUDIO_SINK (user_data);
|
2007-01-06 17:28:40 +00:00
|
|
|
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
GST_PAD_STREAM_LOCK (basesink->sinkpad);
|
|
|
|
|
2007-01-06 17:28:40 +00:00
|
|
|
/* would be nice to arrange for pad_alloc_buffer to return data -- as it is we
|
|
|
|
will copy twice, once into data, once into DMA */
|
2011-08-09 14:39:31 +00:00
|
|
|
GST_LOG_OBJECT (basesink, "pulling %u bytes offset %" G_GUINT64_FORMAT
|
2007-02-15 12:06:25 +00:00
|
|
|
" to fill audio buffer", len, basesink->offset);
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
ret =
|
2011-05-16 11:48:11 +00:00
|
|
|
gst_pad_pull_range (basesink->sinkpad, basesink->segment.position, len,
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
&buf);
|
2007-07-08 13:07:38 +00:00
|
|
|
|
|
|
|
if (ret != GST_FLOW_OK) {
|
2011-10-10 09:39:52 +00:00
|
|
|
if (ret == GST_FLOW_EOS)
|
2007-07-08 13:07:38 +00:00
|
|
|
goto eos;
|
|
|
|
else
|
|
|
|
goto error;
|
|
|
|
}
|
2007-01-06 17:28:40 +00:00
|
|
|
|
2011-03-04 16:25:46 +00:00
|
|
|
GST_BASE_SINK_PREROLL_LOCK (basesink);
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
if (basesink->flushing)
|
|
|
|
goto flushing;
|
|
|
|
|
|
|
|
/* complete preroll and wait for PLAYING */
|
|
|
|
ret = gst_base_sink_do_preroll (basesink, GST_MINI_OBJECT_CAST (buf));
|
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto preroll_error;
|
|
|
|
|
2011-03-27 11:55:15 +00:00
|
|
|
size = gst_buffer_get_size (buf);
|
|
|
|
|
|
|
|
if (len != size) {
|
2008-11-24 12:56:54 +00:00
|
|
|
GST_INFO_OBJECT (basesink,
|
2011-08-09 14:39:31 +00:00
|
|
|
"got different size than requested from sink pad: %u"
|
|
|
|
" != %" G_GSIZE_FORMAT, len, size);
|
2011-03-27 11:55:15 +00:00
|
|
|
len = MIN (size, len);
|
2007-01-06 17:28:40 +00:00
|
|
|
}
|
|
|
|
|
2011-05-16 11:48:11 +00:00
|
|
|
basesink->segment.position += len;
|
2007-02-05 18:39:51 +00:00
|
|
|
|
2011-03-27 11:55:15 +00:00
|
|
|
gst_buffer_extract (buf, 0, data, len);
|
2011-03-04 16:25:46 +00:00
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (basesink);
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
|
|
|
|
GST_PAD_STREAM_UNLOCK (basesink->sinkpad);
|
2007-01-06 17:28:40 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
error:
|
|
|
|
{
|
2008-11-10 14:22:09 +00:00
|
|
|
GST_WARNING_OBJECT (basesink, "Got flow '%s' but can't return it: %d",
|
|
|
|
gst_flow_get_name (ret), ret);
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
gst_ring_buffer_pause (rbuf);
|
|
|
|
GST_PAD_STREAM_UNLOCK (basesink->sinkpad);
|
2007-01-06 17:28:40 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-07-08 13:07:38 +00:00
|
|
|
eos:
|
|
|
|
{
|
|
|
|
/* FIXME: this is not quite correct; we'll be called endlessly until
|
|
|
|
* the sink gets shut down; maybe we should set a flag somewhere, or
|
|
|
|
* set segment.stop and segment.duration to the last sample or so */
|
|
|
|
GST_DEBUG_OBJECT (sink, "EOS");
|
|
|
|
gst_base_audio_sink_drain (sink);
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
gst_ring_buffer_pause (rbuf);
|
2008-11-24 12:56:54 +00:00
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (sink),
|
|
|
|
gst_message_new_eos (GST_OBJECT_CAST (sink)));
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
GST_PAD_STREAM_UNLOCK (basesink->sinkpad);
|
|
|
|
}
|
|
|
|
flushing:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (sink, "we are flushing");
|
|
|
|
gst_ring_buffer_pause (rbuf);
|
2011-03-04 16:25:46 +00:00
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (basesink);
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
GST_PAD_STREAM_UNLOCK (basesink->sinkpad);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
preroll_error:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (sink, "error %s", gst_flow_get_name (ret));
|
|
|
|
gst_ring_buffer_pause (rbuf);
|
2011-03-04 16:25:46 +00:00
|
|
|
GST_BASE_SINK_PREROLL_UNLOCK (basesink);
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
GST_PAD_STREAM_UNLOCK (basesink->sinkpad);
|
|
|
|
return;
|
2007-07-08 13:07:38 +00:00
|
|
|
}
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
}
|
|
|
|
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
static gboolean
|
|
|
|
gst_base_audio_sink_activate_pull (GstBaseSink * basesink, gboolean active)
|
|
|
|
{
|
|
|
|
gboolean ret;
|
|
|
|
GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (basesink);
|
|
|
|
|
|
|
|
if (active) {
|
|
|
|
GST_DEBUG_OBJECT (basesink, "activating pull");
|
|
|
|
|
|
|
|
gst_ring_buffer_set_callback (sink->ringbuffer,
|
|
|
|
gst_base_audio_sink_callback, sink);
|
|
|
|
|
|
|
|
ret = gst_ring_buffer_activate (sink->ringbuffer, TRUE);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (basesink, "deactivating pull");
|
|
|
|
gst_ring_buffer_set_callback (sink->ringbuffer, NULL, NULL);
|
|
|
|
ret = gst_ring_buffer_activate (sink->ringbuffer, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-02-23 12:42:16 +00:00
|
|
|
#if 0
|
2006-03-23 16:24:23 +00:00
|
|
|
/* should be called with the LOCK */
|
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_base_audio_sink_async_play (GstBaseSink * basesink)
|
|
|
|
{
|
|
|
|
GstBaseAudioSink *sink;
|
|
|
|
|
|
|
|
sink = GST_BASE_AUDIO_SINK (basesink);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sink, "ringbuffer may start now");
|
2008-05-20 11:09:06 +00:00
|
|
|
sink->priv->sync_latency = TRUE;
|
2006-03-23 16:24:23 +00:00
|
|
|
gst_ring_buffer_may_start (sink->ringbuffer, TRUE);
|
2011-11-01 00:34:28 +00:00
|
|
|
if (basesink->pad_mode == GST_PAD_ACTIVATE_PULL) {
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
/* we always start the ringbuffer in pull mode immediatly */
|
|
|
|
gst_ring_buffer_start (sink->ringbuffer);
|
|
|
|
}
|
2006-03-23 16:24:23 +00:00
|
|
|
|
|
|
|
return GST_STATE_CHANGE_SUCCESS;
|
|
|
|
}
|
2011-02-23 12:42:16 +00:00
|
|
|
#endif
|
2006-03-23 16:24:23 +00:00
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_base_audio_sink_change_state (GstElement * element,
|
|
|
|
GstStateChange transition)
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
{
|
2005-09-02 15:43:18 +00:00
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
2005-07-10 12:03:58 +00:00
|
|
|
GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (element);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
2010-06-03 11:44:40 +00:00
|
|
|
if (sink->ringbuffer == NULL) {
|
|
|
|
gst_audio_clock_reset (GST_AUDIO_CLOCK (sink->provided_clock), 0);
|
2005-07-20 09:08:05 +00:00
|
|
|
sink->ringbuffer = gst_base_audio_sink_create_ringbuffer (sink);
|
2010-06-03 11:44:40 +00:00
|
|
|
}
|
2005-08-08 16:42:10 +00:00
|
|
|
if (!gst_ring_buffer_open_device (sink->ringbuffer))
|
2006-02-12 14:54:55 +00:00
|
|
|
goto open_failed;
|
2005-08-08 16:42:10 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2006-02-13 18:49:02 +00:00
|
|
|
sink->next_sample = -1;
|
2007-09-03 19:17:33 +00:00
|
|
|
sink->priv->last_align = -1;
|
2008-11-25 10:32:49 +00:00
|
|
|
sink->priv->eos_time = -1;
|
baseaudiosink: delay the resyncing of timestamp vs ringbuffertime
A common problem for audio-playback is that the timestamps might not
be completely linear. This is specially common when doing streaming over
a network, where you can have jittery and/or bursty packettransmission,
which again will often be reflected on the buffertimestamps.
Now, the current implementation have a threshold that says how far the
buffertimestamp is allowed o drift from the ideal aligned time in the
ringbuffer. This was an instant reaction, and ment that if one buffer
arrived with a timestamp that would breach the drift-tolerance, a resync
would take place, and the result would be an audible gap for the
listener.
The annoying thing would be that in the case of a "timestamp-outlier",
you would first resync one way, say +100ms, and then, if the next
timestamp was "back on track", you would end up resyncing the other way
(-100ms) So in fact, when you had only one buffer with slightly off
timestamping, you would end up with *two* audible gaps. This is the
problem this patch addresses.
The way to "fix" this problem with the previous implementation, would
have been to increase the "drift-tolerance" to a value that was greater
than the largest timestamp-outlier one would normally expect. The big
problem with this approach, however, is that it will allow normal
operations with a huge offset timestamp vs running-time, which is
detrimental to lip-sync. If the drift-tolerance is set to 200ms, it
basically means that lip-sync can easily end up being off by that much.
This patch will basically start a timer when the first breach of
drift-tolerance is detected. If any following timestamp for the next n
nanoseconds gets "back on track" within the threshold, it has basically
eliminated the effect of an outlier, and the timer is stopped. If,
however, all timestamps within this time-limit are breaching the
threshold, we are probably facing a more permanent offset in the
timestamps, and a resync is allowed to happen.
So basically this patch offers something as rare as both higher
accuracy, it terms of allowing smaller drift-tolerances, as well as much
smoother, less glitchy playback!
Commit message and improvments by Havard Graff.
Fixes bug #640859.
2011-11-07 10:31:47 +00:00
|
|
|
sink->priv->discont_time = -1;
|
2006-03-17 17:48:33 +00:00
|
|
|
gst_ring_buffer_set_flushing (sink->ringbuffer, FALSE);
|
|
|
|
gst_ring_buffer_may_start (sink->ringbuffer, FALSE);
|
2010-08-04 13:18:37 +00:00
|
|
|
|
|
|
|
/* Only post clock-provide messages if this is the clock that
|
|
|
|
* we've created. If the subclass has overriden it the subclass
|
|
|
|
* should post this messages whenever necessary */
|
|
|
|
if (sink->provided_clock && GST_IS_AUDIO_CLOCK (sink->provided_clock) &&
|
|
|
|
GST_AUDIO_CLOCK_CAST (sink->provided_clock)->func ==
|
|
|
|
(GstAudioClockGetTimeFunc) gst_base_audio_sink_get_time)
|
|
|
|
gst_element_post_message (element,
|
|
|
|
gst_message_new_clock_provide (GST_OBJECT_CAST (element),
|
|
|
|
sink->provided_clock, TRUE));
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
2011-03-03 18:14:38 +00:00
|
|
|
{
|
|
|
|
gboolean eos;
|
|
|
|
|
2009-01-05 17:13:13 +00:00
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
GST_DEBUG_OBJECT (sink, "ringbuffer may start now");
|
|
|
|
sink->priv->sync_latency = TRUE;
|
2011-03-03 18:14:38 +00:00
|
|
|
eos = GST_BASE_SINK (sink)->eos;
|
2009-01-05 17:13:13 +00:00
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
|
|
|
|
gst_ring_buffer_may_start (sink->ringbuffer, TRUE);
|
2011-11-01 00:34:28 +00:00
|
|
|
if (GST_BASE_SINK_CAST (sink)->pad_mode == GST_PAD_ACTIVATE_PULL ||
|
2011-06-21 16:17:59 +00:00
|
|
|
g_atomic_int_get (&sink->eos_rendering) || eos) {
|
2009-01-05 17:13:13 +00:00
|
|
|
/* we always start the ringbuffer in pull mode immediatly */
|
2011-03-03 18:14:38 +00:00
|
|
|
/* sync rendering on eos needs running clock,
|
|
|
|
* and others need running clock when finished rendering eos */
|
2009-01-05 17:13:13 +00:00
|
|
|
gst_ring_buffer_start (sink->ringbuffer);
|
|
|
|
}
|
2005-11-21 17:14:02 +00:00
|
|
|
break;
|
2011-03-03 18:14:38 +00:00
|
|
|
}
|
2006-01-30 16:19:33 +00:00
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
2010-08-04 13:18:37 +00:00
|
|
|
/* ringbuffer cannot start anymore */
|
|
|
|
gst_ring_buffer_may_start (sink->ringbuffer, FALSE);
|
|
|
|
gst_ring_buffer_pause (sink->ringbuffer);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
sink->priv->sync_latency = FALSE;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2010-07-09 15:15:55 +00:00
|
|
|
/* Only post clock-lost messages if this is the clock that
|
|
|
|
* we've created. If the subclass has overriden it the subclass
|
|
|
|
* should post this messages whenever necessary */
|
|
|
|
if (sink->provided_clock && GST_IS_AUDIO_CLOCK (sink->provided_clock) &&
|
|
|
|
GST_AUDIO_CLOCK_CAST (sink->provided_clock)->func ==
|
|
|
|
(GstAudioClockGetTimeFunc) gst_base_audio_sink_get_time)
|
|
|
|
gst_element_post_message (element,
|
|
|
|
gst_message_new_clock_lost (GST_OBJECT_CAST (element),
|
|
|
|
sink->provided_clock));
|
|
|
|
|
2006-04-28 15:08:09 +00:00
|
|
|
/* make sure we unblock before calling the parent state change
|
|
|
|
* so it can grab the STREAM_LOCK */
|
2005-11-21 17:14:02 +00:00
|
|
|
gst_ring_buffer_set_flushing (sink->ringbuffer, TRUE);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
gst-libs/gst/audio/gstbaseaudiosink.c
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c
(gst_base_audio_sink_change_state):
Fix typo in comment.
* gst/playback/gstdecodebin.c (gst_decode_bin_class_init,
free_dynamics, pad_probe, close_pad_link, try_to_link_1,
get_our_ghost_pad, remove_element_chain, queue_underrun_cb,
close_link):
* gst/playback/gstplaybin.c (gst_play_bin_set_property,
gen_audio_element, remove_sinks, gst_play_bin_send_event_to_sink):
Remove trailing whitespaces in comments.
* gst/volume/Makefile.am:
Fix tabs.
2007-05-18 15:23:43 +00:00
|
|
|
/* stop slaving ourselves to the master, if any */
|
gst-libs/gst/audio/TODO: Updated TODO
Original commit message from CVS:
* gst-libs/gst/audio/TODO:
Updated TODO
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_open_device),
(gst_audioringbuffer_close_device), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_release):
Small cleanups.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_class_init), (gst_base_audio_sink_render),
(gst_base_audio_sink_change_state):
Slave to the master clock when going to PLAYING and unslave when
going to PAUSED.
* gst-libs/gst/audio/gstringbuffer.c:
(gst_ring_buffer_open_device), (gst_ring_buffer_close_device),
(gst_ring_buffer_acquire), (gst_ring_buffer_release),
(gst_ring_buffer_samples_done), (gst_ring_buffer_set_sample),
(gst_ring_buffer_clear_all), (wait_segment),
(gst_ring_buffer_commit), (gst_ring_buffer_read),
(gst_ring_buffer_advance):
* gst-libs/gst/audio/gstringbuffer.h:
Add some docs and cleanups.
2005-11-28 15:53:55 +00:00
|
|
|
gst_clock_set_master (sink->provided_clock, NULL);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
gst_ring_buffer_activate (sink->ringbuffer, FALSE);
|
2005-08-08 16:42:10 +00:00
|
|
|
gst_ring_buffer_release (sink->ringbuffer);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
2007-10-16 15:33:31 +00:00
|
|
|
/* we release again here because the aqcuire happens when setting the
|
|
|
|
* caps, which happens before we commit the state to PAUSED and thus the
|
|
|
|
* PAUSED->READY state change (see above, where we release the ringbuffer)
|
|
|
|
* might not be called when we get here. */
|
gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
|
|
|
gst_ring_buffer_activate (sink->ringbuffer, FALSE);
|
2007-10-16 15:33:31 +00:00
|
|
|
gst_ring_buffer_release (sink->ringbuffer);
|
2005-08-08 16:42:10 +00:00
|
|
|
gst_ring_buffer_close_device (sink->ringbuffer);
|
2009-04-14 11:12:59 +00:00
|
|
|
GST_OBJECT_LOCK (sink);
|
|
|
|
gst_object_unparent (GST_OBJECT_CAST (sink->ringbuffer));
|
|
|
|
sink->ringbuffer = NULL;
|
|
|
|
GST_OBJECT_UNLOCK (sink);
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2006-02-12 14:54:55 +00:00
|
|
|
|
2006-04-28 15:08:09 +00:00
|
|
|
/* ERRORS */
|
2006-02-12 14:54:55 +00:00
|
|
|
open_failed:
|
|
|
|
{
|
2006-04-28 15:08:09 +00:00
|
|
|
/* subclass must post a meaningfull error message */
|
2006-02-12 14:54:55 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "open failed");
|
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
|
|
|
}
|
An attempt at a set of audio base classes together with some design docs.
Original commit message from CVS:
* docs/design-audiosinks.txt:
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/TODO:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_get_type), (gst_audioringbuffer_class_init),
(audioringbuffer_thread_func), (gst_audioringbuffer_init),
(gst_audioringbuffer_dispose), (gst_audioringbuffer_finalize),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_play), (gst_audioringbuffer_stop),
(gst_audioringbuffer_delay), (gst_audiosink_base_init),
(gst_audiosink_class_init), (gst_audiosink_init),
(gst_audiosink_create_ringbuffer):
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_baseaudiosink_base_init), (gst_baseaudiosink_class_init),
(gst_baseaudiosink_init), (gst_baseaudiosink_set_property),
(gst_baseaudiosink_get_property), (gst_baseaudiosink_setcaps),
(gst_baseaudiosink_get_times), (gst_baseaudiosink_event),
(gst_baseaudiosink_preroll), (gst_baseaudiosink_render),
(gst_baseaudiosink_create_ringbuffer),
(gst_baseaudiosink_callback), (gst_baseaudiosink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_get_type),
(gst_ringbuffer_class_init), (gst_ringbuffer_init),
(gst_ringbuffer_dispose), (gst_ringbuffer_finalize),
(gst_ringbuffer_set_callback), (gst_ringbuffer_acquire),
(gst_ringbuffer_release), (gst_ringbuffer_play_unlocked),
(gst_ringbuffer_play), (gst_ringbuffer_pause),
(gst_ringbuffer_resume), (gst_ringbuffer_stop),
(gst_ringbuffer_callback), (gst_ringbuffer_delay),
(gst_ringbuffer_played_samples), (gst_ringbuffer_commit),
(gst_ringbuffer_prepare_read), (gst_ringbuffer_clear):
* gst-libs/gst/audio/gstringbuffer.h:
An attempt at a set of audio base classes together with some
design docs.
2005-04-20 10:19:54 +00:00
|
|
|
}
|