rename GstBaseAudio* ->GstAudioBase*

This commit is contained in:
Wim Taymans 2011-11-11 11:52:47 +01:00
parent 3d0ac3ded2
commit ee7072fe7e
13 changed files with 467 additions and 467 deletions

View file

@ -288,57 +288,57 @@ GST_AUDIO_SRC_GET_CLASS
<SECTION> <SECTION>
<FILE>gstbaseaudiosink</FILE> <FILE>gstbaseaudiosink</FILE>
<INCLUDE>gst/audio/gstbaseaudiosink.h</INCLUDE> <INCLUDE>gst/audio/gstbaseaudiosink.h</INCLUDE>
GstBaseAudioSink GstAudioBaseSink
GstBaseAudioSinkClass GstAudioBaseSinkClass
GstBaseAudioSinkSlaveMethod GstAudioBaseSinkSlaveMethod
GST_BASE_AUDIO_SINK_CLOCK GST_AUDIO_BASE_SINK_CLOCK
GST_BASE_AUDIO_SINK_PAD GST_AUDIO_BASE_SINK_PAD
gst_base_audio_sink_create_ringbuffer gst_audio_base_sink_create_ringbuffer
gst_base_audio_sink_set_provide_clock gst_audio_base_sink_set_provide_clock
gst_base_audio_sink_get_provide_clock gst_audio_base_sink_get_provide_clock
gst_base_audio_sink_set_slave_method gst_audio_base_sink_set_slave_method
gst_base_audio_sink_get_slave_method gst_audio_base_sink_get_slave_method
gst_base_audio_sink_get_drift_tolerance gst_audio_base_sink_get_drift_tolerance
gst_base_audio_sink_set_drift_tolerance gst_audio_base_sink_set_drift_tolerance
<SUBSECTION Standard> <SUBSECTION Standard>
GST_BASE_AUDIO_SINK GST_AUDIO_BASE_SINK
GST_IS_BASE_AUDIO_SINK GST_IS_AUDIO_BASE_SINK
GST_TYPE_BASE_AUDIO_SINK GST_TYPE_AUDIO_BASE_SINK
gst_base_audio_sink_get_type gst_audio_base_sink_get_type
GST_BASE_AUDIO_SINK_CLASS GST_AUDIO_BASE_SINK_CLASS
GST_IS_BASE_AUDIO_SINK_CLASS GST_IS_AUDIO_BASE_SINK_CLASS
GST_BASE_AUDIO_SINK_GET_CLASS GST_AUDIO_BASE_SINK_GET_CLASS
GstBaseAudioSinkPrivate GstAudioBaseSinkPrivate
gst_base_audio_sink_slave_method_get_type gst_audio_base_sink_slave_method_get_type
GST_TYPE_BASE_AUDIO_SINK_SLAVE_METHOD GST_TYPE_AUDIO_BASE_SINK_SLAVE_METHOD
</SECTION> </SECTION>
<SECTION> <SECTION>
<FILE>gstbaseaudiosrc</FILE> <FILE>gstbaseaudiosrc</FILE>
<INCLUDE>gst/audio/gstbaseaudiosrc.h</INCLUDE> <INCLUDE>gst/audio/gstbaseaudiosrc.h</INCLUDE>
GstBaseAudioSrc GstAudioBaseSrc
GstBaseAudioSrcClass GstAudioBaseSrcClass
GstBaseAudioSrcSlaveMethod GstAudioBaseSrcSlaveMethod
GST_BASE_AUDIO_SRC_CLOCK GST_AUDIO_BASE_SRC_CLOCK
GST_BASE_AUDIO_SRC_PAD GST_AUDIO_BASE_SRC_PAD
gst_base_audio_src_create_ringbuffer gst_audio_base_src_create_ringbuffer
gst_base_audio_src_set_provide_clock gst_audio_base_src_set_provide_clock
gst_base_audio_src_get_provide_clock gst_audio_base_src_get_provide_clock
gst_base_audio_src_get_slave_method gst_audio_base_src_get_slave_method
gst_base_audio_src_set_slave_method gst_audio_base_src_set_slave_method
<SUBSECTION Standard> <SUBSECTION Standard>
GstBaseAudioSrcPrivate GstAudioBaseSrcPrivate
GST_BASE_AUDIO_SRC GST_AUDIO_BASE_SRC
GST_IS_BASE_AUDIO_SRC GST_IS_AUDIO_BASE_SRC
GST_TYPE_BASE_AUDIO_SRC GST_TYPE_AUDIO_BASE_SRC
gst_base_audio_src_get_type gst_audio_base_src_get_type
GST_BASE_AUDIO_SRC_CLASS GST_AUDIO_BASE_SRC_CLASS
GST_IS_BASE_AUDIO_SRC_CLASS GST_IS_AUDIO_BASE_SRC_CLASS
GST_BASE_AUDIO_SRC_GET_CLASS GST_AUDIO_BASE_SRC_GET_CLASS
gst_base_audio_src_slave_method_get_type gst_audio_base_src_slave_method_get_type
GST_TYPE_BASE_AUDIO_SRC_SLAVE_METHOD GST_TYPE_AUDIO_BASE_SRC_SLAVE_METHOD
</SECTION> </SECTION>
<SECTION> <SECTION>

View file

@ -14,9 +14,9 @@ gst_audio_sink_get_type
#include <gst/audio/gstaudiosrc.h> #include <gst/audio/gstaudiosrc.h>
gst_audio_src_get_type gst_audio_src_get_type
#include <gst/audio/gstbaseaudiosink.h> #include <gst/audio/gstbaseaudiosink.h>
gst_base_audio_sink_get_type gst_audio_base_sink_get_type
#include <gst/audio/gstbaseaudiosrc.h> #include <gst/audio/gstbaseaudiosrc.h>
gst_base_audio_src_get_type gst_audio_base_src_get_type
#include <gst/audio/gstaudioringbuffer.h> #include <gst/audio/gstaudioringbuffer.h>
gst_audio_ring_buffer_get_type gst_audio_ring_buffer_get_type

View file

@ -316,7 +316,7 @@ static GstStateChangeReturn
gst_alsasrc_change_state (GstElement * element, GstStateChange transition) gst_alsasrc_change_state (GstElement * element, GstStateChange transition)
{ {
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
GstBaseAudioSrc *src = GST_BASE_AUDIO_SRC (element); GstAudioBaseSrc *src = GST_AUDIO_BASE_SRC (element);
GstAlsaSrc *asrc = GST_ALSA_SRC (element); GstAlsaSrc *asrc = GST_ALSA_SRC (element);
GstClock *clk; GstClock *clk;

View file

@ -23,12 +23,12 @@
/** /**
* SECTION:gstaudioclock * SECTION:gstaudioclock
* @short_description: Helper object for implementing audio clocks * @short_description: Helper object for implementing audio clocks
* @see_also: #GstBaseAudioSink, #GstSystemClock * @see_also: #GstAudioBaseSink, #GstSystemClock
* *
* #GstAudioClock makes it easy for elements to implement a #GstClock, they * #GstAudioClock makes it easy for elements to implement a #GstClock, they
* simply need to provide a function that returns the current clock time. * simply need to provide a function that returns the current clock time.
* *
* This object is internally used to implement the clock in #GstBaseAudioSink. * This object is internally used to implement the clock in #GstAudioBaseSink.
* *
* Last reviewed on 2006-09-27 (0.10.12) * Last reviewed on 2006-09-27 (0.10.12)
*/ */

View file

@ -20,7 +20,7 @@
/** /**
* SECTION:gstaudioringbuffer * SECTION:gstaudioringbuffer
* @short_description: Base class for audio ringbuffer implementations * @short_description: Base class for audio ringbuffer implementations
* @see_also: #GstBaseAudioSink, #GstAudioSink * @see_also: #GstAudioBaseSink, #GstAudioSink
* *
* <refsect2> * <refsect2>
* <para> * <para>

View file

@ -23,7 +23,7 @@
/** /**
* SECTION:gstaudiosink * SECTION:gstaudiosink
* @short_description: Simple base class for audio sinks * @short_description: Simple base class for audio sinks
* @see_also: #GstBaseAudioSink, #GstAudioRingBuffer, #GstAudioSink. * @see_also: #GstAudioBaseSink, #GstAudioRingBuffer, #GstAudioSink.
* *
* This is the most simple base class for audio sinks that only requires * This is the most simple base class for audio sinks that only requires
* subclasses to implement a set of simple functions: * subclasses to implement a set of simple functions:
@ -61,7 +61,7 @@
* </variablelist> * </variablelist>
* *
* All scheduling of samples and timestamps is done in this base class * All scheduling of samples and timestamps is done in this base class
* together with #GstBaseAudioSink using a default implementation of a * together with #GstAudioBaseSink using a default implementation of a
* #GstAudioRingBuffer that uses threads. * #GstAudioRingBuffer that uses threads.
* *
* Last reviewed on 2006-09-27 (0.10.12) * Last reviewed on 2006-09-27 (0.10.12)
@ -592,17 +592,17 @@ enum
GST_DEBUG_CATEGORY_INIT (gst_audio_sink_debug, "audiosink", 0, "audiosink element"); GST_DEBUG_CATEGORY_INIT (gst_audio_sink_debug, "audiosink", 0, "audiosink element");
#define gst_audio_sink_parent_class parent_class #define gst_audio_sink_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstAudioSink, gst_audio_sink, G_DEFINE_TYPE_WITH_CODE (GstAudioSink, gst_audio_sink,
GST_TYPE_BASE_AUDIO_SINK, _do_init); GST_TYPE_AUDIO_BASE_SINK, _do_init);
static GstAudioRingBuffer *gst_audio_sink_create_ringbuffer (GstBaseAudioSink * static GstAudioRingBuffer *gst_audio_sink_create_ringbuffer (GstAudioBaseSink *
sink); sink);
static void static void
gst_audio_sink_class_init (GstAudioSinkClass * klass) gst_audio_sink_class_init (GstAudioSinkClass * klass)
{ {
GstBaseAudioSinkClass *gstbaseaudiosink_class; GstAudioBaseSinkClass *gstbaseaudiosink_class;
gstbaseaudiosink_class = (GstBaseAudioSinkClass *) klass; gstbaseaudiosink_class = (GstAudioBaseSinkClass *) klass;
gstbaseaudiosink_class->create_ringbuffer = gstbaseaudiosink_class->create_ringbuffer =
GST_DEBUG_FUNCPTR (gst_audio_sink_create_ringbuffer); GST_DEBUG_FUNCPTR (gst_audio_sink_create_ringbuffer);
@ -616,7 +616,7 @@ gst_audio_sink_init (GstAudioSink * audiosink)
} }
static GstAudioRingBuffer * static GstAudioRingBuffer *
gst_audio_sink_create_ringbuffer (GstBaseAudioSink * sink) gst_audio_sink_create_ringbuffer (GstAudioBaseSink * sink)
{ {
GstAudioRingBuffer *buffer; GstAudioRingBuffer *buffer;

View file

@ -44,7 +44,7 @@ typedef struct _GstAudioSinkClass GstAudioSinkClass;
* Opaque #GstAudioSink. * Opaque #GstAudioSink.
*/ */
struct _GstAudioSink { struct _GstAudioSink {
GstBaseAudioSink element; GstAudioBaseSink element;
/*< private >*/ /* with LOCK */ /*< private >*/ /* with LOCK */
GThread *thread; GThread *thread;
@ -70,7 +70,7 @@ struct _GstAudioSink {
* #GstAudioSink class. Override the vmethods to implement functionality. * #GstAudioSink class. Override the vmethods to implement functionality.
*/ */
struct _GstAudioSinkClass { struct _GstAudioSinkClass {
GstBaseAudioSinkClass parent_class; GstAudioBaseSinkClass parent_class;
/* vtable */ /* vtable */

View file

@ -23,7 +23,7 @@
/** /**
* SECTION:gstaudiosrc * SECTION:gstaudiosrc
* @short_description: Simple base class for audio sources * @short_description: Simple base class for audio sources
* @see_also: #GstBaseAudioSrc, #GstAudioRingBuffer, #GstAudioSrc. * @see_also: #GstAudioBaseSrc, #GstAudioRingBuffer, #GstAudioSrc.
* *
* This is the most simple base class for audio sources that only requires * This is the most simple base class for audio sources that only requires
* subclasses to implement a set of simple functions: * subclasses to implement a set of simple functions:
@ -61,7 +61,7 @@
* </variablelist> * </variablelist>
* *
* All scheduling of samples and timestamps is done in this base class * All scheduling of samples and timestamps is done in this base class
* together with #GstBaseAudioSrc using a default implementation of a * together with #GstAudioBaseSrc using a default implementation of a
* #GstAudioRingBuffer that uses threads. * #GstAudioRingBuffer that uses threads.
* *
* Last reviewed on 2006-09-27 (0.10.12) * Last reviewed on 2006-09-27 (0.10.12)
@ -505,17 +505,17 @@ enum
GST_DEBUG_CATEGORY_INIT (gst_audio_src_debug, "audiosrc", 0, "audiosrc element"); GST_DEBUG_CATEGORY_INIT (gst_audio_src_debug, "audiosrc", 0, "audiosrc element");
#define gst_audio_src_parent_class parent_class #define gst_audio_src_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstAudioSrc, gst_audio_src, G_DEFINE_TYPE_WITH_CODE (GstAudioSrc, gst_audio_src,
GST_TYPE_BASE_AUDIO_SRC, _do_init); GST_TYPE_AUDIO_BASE_SRC, _do_init);
static GstAudioRingBuffer *gst_audio_src_create_ringbuffer (GstBaseAudioSrc * static GstAudioRingBuffer *gst_audio_src_create_ringbuffer (GstAudioBaseSrc *
src); src);
static void static void
gst_audio_src_class_init (GstAudioSrcClass * klass) gst_audio_src_class_init (GstAudioSrcClass * klass)
{ {
GstBaseAudioSrcClass *gstbaseaudiosrc_class; GstAudioBaseSrcClass *gstbaseaudiosrc_class;
gstbaseaudiosrc_class = (GstBaseAudioSrcClass *) klass; gstbaseaudiosrc_class = (GstAudioBaseSrcClass *) klass;
gstbaseaudiosrc_class->create_ringbuffer = gstbaseaudiosrc_class->create_ringbuffer =
GST_DEBUG_FUNCPTR (gst_audio_src_create_ringbuffer); GST_DEBUG_FUNCPTR (gst_audio_src_create_ringbuffer);
@ -529,7 +529,7 @@ gst_audio_src_init (GstAudioSrc * audiosrc)
} }
static GstAudioRingBuffer * static GstAudioRingBuffer *
gst_audio_src_create_ringbuffer (GstBaseAudioSrc * src) gst_audio_src_create_ringbuffer (GstAudioBaseSrc * src)
{ {
GstAudioRingBuffer *buffer; GstAudioRingBuffer *buffer;

View file

@ -44,7 +44,7 @@ typedef struct _GstAudioSrcClass GstAudioSrcClass;
* Base class for simple audio sources. * Base class for simple audio sources.
*/ */
struct _GstAudioSrc { struct _GstAudioSrc {
GstBaseAudioSrc element; GstAudioBaseSrc element;
/*< private >*/ /* with LOCK */ /*< private >*/ /* with LOCK */
GThread *thread; GThread *thread;
@ -68,7 +68,7 @@ struct _GstAudioSrc {
* functionality. * functionality.
*/ */
struct _GstAudioSrcClass { struct _GstAudioSrcClass {
GstBaseAudioSrcClass parent_class; GstAudioBaseSrcClass parent_class;
/* vtable */ /* vtable */

View file

@ -36,18 +36,18 @@
#include "gstbaseaudiosink.h" #include "gstbaseaudiosink.h"
GST_DEBUG_CATEGORY_STATIC (gst_base_audio_sink_debug); GST_DEBUG_CATEGORY_STATIC (gst_audio_base_sink_debug);
#define GST_CAT_DEFAULT gst_base_audio_sink_debug #define GST_CAT_DEFAULT gst_audio_base_sink_debug
#define GST_BASE_AUDIO_SINK_GET_PRIVATE(obj) \ #define GST_AUDIO_BASE_SINK_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BASE_AUDIO_SINK, GstBaseAudioSinkPrivate)) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_AUDIO_BASE_SINK, GstAudioBaseSinkPrivate))
struct _GstBaseAudioSinkPrivate struct _GstAudioBaseSinkPrivate
{ {
/* upstream latency */ /* upstream latency */
GstClockTime us_latency; GstClockTime us_latency;
/* the clock slaving algorithm in use */ /* the clock slaving algorithm in use */
GstBaseAudioSinkSlaveMethod slave_method; GstAudioBaseSinkSlaveMethod slave_method;
/* running average of clock skew */ /* running average of clock skew */
GstClockTimeDiff avg_skew; GstClockTimeDiff avg_skew;
/* the number of samples we aligned last time */ /* the number of samples we aligned last time */
@ -83,7 +83,7 @@ enum
#define DEFAULT_BUFFER_TIME ((200 * GST_MSECOND) / GST_USECOND) #define DEFAULT_BUFFER_TIME ((200 * GST_MSECOND) / GST_USECOND)
#define DEFAULT_LATENCY_TIME ((10 * GST_MSECOND) / GST_USECOND) #define DEFAULT_LATENCY_TIME ((10 * GST_MSECOND) / GST_USECOND)
#define DEFAULT_PROVIDE_CLOCK TRUE #define DEFAULT_PROVIDE_CLOCK TRUE
#define DEFAULT_SLAVE_METHOD GST_BASE_AUDIO_SINK_SLAVE_SKEW #define DEFAULT_SLAVE_METHOD GST_AUDIO_BASE_SINK_SLAVE_SKEW
/* FIXME, enable pull mode when clock slaving and trick modes are figured out */ /* FIXME, enable pull mode when clock slaving and trick modes are figured out */
#define DEFAULT_CAN_ACTIVATE_PULL FALSE #define DEFAULT_CAN_ACTIVATE_PULL FALSE
@ -117,20 +117,20 @@ enum
}; };
GType GType
gst_base_audio_sink_slave_method_get_type (void) gst_audio_base_sink_slave_method_get_type (void)
{ {
static volatile gsize slave_method_type = 0; static volatile gsize slave_method_type = 0;
static const GEnumValue slave_method[] = { static const GEnumValue slave_method[] = {
{GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE, "GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE", {GST_AUDIO_BASE_SINK_SLAVE_RESAMPLE, "GST_AUDIO_BASE_SINK_SLAVE_RESAMPLE",
"resample"}, "resample"},
{GST_BASE_AUDIO_SINK_SLAVE_SKEW, "GST_BASE_AUDIO_SINK_SLAVE_SKEW", "skew"}, {GST_AUDIO_BASE_SINK_SLAVE_SKEW, "GST_AUDIO_BASE_SINK_SLAVE_SKEW", "skew"},
{GST_BASE_AUDIO_SINK_SLAVE_NONE, "GST_BASE_AUDIO_SINK_SLAVE_NONE", "none"}, {GST_AUDIO_BASE_SINK_SLAVE_NONE, "GST_AUDIO_BASE_SINK_SLAVE_NONE", "none"},
{0, NULL, NULL}, {0, NULL, NULL},
}; };
if (g_once_init_enter (&slave_method_type)) { if (g_once_init_enter (&slave_method_type)) {
GType tmp = GType tmp =
g_enum_register_static ("GstBaseAudioSinkSlaveMethod", slave_method); g_enum_register_static ("GstAudioBaseSinkSlaveMethod", slave_method);
g_once_init_leave (&slave_method_type, tmp); g_once_init_leave (&slave_method_type, tmp);
} }
@ -139,55 +139,55 @@ gst_base_audio_sink_slave_method_get_type (void)
#define _do_init \ #define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_base_audio_sink_debug, "baseaudiosink", 0, "baseaudiosink element"); GST_DEBUG_CATEGORY_INIT (gst_audio_base_sink_debug, "baseaudiosink", 0, "baseaudiosink element");
#define gst_base_audio_sink_parent_class parent_class #define gst_audio_base_sink_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstBaseAudioSink, gst_base_audio_sink, G_DEFINE_TYPE_WITH_CODE (GstAudioBaseSink, gst_audio_base_sink,
GST_TYPE_BASE_SINK, _do_init); GST_TYPE_BASE_SINK, _do_init);
static void gst_base_audio_sink_dispose (GObject * object); static void gst_audio_base_sink_dispose (GObject * object);
static void gst_base_audio_sink_set_property (GObject * object, guint prop_id, static void gst_audio_base_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
static void gst_base_audio_sink_get_property (GObject * object, guint prop_id, static void gst_audio_base_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
#if 0 #if 0
static GstStateChangeReturn gst_base_audio_sink_async_play (GstBaseSink * static GstStateChangeReturn gst_audio_base_sink_async_play (GstBaseSink *
basesink); basesink);
#endif #endif
static GstStateChangeReturn gst_base_audio_sink_change_state (GstElement * static GstStateChangeReturn gst_audio_base_sink_change_state (GstElement *
element, GstStateChange transition); element, GstStateChange transition);
static gboolean gst_base_audio_sink_activate_pull (GstBaseSink * basesink, static gboolean gst_audio_base_sink_activate_pull (GstBaseSink * basesink,
gboolean active); gboolean active);
static gboolean gst_base_audio_sink_query (GstElement * element, GstQuery * static gboolean gst_audio_base_sink_query (GstElement * element, GstQuery *
query); query);
static GstClock *gst_base_audio_sink_provide_clock (GstElement * elem); static GstClock *gst_audio_base_sink_provide_clock (GstElement * elem);
static GstClockTime gst_base_audio_sink_get_time (GstClock * clock, static GstClockTime gst_audio_base_sink_get_time (GstClock * clock,
GstBaseAudioSink * sink); GstAudioBaseSink * sink);
static void gst_base_audio_sink_callback (GstAudioRingBuffer * rbuf, static void gst_audio_base_sink_callback (GstAudioRingBuffer * rbuf,
guint8 * data, guint len, gpointer user_data); guint8 * data, guint len, gpointer user_data);
static GstFlowReturn gst_base_audio_sink_preroll (GstBaseSink * bsink, static GstFlowReturn gst_audio_base_sink_preroll (GstBaseSink * bsink,
GstBuffer * buffer); GstBuffer * buffer);
static GstFlowReturn gst_base_audio_sink_render (GstBaseSink * bsink, static GstFlowReturn gst_audio_base_sink_render (GstBaseSink * bsink,
GstBuffer * buffer); GstBuffer * buffer);
static gboolean gst_base_audio_sink_event (GstBaseSink * bsink, static gboolean gst_audio_base_sink_event (GstBaseSink * bsink,
GstEvent * event); GstEvent * event);
static void gst_base_audio_sink_get_times (GstBaseSink * bsink, static void gst_audio_base_sink_get_times (GstBaseSink * bsink,
GstBuffer * buffer, GstClockTime * start, GstClockTime * end); GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
static gboolean gst_base_audio_sink_setcaps (GstBaseSink * bsink, static gboolean gst_audio_base_sink_setcaps (GstBaseSink * bsink,
GstCaps * caps); GstCaps * caps);
static void gst_base_audio_sink_fixate (GstBaseSink * bsink, GstCaps * caps); static void gst_audio_base_sink_fixate (GstBaseSink * bsink, GstCaps * caps);
static gboolean gst_base_audio_sink_query_pad (GstBaseSink * bsink, static gboolean gst_audio_base_sink_query_pad (GstBaseSink * bsink,
GstQuery * query); GstQuery * query);
/* static guint gst_base_audio_sink_signals[LAST_SIGNAL] = { 0 }; */ /* static guint gst_audio_base_sink_signals[LAST_SIGNAL] = { 0 }; */
static void static void
gst_base_audio_sink_class_init (GstBaseAudioSinkClass * klass) gst_audio_base_sink_class_init (GstAudioBaseSinkClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class; GstElementClass *gstelement_class;
@ -197,11 +197,11 @@ gst_base_audio_sink_class_init (GstBaseAudioSinkClass * klass)
gstelement_class = (GstElementClass *) klass; gstelement_class = (GstElementClass *) klass;
gstbasesink_class = (GstBaseSinkClass *) klass; gstbasesink_class = (GstBaseSinkClass *) klass;
g_type_class_add_private (klass, sizeof (GstBaseAudioSinkPrivate)); g_type_class_add_private (klass, sizeof (GstAudioBaseSinkPrivate));
gobject_class->set_property = gst_base_audio_sink_set_property; gobject_class->set_property = gst_audio_base_sink_set_property;
gobject_class->get_property = gst_base_audio_sink_get_property; gobject_class->get_property = gst_audio_base_sink_get_property;
gobject_class->dispose = gst_base_audio_sink_dispose; gobject_class->dispose = gst_audio_base_sink_dispose;
g_object_class_install_property (gobject_class, PROP_BUFFER_TIME, g_object_class_install_property (gobject_class, PROP_BUFFER_TIME,
g_param_spec_int64 ("buffer-time", "Buffer Time", g_param_spec_int64 ("buffer-time", "Buffer Time",
@ -223,7 +223,7 @@ gst_base_audio_sink_class_init (GstBaseAudioSinkClass * klass)
g_object_class_install_property (gobject_class, PROP_SLAVE_METHOD, g_object_class_install_property (gobject_class, PROP_SLAVE_METHOD,
g_param_spec_enum ("slave-method", "Slave Method", g_param_spec_enum ("slave-method", "Slave Method",
"Algorithm to use to match the rate of the masterclock", "Algorithm to use to match the rate of the masterclock",
GST_TYPE_BASE_AUDIO_SINK_SLAVE_METHOD, DEFAULT_SLAVE_METHOD, GST_TYPE_AUDIO_BASE_SINK_SLAVE_METHOD, DEFAULT_SLAVE_METHOD,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_CAN_ACTIVATE_PULL, g_object_class_install_property (gobject_class, PROP_CAN_ACTIVATE_PULL,
@ -231,7 +231,7 @@ gst_base_audio_sink_class_init (GstBaseAudioSinkClass * klass)
"Allow pull-based scheduling", DEFAULT_CAN_ACTIVATE_PULL, "Allow pull-based scheduling", DEFAULT_CAN_ACTIVATE_PULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/** /**
* GstBaseAudioSink:drift-tolerance * GstAudioBaseSink:drift-tolerance
* *
* Controls the amount of time in microseconds that clocks are allowed * Controls the amount of time in microseconds that clocks are allowed
* to drift before resynchronisation happens. * to drift before resynchronisation happens.
@ -244,7 +244,7 @@ gst_base_audio_sink_class_init (GstBaseAudioSinkClass * klass)
G_MAXINT64, DEFAULT_DRIFT_TOLERANCE, G_MAXINT64, DEFAULT_DRIFT_TOLERANCE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/** /**
* GstBaseAudioSink:alignment_threshold * GstAudioBaseSink:alignment_threshold
* *
* Controls the amount of time in nanoseconds that timestamps are allowed * Controls the amount of time in nanoseconds that timestamps are allowed
* to drift from their ideal time before choosing not to align them. * to drift from their ideal time before choosing not to align them.
@ -258,7 +258,7 @@ gst_base_audio_sink_class_init (GstBaseAudioSinkClass * klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/** /**
* GstBaseAudioSink:discont-wait * GstAudioBaseSink:discont-wait
* *
* A window of time in nanoseconds to wait before creating a discontinuity as * A window of time in nanoseconds to wait before creating a discontinuity as
* a result of breaching the drift-tolerance. * a result of breaching the drift-tolerance.
@ -273,21 +273,21 @@ gst_base_audio_sink_class_init (GstBaseAudioSinkClass * klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gstelement_class->change_state = gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_base_audio_sink_change_state); GST_DEBUG_FUNCPTR (gst_audio_base_sink_change_state);
gstelement_class->provide_clock = gstelement_class->provide_clock =
GST_DEBUG_FUNCPTR (gst_base_audio_sink_provide_clock); GST_DEBUG_FUNCPTR (gst_audio_base_sink_provide_clock);
gstelement_class->query = GST_DEBUG_FUNCPTR (gst_base_audio_sink_query); gstelement_class->query = GST_DEBUG_FUNCPTR (gst_audio_base_sink_query);
gstbasesink_class->fixate = GST_DEBUG_FUNCPTR (gst_base_audio_sink_fixate); gstbasesink_class->fixate = GST_DEBUG_FUNCPTR (gst_audio_base_sink_fixate);
gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_base_audio_sink_setcaps); gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_audio_base_sink_setcaps);
gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_base_audio_sink_event); gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_audio_base_sink_event);
gstbasesink_class->get_times = gstbasesink_class->get_times =
GST_DEBUG_FUNCPTR (gst_base_audio_sink_get_times); GST_DEBUG_FUNCPTR (gst_audio_base_sink_get_times);
gstbasesink_class->preroll = GST_DEBUG_FUNCPTR (gst_base_audio_sink_preroll); gstbasesink_class->preroll = GST_DEBUG_FUNCPTR (gst_audio_base_sink_preroll);
gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_base_audio_sink_render); gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_audio_base_sink_render);
gstbasesink_class->query = GST_DEBUG_FUNCPTR (gst_base_audio_sink_query_pad); gstbasesink_class->query = GST_DEBUG_FUNCPTR (gst_audio_base_sink_query_pad);
gstbasesink_class->activate_pull = gstbasesink_class->activate_pull =
GST_DEBUG_FUNCPTR (gst_base_audio_sink_activate_pull); GST_DEBUG_FUNCPTR (gst_audio_base_sink_activate_pull);
/* ref class from a thread-safe context to work around missing bit of /* ref class from a thread-safe context to work around missing bit of
* thread-safety in GObject */ * thread-safety in GObject */
@ -297,11 +297,11 @@ gst_base_audio_sink_class_init (GstBaseAudioSinkClass * klass)
} }
static void static void
gst_base_audio_sink_init (GstBaseAudioSink * baseaudiosink) gst_audio_base_sink_init (GstAudioBaseSink * baseaudiosink)
{ {
GstBaseSink *basesink; GstBaseSink *basesink;
baseaudiosink->priv = GST_BASE_AUDIO_SINK_GET_PRIVATE (baseaudiosink); baseaudiosink->priv = GST_AUDIO_BASE_SINK_GET_PRIVATE (baseaudiosink);
baseaudiosink->buffer_time = DEFAULT_BUFFER_TIME; baseaudiosink->buffer_time = DEFAULT_BUFFER_TIME;
baseaudiosink->latency_time = DEFAULT_LATENCY_TIME; baseaudiosink->latency_time = DEFAULT_LATENCY_TIME;
@ -312,7 +312,7 @@ gst_base_audio_sink_init (GstBaseAudioSink * baseaudiosink)
baseaudiosink->priv->discont_wait = DEFAULT_DISCONT_WAIT; baseaudiosink->priv->discont_wait = DEFAULT_DISCONT_WAIT;
baseaudiosink->provided_clock = gst_audio_clock_new ("GstAudioSinkClock", baseaudiosink->provided_clock = gst_audio_clock_new ("GstAudioSinkClock",
(GstAudioClockGetTimeFunc) gst_base_audio_sink_get_time, baseaudiosink, (GstAudioClockGetTimeFunc) gst_audio_base_sink_get_time, baseaudiosink,
NULL); NULL);
basesink = GST_BASE_SINK_CAST (baseaudiosink); basesink = GST_BASE_SINK_CAST (baseaudiosink);
@ -323,11 +323,11 @@ gst_base_audio_sink_init (GstBaseAudioSink * baseaudiosink)
} }
static void static void
gst_base_audio_sink_dispose (GObject * object) gst_audio_base_sink_dispose (GObject * object)
{ {
GstBaseAudioSink *sink; GstAudioBaseSink *sink;
sink = GST_BASE_AUDIO_SINK (object); sink = GST_AUDIO_BASE_SINK (object);
if (sink->provided_clock) { if (sink->provided_clock) {
gst_audio_clock_invalidate (sink->provided_clock); gst_audio_clock_invalidate (sink->provided_clock);
@ -345,12 +345,12 @@ gst_base_audio_sink_dispose (GObject * object)
static GstClock * static GstClock *
gst_base_audio_sink_provide_clock (GstElement * elem) gst_audio_base_sink_provide_clock (GstElement * elem)
{ {
GstBaseAudioSink *sink; GstAudioBaseSink *sink;
GstClock *clock; GstClock *clock;
sink = GST_BASE_AUDIO_SINK (elem); sink = GST_AUDIO_BASE_SINK (elem);
/* we have no ringbuffer (must be NULL state) */ /* we have no ringbuffer (must be NULL state) */
if (sink->ringbuffer == NULL) if (sink->ringbuffer == NULL)
@ -383,12 +383,12 @@ clock_disabled:
} }
static gboolean static gboolean
gst_base_audio_sink_query_pad (GstBaseSink * bsink, GstQuery * query) gst_audio_base_sink_query_pad (GstBaseSink * bsink, GstQuery * query)
{ {
gboolean res = FALSE; gboolean res = FALSE;
GstBaseAudioSink *basesink; GstAudioBaseSink *basesink;
basesink = GST_BASE_AUDIO_SINK (bsink); basesink = GST_AUDIO_BASE_SINK (bsink);
switch (GST_QUERY_TYPE (query)) { switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CONVERT: case GST_QUERY_CONVERT:
@ -417,12 +417,12 @@ gst_base_audio_sink_query_pad (GstBaseSink * bsink, GstQuery * query)
} }
static gboolean static gboolean
gst_base_audio_sink_query (GstElement * element, GstQuery * query) gst_audio_base_sink_query (GstElement * element, GstQuery * query)
{ {
gboolean res = FALSE; gboolean res = FALSE;
GstBaseAudioSink *basesink; GstAudioBaseSink *basesink;
basesink = GST_BASE_AUDIO_SINK (element); basesink = GST_AUDIO_BASE_SINK (element);
switch (GST_QUERY_TYPE (query)) { switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_LATENCY: case GST_QUERY_LATENCY:
@ -513,7 +513,7 @@ done:
static GstClockTime static GstClockTime
gst_base_audio_sink_get_time (GstClock * clock, GstBaseAudioSink * sink) gst_audio_base_sink_get_time (GstClock * clock, GstAudioBaseSink * sink)
{ {
guint64 raw, samples; guint64 raw, samples;
guint delay; guint delay;
@ -546,8 +546,8 @@ gst_base_audio_sink_get_time (GstClock * clock, GstBaseAudioSink * sink)
} }
/** /**
* gst_base_audio_sink_set_provide_clock: * gst_audio_base_sink_set_provide_clock:
* @sink: a #GstBaseAudioSink * @sink: a #GstAudioBaseSink
* @provide: new state * @provide: new state
* *
* Controls whether @sink will provide a clock or not. If @provide is %TRUE, * Controls whether @sink will provide a clock or not. If @provide is %TRUE,
@ -557,10 +557,10 @@ gst_base_audio_sink_get_time (GstClock * clock, GstBaseAudioSink * sink)
* Since: 0.10.16 * Since: 0.10.16
*/ */
void void
gst_base_audio_sink_set_provide_clock (GstBaseAudioSink * sink, gst_audio_base_sink_set_provide_clock (GstAudioBaseSink * sink,
gboolean provide) gboolean provide)
{ {
g_return_if_fail (GST_IS_BASE_AUDIO_SINK (sink)); g_return_if_fail (GST_IS_AUDIO_BASE_SINK (sink));
GST_OBJECT_LOCK (sink); GST_OBJECT_LOCK (sink);
sink->provide_clock = provide; sink->provide_clock = provide;
@ -568,22 +568,22 @@ gst_base_audio_sink_set_provide_clock (GstBaseAudioSink * sink,
} }
/** /**
* gst_base_audio_sink_get_provide_clock: * gst_audio_base_sink_get_provide_clock:
* @sink: a #GstBaseAudioSink * @sink: a #GstAudioBaseSink
* *
* Queries whether @sink will provide a clock or not. See also * Queries whether @sink will provide a clock or not. See also
* gst_base_audio_sink_set_provide_clock. * gst_audio_base_sink_set_provide_clock.
* *
* Returns: %TRUE if @sink will provide a clock. * Returns: %TRUE if @sink will provide a clock.
* *
* Since: 0.10.16 * Since: 0.10.16
*/ */
gboolean gboolean
gst_base_audio_sink_get_provide_clock (GstBaseAudioSink * sink) gst_audio_base_sink_get_provide_clock (GstAudioBaseSink * sink)
{ {
gboolean result; gboolean result;
g_return_val_if_fail (GST_IS_BASE_AUDIO_SINK (sink), FALSE); g_return_val_if_fail (GST_IS_AUDIO_BASE_SINK (sink), FALSE);
GST_OBJECT_LOCK (sink); GST_OBJECT_LOCK (sink);
result = sink->provide_clock; result = sink->provide_clock;
@ -593,8 +593,8 @@ gst_base_audio_sink_get_provide_clock (GstBaseAudioSink * sink)
} }
/** /**
* gst_base_audio_sink_set_slave_method: * gst_audio_base_sink_set_slave_method:
* @sink: a #GstBaseAudioSink * @sink: a #GstAudioBaseSink
* @method: the new slave method * @method: the new slave method
* *
* Controls how clock slaving will be performed in @sink. * Controls how clock slaving will be performed in @sink.
@ -602,10 +602,10 @@ gst_base_audio_sink_get_provide_clock (GstBaseAudioSink * sink)
* Since: 0.10.16 * Since: 0.10.16
*/ */
void void
gst_base_audio_sink_set_slave_method (GstBaseAudioSink * sink, gst_audio_base_sink_set_slave_method (GstAudioBaseSink * sink,
GstBaseAudioSinkSlaveMethod method) GstAudioBaseSinkSlaveMethod method)
{ {
g_return_if_fail (GST_IS_BASE_AUDIO_SINK (sink)); g_return_if_fail (GST_IS_AUDIO_BASE_SINK (sink));
GST_OBJECT_LOCK (sink); GST_OBJECT_LOCK (sink);
sink->priv->slave_method = method; sink->priv->slave_method = method;
@ -613,8 +613,8 @@ gst_base_audio_sink_set_slave_method (GstBaseAudioSink * sink,
} }
/** /**
* gst_base_audio_sink_get_slave_method: * gst_audio_base_sink_get_slave_method:
* @sink: a #GstBaseAudioSink * @sink: a #GstAudioBaseSink
* *
* Get the current slave method used by @sink. * Get the current slave method used by @sink.
* *
@ -622,12 +622,12 @@ gst_base_audio_sink_set_slave_method (GstBaseAudioSink * sink,
* *
* Since: 0.10.16 * Since: 0.10.16
*/ */
GstBaseAudioSinkSlaveMethod GstAudioBaseSinkSlaveMethod
gst_base_audio_sink_get_slave_method (GstBaseAudioSink * sink) gst_audio_base_sink_get_slave_method (GstAudioBaseSink * sink)
{ {
GstBaseAudioSinkSlaveMethod result; GstAudioBaseSinkSlaveMethod result;
g_return_val_if_fail (GST_IS_BASE_AUDIO_SINK (sink), -1); g_return_val_if_fail (GST_IS_AUDIO_BASE_SINK (sink), -1);
GST_OBJECT_LOCK (sink); GST_OBJECT_LOCK (sink);
result = sink->priv->slave_method; result = sink->priv->slave_method;
@ -638,8 +638,8 @@ gst_base_audio_sink_get_slave_method (GstBaseAudioSink * sink)
/** /**
* gst_base_audio_sink_set_drift_tolerance: * gst_audio_base_sink_set_drift_tolerance:
* @sink: a #GstBaseAudioSink * @sink: a #GstAudioBaseSink
* @drift_tolerance: the new drift tolerance in microseconds * @drift_tolerance: the new drift tolerance in microseconds
* *
* Controls the sink's drift tolerance. * Controls the sink's drift tolerance.
@ -647,10 +647,10 @@ gst_base_audio_sink_get_slave_method (GstBaseAudioSink * sink)
* Since: 0.10.31 * Since: 0.10.31
*/ */
void void
gst_base_audio_sink_set_drift_tolerance (GstBaseAudioSink * sink, gst_audio_base_sink_set_drift_tolerance (GstAudioBaseSink * sink,
gint64 drift_tolerance) gint64 drift_tolerance)
{ {
g_return_if_fail (GST_IS_BASE_AUDIO_SINK (sink)); g_return_if_fail (GST_IS_AUDIO_BASE_SINK (sink));
GST_OBJECT_LOCK (sink); GST_OBJECT_LOCK (sink);
sink->priv->drift_tolerance = drift_tolerance; sink->priv->drift_tolerance = drift_tolerance;
@ -658,8 +658,8 @@ gst_base_audio_sink_set_drift_tolerance (GstBaseAudioSink * sink,
} }
/** /**
* gst_base_audio_sink_get_drift_tolerance * gst_audio_base_sink_get_drift_tolerance
* @sink: a #GstBaseAudioSink * @sink: a #GstAudioBaseSink
* *
* Get the current drift tolerance, in microseconds, used by @sink. * Get the current drift tolerance, in microseconds, used by @sink.
* *
@ -668,11 +668,11 @@ gst_base_audio_sink_set_drift_tolerance (GstBaseAudioSink * sink,
* Since: 0.10.31 * Since: 0.10.31
*/ */
gint64 gint64
gst_base_audio_sink_get_drift_tolerance (GstBaseAudioSink * sink) gst_audio_base_sink_get_drift_tolerance (GstAudioBaseSink * sink)
{ {
gint64 result; gint64 result;
g_return_val_if_fail (GST_IS_BASE_AUDIO_SINK (sink), -1); g_return_val_if_fail (GST_IS_AUDIO_BASE_SINK (sink), -1);
GST_OBJECT_LOCK (sink); GST_OBJECT_LOCK (sink);
result = sink->priv->drift_tolerance; result = sink->priv->drift_tolerance;
@ -682,8 +682,8 @@ gst_base_audio_sink_get_drift_tolerance (GstBaseAudioSink * sink)
} }
/** /**
* gst_base_audio_sink_set_alignment_threshold: * gst_audio_base_sink_set_alignment_threshold:
* @sink: a #GstBaseAudioSink * @sink: a #GstAudioBaseSink
* @alignment_threshold: the new alignment threshold in nanoseconds * @alignment_threshold: the new alignment threshold in nanoseconds
* *
* Controls the sink's alignment threshold. * Controls the sink's alignment threshold.
@ -691,10 +691,10 @@ gst_base_audio_sink_get_drift_tolerance (GstBaseAudioSink * sink)
* Since: 0.10.36 * Since: 0.10.36
*/ */
void void
gst_base_audio_sink_set_alignment_threshold (GstBaseAudioSink * sink, gst_audio_base_sink_set_alignment_threshold (GstAudioBaseSink * sink,
GstClockTime alignment_threshold) GstClockTime alignment_threshold)
{ {
g_return_if_fail (GST_IS_BASE_AUDIO_SINK (sink)); g_return_if_fail (GST_IS_AUDIO_BASE_SINK (sink));
GST_OBJECT_LOCK (sink); GST_OBJECT_LOCK (sink);
sink->priv->alignment_threshold = alignment_threshold; sink->priv->alignment_threshold = alignment_threshold;
@ -702,8 +702,8 @@ gst_base_audio_sink_set_alignment_threshold (GstBaseAudioSink * sink,
} }
/** /**
* gst_base_audio_sink_get_alignment_threshold * gst_audio_base_sink_get_alignment_threshold
* @sink: a #GstBaseAudioSink * @sink: a #GstAudioBaseSink
* *
* Get the current alignment threshold, in nanoseconds, used by @sink. * Get the current alignment threshold, in nanoseconds, used by @sink.
* *
@ -712,11 +712,11 @@ gst_base_audio_sink_set_alignment_threshold (GstBaseAudioSink * sink,
* Since: 0.10.36 * Since: 0.10.36
*/ */
GstClockTime GstClockTime
gst_base_audio_sink_get_alignment_threshold (GstBaseAudioSink * sink) gst_audio_base_sink_get_alignment_threshold (GstAudioBaseSink * sink)
{ {
gint64 result; gint64 result;
g_return_val_if_fail (GST_IS_BASE_AUDIO_SINK (sink), -1); g_return_val_if_fail (GST_IS_AUDIO_BASE_SINK (sink), -1);
GST_OBJECT_LOCK (sink); GST_OBJECT_LOCK (sink);
result = sink->priv->alignment_threshold; result = sink->priv->alignment_threshold;
@ -726,8 +726,8 @@ gst_base_audio_sink_get_alignment_threshold (GstBaseAudioSink * sink)
} }
/** /**
* gst_base_audio_sink_set_discont_wait: * gst_audio_base_sink_set_discont_wait:
* @sink: a #GstBaseAudioSink * @sink: a #GstAudioBaseSink
* @discont_wait: the new discont wait in nanoseconds * @discont_wait: the new discont wait in nanoseconds
* *
* Controls how long the sink will wait before creating a discontinuity. * Controls how long the sink will wait before creating a discontinuity.
@ -735,10 +735,10 @@ gst_base_audio_sink_get_alignment_threshold (GstBaseAudioSink * sink)
* Since: 0.10.36 * Since: 0.10.36
*/ */
void void
gst_base_audio_sink_set_discont_wait (GstBaseAudioSink * sink, gst_audio_base_sink_set_discont_wait (GstAudioBaseSink * sink,
GstClockTime discont_wait) GstClockTime discont_wait)
{ {
g_return_if_fail (GST_IS_BASE_AUDIO_SINK (sink)); g_return_if_fail (GST_IS_AUDIO_BASE_SINK (sink));
GST_OBJECT_LOCK (sink); GST_OBJECT_LOCK (sink);
sink->priv->discont_wait = discont_wait; sink->priv->discont_wait = discont_wait;
@ -746,8 +746,8 @@ gst_base_audio_sink_set_discont_wait (GstBaseAudioSink * sink,
} }
/** /**
* gst_base_audio_sink_get_discont_wait * gst_audio_base_sink_get_discont_wait
* @sink: a #GstBaseAudioSink * @sink: a #GstAudioBaseSink
* *
* Get the current discont wait, in nanoseconds, used by @sink. * Get the current discont wait, in nanoseconds, used by @sink.
* *
@ -756,11 +756,11 @@ gst_base_audio_sink_set_discont_wait (GstBaseAudioSink * sink,
* Since: 0.10.36 * Since: 0.10.36
*/ */
GstClockTime GstClockTime
gst_base_audio_sink_get_discont_wait (GstBaseAudioSink * sink) gst_audio_base_sink_get_discont_wait (GstAudioBaseSink * sink)
{ {
GstClockTime result; GstClockTime result;
g_return_val_if_fail (GST_IS_BASE_AUDIO_SINK (sink), -1); g_return_val_if_fail (GST_IS_AUDIO_BASE_SINK (sink), -1);
GST_OBJECT_LOCK (sink); GST_OBJECT_LOCK (sink);
result = sink->priv->discont_wait; result = sink->priv->discont_wait;
@ -770,12 +770,12 @@ gst_base_audio_sink_get_discont_wait (GstBaseAudioSink * sink)
} }
static void static void
gst_base_audio_sink_set_property (GObject * object, guint prop_id, gst_audio_base_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec) const GValue * value, GParamSpec * pspec)
{ {
GstBaseAudioSink *sink; GstAudioBaseSink *sink;
sink = GST_BASE_AUDIO_SINK (object); sink = GST_AUDIO_BASE_SINK (object);
switch (prop_id) { switch (prop_id) {
case PROP_BUFFER_TIME: case PROP_BUFFER_TIME:
@ -785,23 +785,23 @@ gst_base_audio_sink_set_property (GObject * object, guint prop_id,
sink->latency_time = g_value_get_int64 (value); sink->latency_time = g_value_get_int64 (value);
break; break;
case PROP_PROVIDE_CLOCK: case PROP_PROVIDE_CLOCK:
gst_base_audio_sink_set_provide_clock (sink, g_value_get_boolean (value)); gst_audio_base_sink_set_provide_clock (sink, g_value_get_boolean (value));
break; break;
case PROP_SLAVE_METHOD: case PROP_SLAVE_METHOD:
gst_base_audio_sink_set_slave_method (sink, g_value_get_enum (value)); gst_audio_base_sink_set_slave_method (sink, g_value_get_enum (value));
break; break;
case PROP_CAN_ACTIVATE_PULL: case PROP_CAN_ACTIVATE_PULL:
GST_BASE_SINK (sink)->can_activate_pull = g_value_get_boolean (value); GST_BASE_SINK (sink)->can_activate_pull = g_value_get_boolean (value);
break; break;
case PROP_DRIFT_TOLERANCE: case PROP_DRIFT_TOLERANCE:
gst_base_audio_sink_set_drift_tolerance (sink, g_value_get_int64 (value)); gst_audio_base_sink_set_drift_tolerance (sink, g_value_get_int64 (value));
break; break;
case PROP_ALIGNMENT_THRESHOLD: case PROP_ALIGNMENT_THRESHOLD:
gst_base_audio_sink_set_alignment_threshold (sink, gst_audio_base_sink_set_alignment_threshold (sink,
g_value_get_uint64 (value)); g_value_get_uint64 (value));
break; break;
case PROP_DISCONT_WAIT: case PROP_DISCONT_WAIT:
gst_base_audio_sink_set_discont_wait (sink, g_value_get_uint64 (value)); gst_audio_base_sink_set_discont_wait (sink, g_value_get_uint64 (value));
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -810,12 +810,12 @@ gst_base_audio_sink_set_property (GObject * object, guint prop_id,
} }
static void static void
gst_base_audio_sink_get_property (GObject * object, guint prop_id, gst_audio_base_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec) GValue * value, GParamSpec * pspec)
{ {
GstBaseAudioSink *sink; GstAudioBaseSink *sink;
sink = GST_BASE_AUDIO_SINK (object); sink = GST_AUDIO_BASE_SINK (object);
switch (prop_id) { switch (prop_id) {
case PROP_BUFFER_TIME: case PROP_BUFFER_TIME:
@ -825,23 +825,23 @@ gst_base_audio_sink_get_property (GObject * object, guint prop_id,
g_value_set_int64 (value, sink->latency_time); g_value_set_int64 (value, sink->latency_time);
break; break;
case PROP_PROVIDE_CLOCK: case PROP_PROVIDE_CLOCK:
g_value_set_boolean (value, gst_base_audio_sink_get_provide_clock (sink)); g_value_set_boolean (value, gst_audio_base_sink_get_provide_clock (sink));
break; break;
case PROP_SLAVE_METHOD: case PROP_SLAVE_METHOD:
g_value_set_enum (value, gst_base_audio_sink_get_slave_method (sink)); g_value_set_enum (value, gst_audio_base_sink_get_slave_method (sink));
break; break;
case PROP_CAN_ACTIVATE_PULL: case PROP_CAN_ACTIVATE_PULL:
g_value_set_boolean (value, GST_BASE_SINK (sink)->can_activate_pull); g_value_set_boolean (value, GST_BASE_SINK (sink)->can_activate_pull);
break; break;
case PROP_DRIFT_TOLERANCE: case PROP_DRIFT_TOLERANCE:
g_value_set_int64 (value, gst_base_audio_sink_get_drift_tolerance (sink)); g_value_set_int64 (value, gst_audio_base_sink_get_drift_tolerance (sink));
break; break;
case PROP_ALIGNMENT_THRESHOLD: case PROP_ALIGNMENT_THRESHOLD:
g_value_set_uint64 (value, g_value_set_uint64 (value,
gst_base_audio_sink_get_alignment_threshold (sink)); gst_audio_base_sink_get_alignment_threshold (sink));
break; break;
case PROP_DISCONT_WAIT: case PROP_DISCONT_WAIT:
g_value_set_uint64 (value, gst_base_audio_sink_get_discont_wait (sink)); g_value_set_uint64 (value, gst_audio_base_sink_get_discont_wait (sink));
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -850,9 +850,9 @@ gst_base_audio_sink_get_property (GObject * object, guint prop_id,
} }
static gboolean static gboolean
gst_base_audio_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) gst_audio_base_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
{ {
GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (bsink); GstAudioBaseSink *sink = GST_AUDIO_BASE_SINK (bsink);
GstAudioRingBufferSpec *spec; GstAudioRingBufferSpec *spec;
GstClockTime now; GstClockTime now;
GstClockTime crate_num, crate_denom; GstClockTime crate_num, crate_denom;
@ -931,7 +931,7 @@ acquire_error:
} }
static void static void
gst_base_audio_sink_fixate (GstBaseSink * bsink, GstCaps * caps) gst_audio_base_sink_fixate (GstBaseSink * bsink, GstCaps * caps)
{ {
GstStructure *s; GstStructure *s;
gint width, depth; gint width, depth;
@ -959,7 +959,7 @@ gst_base_audio_sink_fixate (GstBaseSink * bsink, GstCaps * caps)
} }
static void static void
gst_base_audio_sink_get_times (GstBaseSink * bsink, GstBuffer * buffer, gst_audio_base_sink_get_times (GstBaseSink * bsink, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end) GstClockTime * start, GstClockTime * end)
{ {
/* our clock sync is a bit too much for the base class to handle so /* our clock sync is a bit too much for the base class to handle so
@ -970,7 +970,7 @@ gst_base_audio_sink_get_times (GstBaseSink * bsink, GstBuffer * buffer,
/* This waits for the drain to happen and can be canceled */ /* This waits for the drain to happen and can be canceled */
static gboolean static gboolean
gst_base_audio_sink_drain (GstBaseAudioSink * sink) gst_audio_base_sink_drain (GstAudioBaseSink * sink)
{ {
if (!sink->ringbuffer) if (!sink->ringbuffer)
return TRUE; return TRUE;
@ -1003,9 +1003,9 @@ gst_base_audio_sink_drain (GstBaseAudioSink * sink)
} }
static gboolean static gboolean
gst_base_audio_sink_event (GstBaseSink * bsink, GstEvent * event) gst_audio_base_sink_event (GstBaseSink * bsink, GstEvent * event)
{ {
GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (bsink); GstAudioBaseSink *sink = GST_AUDIO_BASE_SINK (bsink);
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH_START: case GST_EVENT_FLUSH_START:
@ -1023,7 +1023,7 @@ gst_base_audio_sink_event (GstBaseSink * bsink, GstEvent * event)
break; break;
case GST_EVENT_EOS: case GST_EVENT_EOS:
/* now wait till we played everything */ /* now wait till we played everything */
gst_base_audio_sink_drain (sink); gst_audio_base_sink_drain (sink);
break; break;
default: default:
break; break;
@ -1032,9 +1032,9 @@ gst_base_audio_sink_event (GstBaseSink * bsink, GstEvent * event)
} }
static GstFlowReturn static GstFlowReturn
gst_base_audio_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer) gst_audio_base_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer)
{ {
GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (bsink); GstAudioBaseSink *sink = GST_AUDIO_BASE_SINK (bsink);
if (!gst_audio_ring_buffer_is_acquired (sink->ringbuffer)) if (!gst_audio_ring_buffer_is_acquired (sink->ringbuffer))
goto wrong_state; goto wrong_state;
@ -1053,7 +1053,7 @@ wrong_state:
} }
static guint64 static guint64
gst_base_audio_sink_get_offset (GstBaseAudioSink * sink) gst_audio_base_sink_get_offset (GstAudioBaseSink * sink)
{ {
guint64 sample; guint64 sample;
gint writeseg, segdone, sps; gint writeseg, segdone, sps;
@ -1108,7 +1108,7 @@ clock_convert_external (GstClockTime external, GstClockTime cinternal,
/* algorithm to calculate sample positions that will result in resampling to /* algorithm to calculate sample positions that will result in resampling to
* match the clock rate of the master */ * match the clock rate of the master */
static void static void
gst_base_audio_sink_resample_slaving (GstBaseAudioSink * sink, gst_audio_base_sink_resample_slaving (GstAudioBaseSink * sink,
GstClockTime render_start, GstClockTime render_stop, GstClockTime render_start, GstClockTime render_stop,
GstClockTime * srender_start, GstClockTime * srender_stop) GstClockTime * srender_start, GstClockTime * srender_stop)
{ {
@ -1162,7 +1162,7 @@ gst_base_audio_sink_resample_slaving (GstBaseAudioSink * sink,
/* algorithm to calculate sample positions that will result in changing the /* algorithm to calculate sample positions that will result in changing the
* playout pointer to match the clock rate of the master */ * playout pointer to match the clock rate of the master */
static void static void
gst_base_audio_sink_skew_slaving (GstBaseAudioSink * sink, gst_audio_base_sink_skew_slaving (GstAudioBaseSink * sink,
GstClockTime render_start, GstClockTime render_stop, GstClockTime render_start, GstClockTime render_stop,
GstClockTime * srender_start, GstClockTime * srender_stop) GstClockTime * srender_start, GstClockTime * srender_stop)
{ {
@ -1270,7 +1270,7 @@ gst_base_audio_sink_skew_slaving (GstBaseAudioSink * sink,
/* apply the clock offset but do no slaving otherwise */ /* apply the clock offset but do no slaving otherwise */
static void static void
gst_base_audio_sink_none_slaving (GstBaseAudioSink * sink, gst_audio_base_sink_none_slaving (GstAudioBaseSink * sink,
GstClockTime render_start, GstClockTime render_stop, GstClockTime render_start, GstClockTime render_stop,
GstClockTime * srender_start, GstClockTime * srender_stop) GstClockTime * srender_start, GstClockTime * srender_stop)
{ {
@ -1292,21 +1292,21 @@ gst_base_audio_sink_none_slaving (GstBaseAudioSink * sink,
/* converts render_start and render_stop to their slaved values */ /* converts render_start and render_stop to their slaved values */
static void static void
gst_base_audio_sink_handle_slaving (GstBaseAudioSink * sink, gst_audio_base_sink_handle_slaving (GstAudioBaseSink * sink,
GstClockTime render_start, GstClockTime render_stop, GstClockTime render_start, GstClockTime render_stop,
GstClockTime * srender_start, GstClockTime * srender_stop) GstClockTime * srender_start, GstClockTime * srender_stop)
{ {
switch (sink->priv->slave_method) { switch (sink->priv->slave_method) {
case GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE: case GST_AUDIO_BASE_SINK_SLAVE_RESAMPLE:
gst_base_audio_sink_resample_slaving (sink, render_start, render_stop, gst_audio_base_sink_resample_slaving (sink, render_start, render_stop,
srender_start, srender_stop); srender_start, srender_stop);
break; break;
case GST_BASE_AUDIO_SINK_SLAVE_SKEW: case GST_AUDIO_BASE_SINK_SLAVE_SKEW:
gst_base_audio_sink_skew_slaving (sink, render_start, render_stop, gst_audio_base_sink_skew_slaving (sink, render_start, render_stop,
srender_start, srender_stop); srender_start, srender_stop);
break; break;
case GST_BASE_AUDIO_SINK_SLAVE_NONE: case GST_AUDIO_BASE_SINK_SLAVE_NONE:
gst_base_audio_sink_none_slaving (sink, render_start, render_stop, gst_audio_base_sink_none_slaving (sink, render_start, render_stop,
srender_start, srender_stop); srender_start, srender_stop);
break; break;
default: default:
@ -1317,18 +1317,18 @@ gst_base_audio_sink_handle_slaving (GstBaseAudioSink * sink,
/* must be called with LOCK */ /* must be called with LOCK */
static GstFlowReturn static GstFlowReturn
gst_base_audio_sink_sync_latency (GstBaseSink * bsink, GstMiniObject * obj) gst_audio_base_sink_sync_latency (GstBaseSink * bsink, GstMiniObject * obj)
{ {
GstClock *clock; GstClock *clock;
GstClockReturn status; GstClockReturn status;
GstClockTime time, render_delay; GstClockTime time, render_delay;
GstFlowReturn ret; GstFlowReturn ret;
GstBaseAudioSink *sink; GstAudioBaseSink *sink;
GstClockTime itime, etime; GstClockTime itime, etime;
GstClockTime rate_num, rate_denom; GstClockTime rate_num, rate_denom;
GstClockTimeDiff jitter; GstClockTimeDiff jitter;
sink = GST_BASE_AUDIO_SINK (bsink); sink = GST_AUDIO_BASE_SINK (bsink);
clock = GST_ELEMENT_CLOCK (sink); clock = GST_ELEMENT_CLOCK (sink);
if (G_UNLIKELY (clock == NULL)) if (G_UNLIKELY (clock == NULL))
@ -1414,13 +1414,13 @@ gst_base_audio_sink_sync_latency (GstBaseSink * bsink, GstMiniObject * obj)
rate_num, rate_denom); rate_num, rate_denom);
switch (sink->priv->slave_method) { switch (sink->priv->slave_method) {
case GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE: case GST_AUDIO_BASE_SINK_SLAVE_RESAMPLE:
/* only set as master when we are resampling */ /* only set as master when we are resampling */
GST_DEBUG_OBJECT (sink, "Setting clock as master"); GST_DEBUG_OBJECT (sink, "Setting clock as master");
gst_clock_set_master (sink->provided_clock, clock); gst_clock_set_master (sink->provided_clock, clock);
break; break;
case GST_BASE_AUDIO_SINK_SLAVE_SKEW: case GST_AUDIO_BASE_SINK_SLAVE_SKEW:
case GST_BASE_AUDIO_SINK_SLAVE_NONE: case GST_AUDIO_BASE_SINK_SLAVE_NONE:
default: default:
break; break;
} }
@ -1452,7 +1452,7 @@ flushing:
} }
static gint64 static gint64
gst_base_audio_sink_get_alignment (GstBaseAudioSink * sink, gst_audio_base_sink_get_alignment (GstAudioBaseSink * sink,
GstClockTime sample_offset) GstClockTime sample_offset)
{ {
GstAudioRingBuffer *ringbuf = sink->ringbuffer; GstAudioRingBuffer *ringbuf = sink->ringbuffer;
@ -1530,13 +1530,13 @@ gst_base_audio_sink_get_alignment (GstBaseAudioSink * sink,
} }
static GstFlowReturn static GstFlowReturn
gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf) gst_audio_base_sink_render (GstBaseSink * bsink, GstBuffer * buf)
{ {
guint64 in_offset; guint64 in_offset;
GstClockTime time, stop, render_start, render_stop, sample_offset; GstClockTime time, stop, render_start, render_stop, sample_offset;
GstClockTimeDiff sync_offset, ts_offset; GstClockTimeDiff sync_offset, ts_offset;
GstBaseAudioSinkClass *bclass; GstAudioBaseSinkClass *bclass;
GstBaseAudioSink *sink; GstAudioBaseSink *sink;
GstAudioRingBuffer *ringbuf; GstAudioRingBuffer *ringbuf;
gint64 diff, align; gint64 diff, align;
guint64 ctime, cstop; guint64 ctime, cstop;
@ -1555,8 +1555,8 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
gint64 time_offset; gint64 time_offset;
GstBuffer *out = NULL; GstBuffer *out = NULL;
sink = GST_BASE_AUDIO_SINK (bsink); sink = GST_AUDIO_BASE_SINK (bsink);
bclass = GST_BASE_AUDIO_SINK_GET_CLASS (sink); bclass = GST_AUDIO_BASE_SINK_GET_CLASS (sink);
ringbuf = sink->ringbuffer; ringbuf = sink->ringbuffer;
@ -1570,7 +1570,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
GST_OBJECT_LOCK (sink); GST_OBJECT_LOCK (sink);
base_time = GST_ELEMENT_CAST (sink)->base_time; base_time = GST_ELEMENT_CAST (sink)->base_time;
if (G_UNLIKELY (sink->priv->sync_latency)) { if (G_UNLIKELY (sink->priv->sync_latency)) {
ret = gst_base_audio_sink_sync_latency (bsink, GST_MINI_OBJECT_CAST (buf)); ret = gst_audio_base_sink_sync_latency (bsink, GST_MINI_OBJECT_CAST (buf));
GST_OBJECT_UNLOCK (sink); GST_OBJECT_UNLOCK (sink);
if (G_UNLIKELY (ret != GST_FLOW_OK)) if (G_UNLIKELY (ret != GST_FLOW_OK))
goto sync_latency_failed; goto sync_latency_failed;
@ -1614,7 +1614,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
/* if not valid timestamp or we can't clip or sync, try to play /* if not valid timestamp or we can't clip or sync, try to play
* sample ASAP */ * sample ASAP */
if (!GST_CLOCK_TIME_IS_VALID (time)) { if (!GST_CLOCK_TIME_IS_VALID (time)) {
render_start = gst_base_audio_sink_get_offset (sink); render_start = gst_audio_base_sink_get_offset (sink);
render_stop = render_start + samples; render_stop = render_start + samples;
GST_DEBUG_OBJECT (sink, "Buffer of size %" G_GSIZE_FORMAT " has no time." GST_DEBUG_OBJECT (sink, "Buffer of size %" G_GSIZE_FORMAT " has no time."
" Using render_start=%" G_GUINT64_FORMAT, size, render_start); " Using render_start=%" G_GUINT64_FORMAT, size, render_start);
@ -1691,7 +1691,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
if (!sync) { if (!sync) {
/* no sync needed, play sample ASAP */ /* no sync needed, play sample ASAP */
render_start = gst_base_audio_sink_get_offset (sink); render_start = gst_audio_base_sink_get_offset (sink);
render_stop = render_start + samples; render_stop = render_start + samples;
GST_DEBUG_OBJECT (sink, GST_DEBUG_OBJECT (sink,
"no sync needed. Using render_start=%" G_GUINT64_FORMAT, render_start); "no sync needed. Using render_start=%" G_GUINT64_FORMAT, render_start);
@ -1737,12 +1737,12 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
if ((slaved = clock != sink->provided_clock)) { if ((slaved = clock != sink->provided_clock)) {
/* handle clock slaving */ /* handle clock slaving */
gst_base_audio_sink_handle_slaving (sink, render_start, render_stop, gst_audio_base_sink_handle_slaving (sink, render_start, render_stop,
&render_start, &render_stop); &render_start, &render_stop);
} else { } else {
/* no slaving needed but we need to adapt to the clock calibration /* no slaving needed but we need to adapt to the clock calibration
* parameters */ * parameters */
gst_base_audio_sink_none_slaving (sink, render_start, render_stop, gst_audio_base_sink_none_slaving (sink, render_start, render_stop,
&render_start, &render_stop); &render_start, &render_stop);
} }
@ -1799,14 +1799,14 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
goto no_align; goto no_align;
} }
align = gst_base_audio_sink_get_alignment (sink, sample_offset); align = gst_audio_base_sink_get_alignment (sink, sample_offset);
sink->priv->last_align = align; sink->priv->last_align = align;
/* apply alignment */ /* apply alignment */
render_start += align; render_start += align;
/* only align stop if we are not slaved to resample */ /* only align stop if we are not slaved to resample */
if (slaved && sink->priv->slave_method == GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE) { if (slaved && sink->priv->slave_method == GST_AUDIO_BASE_SINK_SLAVE_RESAMPLE) {
GST_DEBUG_OBJECT (sink, "no stop time align needed: we are slaved"); GST_DEBUG_OBJECT (sink, "no stop time align needed: we are slaved");
goto no_align; goto no_align;
} }
@ -1935,8 +1935,8 @@ sync_latency_failed:
} }
/** /**
* gst_base_audio_sink_create_ringbuffer: * gst_audio_base_sink_create_ringbuffer:
* @sink: a #GstBaseAudioSink. * @sink: a #GstAudioBaseSink.
* *
* Create and return the #GstAudioRingBuffer for @sink. This function will call the * Create and return the #GstAudioRingBuffer for @sink. This function will call the
* ::create_ringbuffer vmethod and will set @sink as the parent of the returned * ::create_ringbuffer vmethod and will set @sink as the parent of the returned
@ -1945,12 +1945,12 @@ sync_latency_failed:
* Returns: The new ringbuffer of @sink. * Returns: The new ringbuffer of @sink.
*/ */
GstAudioRingBuffer * GstAudioRingBuffer *
gst_base_audio_sink_create_ringbuffer (GstBaseAudioSink * sink) gst_audio_base_sink_create_ringbuffer (GstAudioBaseSink * sink)
{ {
GstBaseAudioSinkClass *bclass; GstAudioBaseSinkClass *bclass;
GstAudioRingBuffer *buffer = NULL; GstAudioRingBuffer *buffer = NULL;
bclass = GST_BASE_AUDIO_SINK_GET_CLASS (sink); bclass = GST_AUDIO_BASE_SINK_GET_CLASS (sink);
if (bclass->create_ringbuffer) if (bclass->create_ringbuffer)
buffer = bclass->create_ringbuffer (sink); buffer = bclass->create_ringbuffer (sink);
@ -1961,17 +1961,17 @@ gst_base_audio_sink_create_ringbuffer (GstBaseAudioSink * sink)
} }
static void static void
gst_base_audio_sink_callback (GstAudioRingBuffer * rbuf, guint8 * data, gst_audio_base_sink_callback (GstAudioRingBuffer * rbuf, guint8 * data,
guint len, gpointer user_data) guint len, gpointer user_data)
{ {
GstBaseSink *basesink; GstBaseSink *basesink;
GstBaseAudioSink *sink; GstAudioBaseSink *sink;
GstBuffer *buf; GstBuffer *buf;
GstFlowReturn ret; GstFlowReturn ret;
gsize size; gsize size;
basesink = GST_BASE_SINK (user_data); basesink = GST_BASE_SINK (user_data);
sink = GST_BASE_AUDIO_SINK (user_data); sink = GST_AUDIO_BASE_SINK (user_data);
GST_PAD_STREAM_LOCK (basesink->sinkpad); GST_PAD_STREAM_LOCK (basesink->sinkpad);
@ -2031,7 +2031,7 @@ eos:
* the sink gets shut down; maybe we should set a flag somewhere, or * 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 */ * set segment.stop and segment.duration to the last sample or so */
GST_DEBUG_OBJECT (sink, "EOS"); GST_DEBUG_OBJECT (sink, "EOS");
gst_base_audio_sink_drain (sink); gst_audio_base_sink_drain (sink);
gst_audio_ring_buffer_pause (rbuf); gst_audio_ring_buffer_pause (rbuf);
gst_element_post_message (GST_ELEMENT_CAST (sink), gst_element_post_message (GST_ELEMENT_CAST (sink),
gst_message_new_eos (GST_OBJECT_CAST (sink))); gst_message_new_eos (GST_OBJECT_CAST (sink)));
@ -2056,16 +2056,16 @@ preroll_error:
} }
static gboolean static gboolean
gst_base_audio_sink_activate_pull (GstBaseSink * basesink, gboolean active) gst_audio_base_sink_activate_pull (GstBaseSink * basesink, gboolean active)
{ {
gboolean ret; gboolean ret;
GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (basesink); GstAudioBaseSink *sink = GST_AUDIO_BASE_SINK (basesink);
if (active) { if (active) {
GST_DEBUG_OBJECT (basesink, "activating pull"); GST_DEBUG_OBJECT (basesink, "activating pull");
gst_audio_ring_buffer_set_callback (sink->ringbuffer, gst_audio_ring_buffer_set_callback (sink->ringbuffer,
gst_base_audio_sink_callback, sink); gst_audio_base_sink_callback, sink);
ret = gst_audio_ring_buffer_activate (sink->ringbuffer, TRUE); ret = gst_audio_ring_buffer_activate (sink->ringbuffer, TRUE);
} else { } else {
@ -2080,11 +2080,11 @@ gst_base_audio_sink_activate_pull (GstBaseSink * basesink, gboolean active)
#if 0 #if 0
/* should be called with the LOCK */ /* should be called with the LOCK */
static GstStateChangeReturn static GstStateChangeReturn
gst_base_audio_sink_async_play (GstBaseSink * basesink) gst_audio_base_sink_async_play (GstBaseSink * basesink)
{ {
GstBaseAudioSink *sink; GstAudioBaseSink *sink;
sink = GST_BASE_AUDIO_SINK (basesink); sink = GST_AUDIO_BASE_SINK (basesink);
GST_DEBUG_OBJECT (sink, "ringbuffer may start now"); GST_DEBUG_OBJECT (sink, "ringbuffer may start now");
sink->priv->sync_latency = TRUE; sink->priv->sync_latency = TRUE;
@ -2099,17 +2099,17 @@ gst_base_audio_sink_async_play (GstBaseSink * basesink)
#endif #endif
static GstStateChangeReturn static GstStateChangeReturn
gst_base_audio_sink_change_state (GstElement * element, gst_audio_base_sink_change_state (GstElement * element,
GstStateChange transition) GstStateChange transition)
{ {
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (element); GstAudioBaseSink *sink = GST_AUDIO_BASE_SINK (element);
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
if (sink->ringbuffer == NULL) { if (sink->ringbuffer == NULL) {
gst_audio_clock_reset (GST_AUDIO_CLOCK (sink->provided_clock), 0); gst_audio_clock_reset (GST_AUDIO_CLOCK (sink->provided_clock), 0);
sink->ringbuffer = gst_base_audio_sink_create_ringbuffer (sink); sink->ringbuffer = gst_audio_base_sink_create_ringbuffer (sink);
} }
if (!gst_audio_ring_buffer_open_device (sink->ringbuffer)) if (!gst_audio_ring_buffer_open_device (sink->ringbuffer))
goto open_failed; goto open_failed;
@ -2127,7 +2127,7 @@ gst_base_audio_sink_change_state (GstElement * element,
* should post this messages whenever necessary */ * should post this messages whenever necessary */
if (sink->provided_clock && GST_IS_AUDIO_CLOCK (sink->provided_clock) && if (sink->provided_clock && GST_IS_AUDIO_CLOCK (sink->provided_clock) &&
GST_AUDIO_CLOCK_CAST (sink->provided_clock)->func == GST_AUDIO_CLOCK_CAST (sink->provided_clock)->func ==
(GstAudioClockGetTimeFunc) gst_base_audio_sink_get_time) (GstAudioClockGetTimeFunc) gst_audio_base_sink_get_time)
gst_element_post_message (element, gst_element_post_message (element,
gst_message_new_clock_provide (GST_OBJECT_CAST (element), gst_message_new_clock_provide (GST_OBJECT_CAST (element),
sink->provided_clock, TRUE)); sink->provided_clock, TRUE));
@ -2167,7 +2167,7 @@ gst_base_audio_sink_change_state (GstElement * element,
* should post this messages whenever necessary */ * should post this messages whenever necessary */
if (sink->provided_clock && GST_IS_AUDIO_CLOCK (sink->provided_clock) && if (sink->provided_clock && GST_IS_AUDIO_CLOCK (sink->provided_clock) &&
GST_AUDIO_CLOCK_CAST (sink->provided_clock)->func == GST_AUDIO_CLOCK_CAST (sink->provided_clock)->func ==
(GstAudioClockGetTimeFunc) gst_base_audio_sink_get_time) (GstAudioClockGetTimeFunc) gst_audio_base_sink_get_time)
gst_element_post_message (element, gst_element_post_message (element,
gst_message_new_clock_lost (GST_OBJECT_CAST (element), gst_message_new_clock_lost (GST_OBJECT_CAST (element),
sink->provided_clock)); sink->provided_clock));

View file

@ -46,8 +46,8 @@
* the methods in GstBaseSink and this class. * the methods in GstBaseSink and this class.
*/ */
#ifndef __GST_BASE_AUDIO_SINK_H__ #ifndef __GST_AUDIO_BASE_SINK_H__
#define __GST_BASE_AUDIO_SINK_H__ #define __GST_AUDIO_BASE_SINK_H__
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/base/gstbasesink.h> #include <gst/base/gstbasesink.h>
@ -56,57 +56,57 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define GST_TYPE_BASE_AUDIO_SINK (gst_base_audio_sink_get_type()) #define GST_TYPE_AUDIO_BASE_SINK (gst_audio_base_sink_get_type())
#define GST_BASE_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_AUDIO_SINK,GstBaseAudioSink)) #define GST_AUDIO_BASE_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_BASE_SINK,GstAudioBaseSink))
#define GST_BASE_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_AUDIO_SINK,GstBaseAudioSinkClass)) #define GST_AUDIO_BASE_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_BASE_SINK,GstAudioBaseSinkClass))
#define GST_BASE_AUDIO_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_AUDIO_SINK, GstBaseAudioSinkClass)) #define GST_AUDIO_BASE_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIO_BASE_SINK, GstAudioBaseSinkClass))
#define GST_IS_BASE_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_AUDIO_SINK)) #define GST_IS_AUDIO_BASE_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_BASE_SINK))
#define GST_IS_BASE_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_AUDIO_SINK)) #define GST_IS_AUDIO_BASE_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_BASE_SINK))
/** /**
* GST_BASE_AUDIO_SINK_CLOCK: * GST_AUDIO_BASE_SINK_CLOCK:
* @obj: a #GstBaseAudioSink * @obj: a #GstAudioBaseSink
* *
* Get the #GstClock of @obj. * Get the #GstClock of @obj.
*/ */
#define GST_BASE_AUDIO_SINK_CLOCK(obj) (GST_BASE_AUDIO_SINK (obj)->clock) #define GST_AUDIO_BASE_SINK_CLOCK(obj) (GST_AUDIO_BASE_SINK (obj)->clock)
/** /**
* GST_BASE_AUDIO_SINK_PAD: * GST_AUDIO_BASE_SINK_PAD:
* @obj: a #GstBaseAudioSink * @obj: a #GstAudioBaseSink
* *
* Get the sink #GstPad of @obj. * Get the sink #GstPad of @obj.
*/ */
#define GST_BASE_AUDIO_SINK_PAD(obj) (GST_BASE_SINK (obj)->sinkpad) #define GST_AUDIO_BASE_SINK_PAD(obj) (GST_BASE_SINK (obj)->sinkpad)
/** /**
* GstBaseAudioSinkSlaveMethod: * GstAudioBaseSinkSlaveMethod:
* @GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE: Resample to match the master clock * @GST_AUDIO_BASE_SINK_SLAVE_RESAMPLE: Resample to match the master clock
* @GST_BASE_AUDIO_SINK_SLAVE_SKEW: Adjust playout pointer when master clock * @GST_AUDIO_BASE_SINK_SLAVE_SKEW: Adjust playout pointer when master clock
* drifts too much. * drifts too much.
* @GST_BASE_AUDIO_SINK_SLAVE_NONE: No adjustment is done. * @GST_AUDIO_BASE_SINK_SLAVE_NONE: No adjustment is done.
* *
* Different possible clock slaving algorithms used when the internal audio * Different possible clock slaving algorithms used when the internal audio
* clock is not selected as the pipeline master clock. * clock is not selected as the pipeline master clock.
*/ */
typedef enum typedef enum
{ {
GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE, GST_AUDIO_BASE_SINK_SLAVE_RESAMPLE,
GST_BASE_AUDIO_SINK_SLAVE_SKEW, GST_AUDIO_BASE_SINK_SLAVE_SKEW,
GST_BASE_AUDIO_SINK_SLAVE_NONE GST_AUDIO_BASE_SINK_SLAVE_NONE
} GstBaseAudioSinkSlaveMethod; } GstAudioBaseSinkSlaveMethod;
#define GST_TYPE_BASE_AUDIO_SINK_SLAVE_METHOD (gst_base_audio_sink_slave_method_get_type ()) #define GST_TYPE_AUDIO_BASE_SINK_SLAVE_METHOD (gst_audio_base_sink_slave_method_get_type ())
typedef struct _GstBaseAudioSink GstBaseAudioSink; typedef struct _GstAudioBaseSink GstAudioBaseSink;
typedef struct _GstBaseAudioSinkClass GstBaseAudioSinkClass; typedef struct _GstAudioBaseSinkClass GstAudioBaseSinkClass;
typedef struct _GstBaseAudioSinkPrivate GstBaseAudioSinkPrivate; typedef struct _GstAudioBaseSinkPrivate GstAudioBaseSinkPrivate;
/** /**
* GstBaseAudioSink: * GstAudioBaseSink:
* *
* Opaque #GstBaseAudioSink. * Opaque #GstAudioBaseSink.
*/ */
struct _GstBaseAudioSink { struct _GstAudioBaseSink {
GstBaseSink element; GstBaseSink element;
/*< protected >*/ /* with LOCK */ /*< protected >*/ /* with LOCK */
@ -128,13 +128,13 @@ struct _GstBaseAudioSink {
gboolean eos_rendering; gboolean eos_rendering;
/*< private >*/ /*< private >*/
GstBaseAudioSinkPrivate *priv; GstAudioBaseSinkPrivate *priv;
gpointer _gst_reserved[GST_PADDING]; gpointer _gst_reserved[GST_PADDING];
}; };
/** /**
* GstBaseAudioSinkClass: * GstAudioBaseSinkClass:
* @parent_class: the parent class. * @parent_class: the parent class.
* @create_ringbuffer: create and return a #GstAudioRingBuffer to write to. * @create_ringbuffer: create and return a #GstAudioRingBuffer to write to.
* @payload: payload data in a format suitable to write to the sink. If no * @payload: payload data in a format suitable to write to the sink. If no
@ -142,50 +142,50 @@ struct _GstBaseAudioSink {
* buffer, else returns the payloaded buffer with all other metadata * buffer, else returns the payloaded buffer with all other metadata
* copied. (Since: 0.10.36) * copied. (Since: 0.10.36)
* *
* #GstBaseAudioSink class. Override the vmethod to implement * #GstAudioBaseSink class. Override the vmethod to implement
* functionality. * functionality.
*/ */
struct _GstBaseAudioSinkClass { struct _GstAudioBaseSinkClass {
GstBaseSinkClass parent_class; GstBaseSinkClass parent_class;
/* subclass ringbuffer allocation */ /* subclass ringbuffer allocation */
GstAudioRingBuffer* (*create_ringbuffer) (GstBaseAudioSink *sink); GstAudioRingBuffer* (*create_ringbuffer) (GstAudioBaseSink *sink);
/* subclass payloader */ /* subclass payloader */
GstBuffer* (*payload) (GstBaseAudioSink *sink, GstBuffer* (*payload) (GstAudioBaseSink *sink,
GstBuffer *buffer); GstBuffer *buffer);
/*< private >*/ /*< private >*/
gpointer _gst_reserved[GST_PADDING]; gpointer _gst_reserved[GST_PADDING];
}; };
GType gst_base_audio_sink_get_type(void); GType gst_audio_base_sink_get_type(void);
GType gst_base_audio_sink_slave_method_get_type (void); GType gst_audio_base_sink_slave_method_get_type (void);
GstAudioRingBuffer * GstAudioRingBuffer *
gst_base_audio_sink_create_ringbuffer (GstBaseAudioSink *sink); gst_audio_base_sink_create_ringbuffer (GstAudioBaseSink *sink);
void gst_base_audio_sink_set_provide_clock (GstBaseAudioSink *sink, gboolean provide); void gst_audio_base_sink_set_provide_clock (GstAudioBaseSink *sink, gboolean provide);
gboolean gst_base_audio_sink_get_provide_clock (GstBaseAudioSink *sink); gboolean gst_audio_base_sink_get_provide_clock (GstAudioBaseSink *sink);
void gst_base_audio_sink_set_slave_method (GstBaseAudioSink *sink, void gst_audio_base_sink_set_slave_method (GstAudioBaseSink *sink,
GstBaseAudioSinkSlaveMethod method); GstAudioBaseSinkSlaveMethod method);
GstBaseAudioSinkSlaveMethod GstAudioBaseSinkSlaveMethod
gst_base_audio_sink_get_slave_method (GstBaseAudioSink *sink); gst_audio_base_sink_get_slave_method (GstAudioBaseSink *sink);
void gst_base_audio_sink_set_drift_tolerance (GstBaseAudioSink *sink, void gst_audio_base_sink_set_drift_tolerance (GstAudioBaseSink *sink,
gint64 drift_tolerance); gint64 drift_tolerance);
gint64 gst_base_audio_sink_get_drift_tolerance (GstBaseAudioSink *sink); gint64 gst_audio_base_sink_get_drift_tolerance (GstAudioBaseSink *sink);
void gst_base_audio_sink_set_alignment_threshold (GstBaseAudioSink * sink, void gst_audio_base_sink_set_alignment_threshold (GstAudioBaseSink * sink,
GstClockTime alignment_threshold); GstClockTime alignment_threshold);
GstClockTime GstClockTime
gst_base_audio_sink_get_alignment_threshold (GstBaseAudioSink * sink); gst_audio_base_sink_get_alignment_threshold (GstAudioBaseSink * sink);
void gst_base_audio_sink_set_discont_wait (GstBaseAudioSink * sink, void gst_audio_base_sink_set_discont_wait (GstAudioBaseSink * sink,
GstClockTime discont_wait); GstClockTime discont_wait);
GstClockTime GstClockTime
gst_base_audio_sink_get_discont_wait (GstBaseAudioSink * sink); gst_audio_base_sink_get_discont_wait (GstAudioBaseSink * sink);
G_END_DECLS G_END_DECLS
#endif /* __GST_BASE_AUDIO_SINK_H__ */ #endif /* __GST_AUDIO_BASE_SINK_H__ */

View file

@ -42,41 +42,41 @@
#include "gst/gst-i18n-plugin.h" #include "gst/gst-i18n-plugin.h"
GST_DEBUG_CATEGORY_STATIC (gst_base_audio_src_debug); GST_DEBUG_CATEGORY_STATIC (gst_audio_base_src_debug);
#define GST_CAT_DEFAULT gst_base_audio_src_debug #define GST_CAT_DEFAULT gst_audio_base_src_debug
GType GType
gst_base_audio_src_slave_method_get_type (void) gst_audio_base_src_slave_method_get_type (void)
{ {
static volatile gsize slave_method_type = 0; static volatile gsize slave_method_type = 0;
/* FIXME 0.11: nick should be "retimestamp" not "re-timestamp" */ /* FIXME 0.11: nick should be "retimestamp" not "re-timestamp" */
static const GEnumValue slave_method[] = { static const GEnumValue slave_method[] = {
{GST_BASE_AUDIO_SRC_SLAVE_RESAMPLE, {GST_AUDIO_BASE_SRC_SLAVE_RESAMPLE,
"GST_BASE_AUDIO_SRC_SLAVE_RESAMPLE", "resample"}, "GST_AUDIO_BASE_SRC_SLAVE_RESAMPLE", "resample"},
{GST_BASE_AUDIO_SRC_SLAVE_RETIMESTAMP, {GST_AUDIO_BASE_SRC_SLAVE_RETIMESTAMP,
"GST_BASE_AUDIO_SRC_SLAVE_RETIMESTAMP", "re-timestamp"}, "GST_AUDIO_BASE_SRC_SLAVE_RETIMESTAMP", "re-timestamp"},
{GST_BASE_AUDIO_SRC_SLAVE_SKEW, "GST_BASE_AUDIO_SRC_SLAVE_SKEW", "skew"}, {GST_AUDIO_BASE_SRC_SLAVE_SKEW, "GST_AUDIO_BASE_SRC_SLAVE_SKEW", "skew"},
{GST_BASE_AUDIO_SRC_SLAVE_NONE, "GST_BASE_AUDIO_SRC_SLAVE_NONE", "none"}, {GST_AUDIO_BASE_SRC_SLAVE_NONE, "GST_AUDIO_BASE_SRC_SLAVE_NONE", "none"},
{0, NULL, NULL}, {0, NULL, NULL},
}; };
if (g_once_init_enter (&slave_method_type)) { if (g_once_init_enter (&slave_method_type)) {
GType tmp = GType tmp =
g_enum_register_static ("GstBaseAudioSrcSlaveMethod", slave_method); g_enum_register_static ("GstAudioBaseSrcSlaveMethod", slave_method);
g_once_init_leave (&slave_method_type, tmp); g_once_init_leave (&slave_method_type, tmp);
} }
return (GType) slave_method_type; return (GType) slave_method_type;
} }
#define GST_BASE_AUDIO_SRC_GET_PRIVATE(obj) \ #define GST_AUDIO_BASE_SRC_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BASE_AUDIO_SRC, GstBaseAudioSrcPrivate)) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_AUDIO_BASE_SRC, GstAudioBaseSrcPrivate))
struct _GstBaseAudioSrcPrivate struct _GstAudioBaseSrcPrivate
{ {
gboolean provide_clock; gboolean provide_clock;
/* the clock slaving algorithm in use */ /* the clock slaving algorithm in use */
GstBaseAudioSrcSlaveMethod slave_method; GstAudioBaseSrcSlaveMethod slave_method;
}; };
/* BaseAudioSrc signals and args */ /* BaseAudioSrc signals and args */
@ -91,7 +91,7 @@ enum
#define DEFAULT_ACTUAL_BUFFER_TIME -1 #define DEFAULT_ACTUAL_BUFFER_TIME -1
#define DEFAULT_ACTUAL_LATENCY_TIME -1 #define DEFAULT_ACTUAL_LATENCY_TIME -1
#define DEFAULT_PROVIDE_CLOCK TRUE #define DEFAULT_PROVIDE_CLOCK TRUE
#define DEFAULT_SLAVE_METHOD GST_BASE_AUDIO_SRC_SLAVE_SKEW #define DEFAULT_SLAVE_METHOD GST_AUDIO_BASE_SRC_SLAVE_SKEW
enum enum
{ {
@ -108,7 +108,7 @@ enum
static void static void
_do_init (GType type) _do_init (GType type)
{ {
GST_DEBUG_CATEGORY_INIT (gst_base_audio_src_debug, "baseaudiosrc", 0, GST_DEBUG_CATEGORY_INIT (gst_audio_base_src_debug, "baseaudiosrc", 0,
"baseaudiosrc element"); "baseaudiosrc element");
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
@ -119,37 +119,37 @@ _do_init (GType type)
#endif /* ENABLE_NLS */ #endif /* ENABLE_NLS */
} }
#define gst_base_audio_src_parent_class parent_class #define gst_audio_base_src_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstBaseAudioSrc, gst_base_audio_src, GST_TYPE_PUSH_SRC, G_DEFINE_TYPE_WITH_CODE (GstAudioBaseSrc, gst_audio_base_src, GST_TYPE_PUSH_SRC,
_do_init (g_define_type_id)); _do_init (g_define_type_id));
static void gst_base_audio_src_set_property (GObject * object, guint prop_id, static void gst_audio_base_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
static void gst_base_audio_src_get_property (GObject * object, guint prop_id, static void gst_audio_base_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
static void gst_base_audio_src_dispose (GObject * object); static void gst_audio_base_src_dispose (GObject * object);
static GstStateChangeReturn gst_base_audio_src_change_state (GstElement * static GstStateChangeReturn gst_audio_base_src_change_state (GstElement *
element, GstStateChange transition); element, GstStateChange transition);
static GstClock *gst_base_audio_src_provide_clock (GstElement * elem); static GstClock *gst_audio_base_src_provide_clock (GstElement * elem);
static GstClockTime gst_base_audio_src_get_time (GstClock * clock, static GstClockTime gst_audio_base_src_get_time (GstClock * clock,
GstBaseAudioSrc * src); GstAudioBaseSrc * src);
static GstFlowReturn gst_base_audio_src_create (GstBaseSrc * bsrc, static GstFlowReturn gst_audio_base_src_create (GstBaseSrc * bsrc,
guint64 offset, guint length, GstBuffer ** buf); guint64 offset, guint length, GstBuffer ** buf);
static gboolean gst_base_audio_src_event (GstBaseSrc * bsrc, GstEvent * event); static gboolean gst_audio_base_src_event (GstBaseSrc * bsrc, GstEvent * event);
static void gst_base_audio_src_get_times (GstBaseSrc * bsrc, static void gst_audio_base_src_get_times (GstBaseSrc * bsrc,
GstBuffer * buffer, GstClockTime * start, GstClockTime * end); GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
static gboolean gst_base_audio_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps); static gboolean gst_audio_base_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps);
static gboolean gst_base_audio_src_query (GstBaseSrc * bsrc, GstQuery * query); static gboolean gst_audio_base_src_query (GstBaseSrc * bsrc, GstQuery * query);
static void gst_base_audio_src_fixate (GstBaseSrc * bsrc, GstCaps * caps); static void gst_audio_base_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
/* static guint gst_base_audio_src_signals[LAST_SIGNAL] = { 0 }; */ /* static guint gst_audio_base_src_signals[LAST_SIGNAL] = { 0 }; */
static void static void
gst_base_audio_src_class_init (GstBaseAudioSrcClass * klass) gst_audio_base_src_class_init (GstAudioBaseSrcClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class; GstElementClass *gstelement_class;
@ -159,11 +159,11 @@ gst_base_audio_src_class_init (GstBaseAudioSrcClass * klass)
gstelement_class = (GstElementClass *) klass; gstelement_class = (GstElementClass *) klass;
gstbasesrc_class = (GstBaseSrcClass *) klass; gstbasesrc_class = (GstBaseSrcClass *) klass;
g_type_class_add_private (klass, sizeof (GstBaseAudioSrcPrivate)); g_type_class_add_private (klass, sizeof (GstAudioBaseSrcPrivate));
gobject_class->set_property = gst_base_audio_src_set_property; gobject_class->set_property = gst_audio_base_src_set_property;
gobject_class->get_property = gst_base_audio_src_get_property; gobject_class->get_property = gst_audio_base_src_get_property;
gobject_class->dispose = gst_base_audio_src_dispose; gobject_class->dispose = gst_audio_base_src_dispose;
g_object_class_install_property (gobject_class, PROP_BUFFER_TIME, g_object_class_install_property (gobject_class, PROP_BUFFER_TIME,
g_param_spec_int64 ("buffer-time", "Buffer Time", g_param_spec_int64 ("buffer-time", "Buffer Time",
@ -178,7 +178,7 @@ gst_base_audio_src_class_init (GstBaseAudioSrcClass * klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/** /**
* GstBaseAudioSrc:actual-buffer-time: * GstAudioBaseSrc:actual-buffer-time:
* *
* Actual configured size of audio buffer in microseconds. * Actual configured size of audio buffer in microseconds.
* *
@ -191,7 +191,7 @@ gst_base_audio_src_class_init (GstBaseAudioSrcClass * klass)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/** /**
* GstBaseAudioSrc:actual-latency-time: * GstAudioBaseSrc:actual-latency-time:
* *
* Actual configured audio latency in microseconds. * Actual configured audio latency in microseconds.
* *
@ -211,21 +211,21 @@ gst_base_audio_src_class_init (GstBaseAudioSrcClass * klass)
g_object_class_install_property (gobject_class, PROP_SLAVE_METHOD, g_object_class_install_property (gobject_class, PROP_SLAVE_METHOD,
g_param_spec_enum ("slave-method", "Slave Method", g_param_spec_enum ("slave-method", "Slave Method",
"Algorithm to use to match the rate of the masterclock", "Algorithm to use to match the rate of the masterclock",
GST_TYPE_BASE_AUDIO_SRC_SLAVE_METHOD, DEFAULT_SLAVE_METHOD, GST_TYPE_AUDIO_BASE_SRC_SLAVE_METHOD, DEFAULT_SLAVE_METHOD,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gstelement_class->change_state = gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_base_audio_src_change_state); GST_DEBUG_FUNCPTR (gst_audio_base_src_change_state);
gstelement_class->provide_clock = gstelement_class->provide_clock =
GST_DEBUG_FUNCPTR (gst_base_audio_src_provide_clock); GST_DEBUG_FUNCPTR (gst_audio_base_src_provide_clock);
gstbasesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_base_audio_src_setcaps); gstbasesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_audio_base_src_setcaps);
gstbasesrc_class->event = GST_DEBUG_FUNCPTR (gst_base_audio_src_event); gstbasesrc_class->event = GST_DEBUG_FUNCPTR (gst_audio_base_src_event);
gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_base_audio_src_query); gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_audio_base_src_query);
gstbasesrc_class->get_times = gstbasesrc_class->get_times =
GST_DEBUG_FUNCPTR (gst_base_audio_src_get_times); GST_DEBUG_FUNCPTR (gst_audio_base_src_get_times);
gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_base_audio_src_create); gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_audio_base_src_create);
gstbasesrc_class->fixate = GST_DEBUG_FUNCPTR (gst_base_audio_src_fixate); gstbasesrc_class->fixate = GST_DEBUG_FUNCPTR (gst_audio_base_src_fixate);
/* ref class from a thread-safe context to work around missing bit of /* ref class from a thread-safe context to work around missing bit of
* thread-safety in GObject */ * thread-safety in GObject */
@ -234,9 +234,9 @@ gst_base_audio_src_class_init (GstBaseAudioSrcClass * klass)
} }
static void static void
gst_base_audio_src_init (GstBaseAudioSrc * baseaudiosrc) gst_audio_base_src_init (GstAudioBaseSrc * baseaudiosrc)
{ {
baseaudiosrc->priv = GST_BASE_AUDIO_SRC_GET_PRIVATE (baseaudiosrc); baseaudiosrc->priv = GST_AUDIO_BASE_SRC_GET_PRIVATE (baseaudiosrc);
baseaudiosrc->buffer_time = DEFAULT_BUFFER_TIME; baseaudiosrc->buffer_time = DEFAULT_BUFFER_TIME;
baseaudiosrc->latency_time = DEFAULT_LATENCY_TIME; baseaudiosrc->latency_time = DEFAULT_LATENCY_TIME;
@ -247,7 +247,7 @@ gst_base_audio_src_init (GstBaseAudioSrc * baseaudiosrc)
GST_BASE_SRC (baseaudiosrc)->blocksize = 0; GST_BASE_SRC (baseaudiosrc)->blocksize = 0;
baseaudiosrc->clock = gst_audio_clock_new ("GstAudioSrcClock", baseaudiosrc->clock = gst_audio_clock_new ("GstAudioSrcClock",
(GstAudioClockGetTimeFunc) gst_base_audio_src_get_time, baseaudiosrc, (GstAudioClockGetTimeFunc) gst_audio_base_src_get_time, baseaudiosrc,
NULL); NULL);
/* we are always a live source */ /* we are always a live source */
@ -257,11 +257,11 @@ gst_base_audio_src_init (GstBaseAudioSrc * baseaudiosrc)
} }
static void static void
gst_base_audio_src_dispose (GObject * object) gst_audio_base_src_dispose (GObject * object)
{ {
GstBaseAudioSrc *src; GstAudioBaseSrc *src;
src = GST_BASE_AUDIO_SRC (object); src = GST_AUDIO_BASE_SRC (object);
GST_OBJECT_LOCK (src); GST_OBJECT_LOCK (src);
if (src->clock) { if (src->clock) {
@ -280,12 +280,12 @@ gst_base_audio_src_dispose (GObject * object)
} }
static GstClock * static GstClock *
gst_base_audio_src_provide_clock (GstElement * elem) gst_audio_base_src_provide_clock (GstElement * elem)
{ {
GstBaseAudioSrc *src; GstAudioBaseSrc *src;
GstClock *clock; GstClock *clock;
src = GST_BASE_AUDIO_SRC (elem); src = GST_AUDIO_BASE_SRC (elem);
/* we have no ringbuffer (must be NULL state) */ /* we have no ringbuffer (must be NULL state) */
if (src->ringbuffer == NULL) if (src->ringbuffer == NULL)
@ -318,7 +318,7 @@ clock_disabled:
} }
static GstClockTime static GstClockTime
gst_base_audio_src_get_time (GstClock * clock, GstBaseAudioSrc * src) gst_audio_base_src_get_time (GstClock * clock, GstAudioBaseSrc * src)
{ {
guint64 raw, samples; guint64 raw, samples;
guint delay; guint delay;
@ -348,8 +348,8 @@ gst_base_audio_src_get_time (GstClock * clock, GstBaseAudioSrc * src)
} }
/** /**
* gst_base_audio_src_set_provide_clock: * gst_audio_base_src_set_provide_clock:
* @src: a #GstBaseAudioSrc * @src: a #GstAudioBaseSrc
* @provide: new state * @provide: new state
* *
* Controls whether @src will provide a clock or not. If @provide is %TRUE, * Controls whether @src will provide a clock or not. If @provide is %TRUE,
@ -359,9 +359,9 @@ gst_base_audio_src_get_time (GstClock * clock, GstBaseAudioSrc * src)
* Since: 0.10.16 * Since: 0.10.16
*/ */
void void
gst_base_audio_src_set_provide_clock (GstBaseAudioSrc * src, gboolean provide) gst_audio_base_src_set_provide_clock (GstAudioBaseSrc * src, gboolean provide)
{ {
g_return_if_fail (GST_IS_BASE_AUDIO_SRC (src)); g_return_if_fail (GST_IS_AUDIO_BASE_SRC (src));
GST_OBJECT_LOCK (src); GST_OBJECT_LOCK (src);
src->priv->provide_clock = provide; src->priv->provide_clock = provide;
@ -369,22 +369,22 @@ gst_base_audio_src_set_provide_clock (GstBaseAudioSrc * src, gboolean provide)
} }
/** /**
* gst_base_audio_src_get_provide_clock: * gst_audio_base_src_get_provide_clock:
* @src: a #GstBaseAudioSrc * @src: a #GstAudioBaseSrc
* *
* Queries whether @src will provide a clock or not. See also * Queries whether @src will provide a clock or not. See also
* gst_base_audio_src_set_provide_clock. * gst_audio_base_src_set_provide_clock.
* *
* Returns: %TRUE if @src will provide a clock. * Returns: %TRUE if @src will provide a clock.
* *
* Since: 0.10.16 * Since: 0.10.16
*/ */
gboolean gboolean
gst_base_audio_src_get_provide_clock (GstBaseAudioSrc * src) gst_audio_base_src_get_provide_clock (GstAudioBaseSrc * src)
{ {
gboolean result; gboolean result;
g_return_val_if_fail (GST_IS_BASE_AUDIO_SRC (src), FALSE); g_return_val_if_fail (GST_IS_AUDIO_BASE_SRC (src), FALSE);
GST_OBJECT_LOCK (src); GST_OBJECT_LOCK (src);
result = src->priv->provide_clock; result = src->priv->provide_clock;
@ -394,8 +394,8 @@ gst_base_audio_src_get_provide_clock (GstBaseAudioSrc * src)
} }
/** /**
* gst_base_audio_src_set_slave_method: * gst_audio_base_src_set_slave_method:
* @src: a #GstBaseAudioSrc * @src: a #GstAudioBaseSrc
* @method: the new slave method * @method: the new slave method
* *
* Controls how clock slaving will be performed in @src. * Controls how clock slaving will be performed in @src.
@ -403,10 +403,10 @@ gst_base_audio_src_get_provide_clock (GstBaseAudioSrc * src)
* Since: 0.10.20 * Since: 0.10.20
*/ */
void void
gst_base_audio_src_set_slave_method (GstBaseAudioSrc * src, gst_audio_base_src_set_slave_method (GstAudioBaseSrc * src,
GstBaseAudioSrcSlaveMethod method) GstAudioBaseSrcSlaveMethod method)
{ {
g_return_if_fail (GST_IS_BASE_AUDIO_SRC (src)); g_return_if_fail (GST_IS_AUDIO_BASE_SRC (src));
GST_OBJECT_LOCK (src); GST_OBJECT_LOCK (src);
src->priv->slave_method = method; src->priv->slave_method = method;
@ -414,8 +414,8 @@ gst_base_audio_src_set_slave_method (GstBaseAudioSrc * src,
} }
/** /**
* gst_base_audio_src_get_slave_method: * gst_audio_base_src_get_slave_method:
* @src: a #GstBaseAudioSrc * @src: a #GstAudioBaseSrc
* *
* Get the current slave method used by @src. * Get the current slave method used by @src.
* *
@ -423,12 +423,12 @@ gst_base_audio_src_set_slave_method (GstBaseAudioSrc * src,
* *
* Since: 0.10.20 * Since: 0.10.20
*/ */
GstBaseAudioSrcSlaveMethod GstAudioBaseSrcSlaveMethod
gst_base_audio_src_get_slave_method (GstBaseAudioSrc * src) gst_audio_base_src_get_slave_method (GstAudioBaseSrc * src)
{ {
GstBaseAudioSrcSlaveMethod result; GstAudioBaseSrcSlaveMethod result;
g_return_val_if_fail (GST_IS_BASE_AUDIO_SRC (src), -1); g_return_val_if_fail (GST_IS_AUDIO_BASE_SRC (src), -1);
GST_OBJECT_LOCK (src); GST_OBJECT_LOCK (src);
result = src->priv->slave_method; result = src->priv->slave_method;
@ -438,12 +438,12 @@ gst_base_audio_src_get_slave_method (GstBaseAudioSrc * src)
} }
static void static void
gst_base_audio_src_set_property (GObject * object, guint prop_id, gst_audio_base_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec) const GValue * value, GParamSpec * pspec)
{ {
GstBaseAudioSrc *src; GstAudioBaseSrc *src;
src = GST_BASE_AUDIO_SRC (object); src = GST_AUDIO_BASE_SRC (object);
switch (prop_id) { switch (prop_id) {
case PROP_BUFFER_TIME: case PROP_BUFFER_TIME:
@ -453,10 +453,10 @@ gst_base_audio_src_set_property (GObject * object, guint prop_id,
src->latency_time = g_value_get_int64 (value); src->latency_time = g_value_get_int64 (value);
break; break;
case PROP_PROVIDE_CLOCK: case PROP_PROVIDE_CLOCK:
gst_base_audio_src_set_provide_clock (src, g_value_get_boolean (value)); gst_audio_base_src_set_provide_clock (src, g_value_get_boolean (value));
break; break;
case PROP_SLAVE_METHOD: case PROP_SLAVE_METHOD:
gst_base_audio_src_set_slave_method (src, g_value_get_enum (value)); gst_audio_base_src_set_slave_method (src, g_value_get_enum (value));
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -465,12 +465,12 @@ gst_base_audio_src_set_property (GObject * object, guint prop_id,
} }
static void static void
gst_base_audio_src_get_property (GObject * object, guint prop_id, gst_audio_base_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec) GValue * value, GParamSpec * pspec)
{ {
GstBaseAudioSrc *src; GstAudioBaseSrc *src;
src = GST_BASE_AUDIO_SRC (object); src = GST_AUDIO_BASE_SRC (object);
switch (prop_id) { switch (prop_id) {
case PROP_BUFFER_TIME: case PROP_BUFFER_TIME:
@ -496,10 +496,10 @@ gst_base_audio_src_get_property (GObject * object, guint prop_id,
GST_OBJECT_UNLOCK (src); GST_OBJECT_UNLOCK (src);
break; break;
case PROP_PROVIDE_CLOCK: case PROP_PROVIDE_CLOCK:
g_value_set_boolean (value, gst_base_audio_src_get_provide_clock (src)); g_value_set_boolean (value, gst_audio_base_src_get_provide_clock (src));
break; break;
case PROP_SLAVE_METHOD: case PROP_SLAVE_METHOD:
g_value_set_enum (value, gst_base_audio_src_get_slave_method (src)); g_value_set_enum (value, gst_audio_base_src_get_slave_method (src));
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -508,7 +508,7 @@ gst_base_audio_src_get_property (GObject * object, guint prop_id,
} }
static void static void
gst_base_audio_src_fixate (GstBaseSrc * bsrc, GstCaps * caps) gst_audio_base_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
{ {
GstStructure *s; GstStructure *s;
@ -524,9 +524,9 @@ gst_base_audio_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
} }
static gboolean static gboolean
gst_base_audio_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps) gst_audio_base_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
{ {
GstBaseAudioSrc *src = GST_BASE_AUDIO_SRC (bsrc); GstAudioBaseSrc *src = GST_AUDIO_BASE_SRC (bsrc);
GstAudioRingBufferSpec *spec; GstAudioRingBufferSpec *spec;
gint bpf, rate; gint bpf, rate;
@ -587,7 +587,7 @@ acquire_error:
} }
static void static void
gst_base_audio_src_get_times (GstBaseSrc * bsrc, GstBuffer * buffer, gst_audio_base_src_get_times (GstBaseSrc * bsrc, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end) GstClockTime * start, GstClockTime * end)
{ {
/* no need to sync to a clock here, we schedule the samples based /* no need to sync to a clock here, we schedule the samples based
@ -597,9 +597,9 @@ gst_base_audio_src_get_times (GstBaseSrc * bsrc, GstBuffer * buffer,
} }
static gboolean static gboolean
gst_base_audio_src_query (GstBaseSrc * bsrc, GstQuery * query) gst_audio_base_src_query (GstBaseSrc * bsrc, GstQuery * query)
{ {
GstBaseAudioSrc *src = GST_BASE_AUDIO_SRC (bsrc); GstAudioBaseSrc *src = GST_AUDIO_BASE_SRC (bsrc);
gboolean res = FALSE; gboolean res = FALSE;
switch (GST_QUERY_TYPE (query)) { switch (GST_QUERY_TYPE (query)) {
@ -660,9 +660,9 @@ done:
} }
static gboolean static gboolean
gst_base_audio_src_event (GstBaseSrc * bsrc, GstEvent * event) gst_audio_base_src_event (GstBaseSrc * bsrc, GstEvent * event)
{ {
GstBaseAudioSrc *src = GST_BASE_AUDIO_SRC (bsrc); GstAudioBaseSrc *src = GST_AUDIO_BASE_SRC (bsrc);
gboolean res, forward; gboolean res, forward;
res = FALSE; res = FALSE;
@ -698,7 +698,7 @@ gst_base_audio_src_event (GstBaseSrc * bsrc, GstEvent * event)
* If the next sample is too far away, this function will position itself to the * If the next sample is too far away, this function will position itself to the
* next most recent sample, creating discontinuity */ * next most recent sample, creating discontinuity */
static guint64 static guint64
gst_base_audio_src_get_offset (GstBaseAudioSrc * src) gst_audio_base_src_get_offset (GstAudioBaseSrc * src)
{ {
guint64 sample; guint64 sample;
gint readseg, segdone, segtotal, sps; gint readseg, segdone, segtotal, sps;
@ -745,11 +745,11 @@ gst_base_audio_src_get_offset (GstBaseAudioSrc * src)
} }
static GstFlowReturn static GstFlowReturn
gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length, gst_audio_base_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
GstBuffer ** outbuf) GstBuffer ** outbuf)
{ {
GstFlowReturn ret; GstFlowReturn ret;
GstBaseAudioSrc *src = GST_BASE_AUDIO_SRC (bsrc); GstAudioBaseSrc *src = GST_AUDIO_BASE_SRC (bsrc);
GstBuffer *buf; GstBuffer *buf;
guchar *data, *ptr; guchar *data, *ptr;
guint samples, total_samples; guint samples, total_samples;
@ -787,7 +787,7 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
} else { } else {
/* calculate the sequentially next sample we need to read. This can jump and /* calculate the sequentially next sample we need to read. This can jump and
* create a DISCONT. */ * create a DISCONT. */
sample = gst_base_audio_src_get_offset (src); sample = gst_audio_base_src_get_offset (src);
} }
GST_DEBUG_OBJECT (src, "reading from sample %" G_GUINT64_FORMAT " length %u", GST_DEBUG_OBJECT (src, "reading from sample %" G_GUINT64_FORMAT " length %u",
@ -850,11 +850,11 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
if (clock != src->clock) { if (clock != src->clock) {
/* we are slaved, check how to handle this */ /* we are slaved, check how to handle this */
switch (src->priv->slave_method) { switch (src->priv->slave_method) {
case GST_BASE_AUDIO_SRC_SLAVE_RESAMPLE: case GST_AUDIO_BASE_SRC_SLAVE_RESAMPLE:
/* not implemented, use skew algorithm. This algorithm should /* not implemented, use skew algorithm. This algorithm should
* work on the readout pointer and produces more or less samples based * work on the readout pointer and produces more or less samples based
* on the clock drift */ * on the clock drift */
case GST_BASE_AUDIO_SRC_SLAVE_SKEW: case GST_AUDIO_BASE_SRC_SLAVE_SKEW:
{ {
GstClockTime running_time; GstClockTime running_time;
GstClockTime base_time; GstClockTime base_time;
@ -955,7 +955,7 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
} }
break; break;
} }
case GST_BASE_AUDIO_SRC_SLAVE_RETIMESTAMP: case GST_AUDIO_BASE_SRC_SLAVE_RETIMESTAMP:
{ {
GstClockTime base_time, latency; GstClockTime base_time, latency;
@ -977,7 +977,7 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
else else
timestamp = 0; timestamp = 0;
} }
case GST_BASE_AUDIO_SRC_SLAVE_NONE: case GST_AUDIO_BASE_SRC_SLAVE_NONE:
break; break;
} }
} else { } else {
@ -1042,8 +1042,8 @@ stopped:
} }
/** /**
* gst_base_audio_src_create_ringbuffer: * gst_audio_base_src_create_ringbuffer:
* @src: a #GstBaseAudioSrc. * @src: a #GstAudioBaseSrc.
* *
* Create and return the #GstAudioRingBuffer for @src. This function will call the * Create and return the #GstAudioRingBuffer for @src. This function will call the
* ::create_ringbuffer vmethod and will set @src as the parent of the returned * ::create_ringbuffer vmethod and will set @src as the parent of the returned
@ -1052,12 +1052,12 @@ stopped:
* Returns: The new ringbuffer of @src. * Returns: The new ringbuffer of @src.
*/ */
GstAudioRingBuffer * GstAudioRingBuffer *
gst_base_audio_src_create_ringbuffer (GstBaseAudioSrc * src) gst_audio_base_src_create_ringbuffer (GstAudioBaseSrc * src)
{ {
GstBaseAudioSrcClass *bclass; GstAudioBaseSrcClass *bclass;
GstAudioRingBuffer *buffer = NULL; GstAudioRingBuffer *buffer = NULL;
bclass = GST_BASE_AUDIO_SRC_GET_CLASS (src); bclass = GST_AUDIO_BASE_SRC_GET_CLASS (src);
if (bclass->create_ringbuffer) if (bclass->create_ringbuffer)
buffer = bclass->create_ringbuffer (src); buffer = bclass->create_ringbuffer (src);
@ -1068,11 +1068,11 @@ gst_base_audio_src_create_ringbuffer (GstBaseAudioSrc * src)
} }
static GstStateChangeReturn static GstStateChangeReturn
gst_base_audio_src_change_state (GstElement * element, gst_audio_base_src_change_state (GstElement * element,
GstStateChange transition) GstStateChange transition)
{ {
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
GstBaseAudioSrc *src = GST_BASE_AUDIO_SRC (element); GstAudioBaseSrc *src = GST_AUDIO_BASE_SRC (element);
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
@ -1080,7 +1080,7 @@ gst_base_audio_src_change_state (GstElement * element,
GST_OBJECT_LOCK (src); GST_OBJECT_LOCK (src);
if (src->ringbuffer == NULL) { if (src->ringbuffer == NULL) {
gst_audio_clock_reset (GST_AUDIO_CLOCK (src->clock), 0); gst_audio_clock_reset (GST_AUDIO_CLOCK (src->clock), 0);
src->ringbuffer = gst_base_audio_src_create_ringbuffer (src); src->ringbuffer = gst_audio_base_src_create_ringbuffer (src);
} }
GST_OBJECT_UNLOCK (src); GST_OBJECT_UNLOCK (src);
if (!gst_audio_ring_buffer_open_device (src->ringbuffer)) if (!gst_audio_ring_buffer_open_device (src->ringbuffer))
@ -1096,7 +1096,7 @@ gst_base_audio_src_change_state (GstElement * element,
* should post this messages whenever necessary */ * should post this messages whenever necessary */
if (src->clock && GST_IS_AUDIO_CLOCK (src->clock) && if (src->clock && GST_IS_AUDIO_CLOCK (src->clock) &&
GST_AUDIO_CLOCK_CAST (src->clock)->func == GST_AUDIO_CLOCK_CAST (src->clock)->func ==
(GstAudioClockGetTimeFunc) gst_base_audio_src_get_time) (GstAudioClockGetTimeFunc) gst_audio_base_src_get_time)
gst_element_post_message (element, gst_element_post_message (element,
gst_message_new_clock_provide (GST_OBJECT_CAST (element), gst_message_new_clock_provide (GST_OBJECT_CAST (element),
src->clock, TRUE)); src->clock, TRUE));
@ -1117,7 +1117,7 @@ gst_base_audio_src_change_state (GstElement * element,
* should post this messages whenever necessary */ * should post this messages whenever necessary */
if (src->clock && GST_IS_AUDIO_CLOCK (src->clock) && if (src->clock && GST_IS_AUDIO_CLOCK (src->clock) &&
GST_AUDIO_CLOCK_CAST (src->clock)->func == GST_AUDIO_CLOCK_CAST (src->clock)->func ==
(GstAudioClockGetTimeFunc) gst_base_audio_src_get_time) (GstAudioClockGetTimeFunc) gst_audio_base_src_get_time)
gst_element_post_message (element, gst_element_post_message (element,
gst_message_new_clock_lost (GST_OBJECT_CAST (element), src->clock)); gst_message_new_clock_lost (GST_OBJECT_CAST (element), src->clock));
gst_audio_ring_buffer_set_flushing (src->ringbuffer, TRUE); gst_audio_ring_buffer_set_flushing (src->ringbuffer, TRUE);

View file

@ -23,8 +23,8 @@
/* a base class for audio sources. /* a base class for audio sources.
*/ */
#ifndef __GST_BASE_AUDIO_SRC_H__ #ifndef __GST_AUDIO_BASE_SRC_H__
#define __GST_BASE_AUDIO_SRC_H__ #define __GST_AUDIO_BASE_SRC_H__
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/base/gstpushsrc.h> #include <gst/base/gstpushsrc.h>
@ -33,60 +33,60 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define GST_TYPE_BASE_AUDIO_SRC (gst_base_audio_src_get_type()) #define GST_TYPE_AUDIO_BASE_SRC (gst_audio_base_src_get_type())
#define GST_BASE_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_AUDIO_SRC,GstBaseAudioSrc)) #define GST_AUDIO_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_BASE_SRC,GstAudioBaseSrc))
#define GST_BASE_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_AUDIO_SRC,GstBaseAudioSrcClass)) #define GST_AUDIO_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_BASE_SRC,GstAudioBaseSrcClass))
#define GST_BASE_AUDIO_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_AUDIO_SRC, GstBaseAudioSrcClass)) #define GST_AUDIO_BASE_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIO_BASE_SRC, GstAudioBaseSrcClass))
#define GST_IS_BASE_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_AUDIO_SRC)) #define GST_IS_AUDIO_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_BASE_SRC))
#define GST_IS_BASE_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_AUDIO_SRC)) #define GST_IS_AUDIO_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_BASE_SRC))
/** /**
* GST_BASE_AUDIO_SRC_CLOCK: * GST_AUDIO_BASE_SRC_CLOCK:
* @obj: a #GstBaseAudioSrc * @obj: a #GstAudioBaseSrc
* *
* Get the #GstClock of @obj. * Get the #GstClock of @obj.
*/ */
#define GST_BASE_AUDIO_SRC_CLOCK(obj) (GST_BASE_AUDIO_SRC (obj)->clock) #define GST_AUDIO_BASE_SRC_CLOCK(obj) (GST_AUDIO_BASE_SRC (obj)->clock)
/** /**
* GST_BASE_AUDIO_SRC_PAD: * GST_AUDIO_BASE_SRC_PAD:
* @obj: a #GstBaseAudioSrc * @obj: a #GstAudioBaseSrc
* *
* Get the source #GstPad of @obj. * Get the source #GstPad of @obj.
*/ */
#define GST_BASE_AUDIO_SRC_PAD(obj) (GST_BASE_SRC (obj)->srcpad) #define GST_AUDIO_BASE_SRC_PAD(obj) (GST_BASE_SRC (obj)->srcpad)
typedef struct _GstBaseAudioSrc GstBaseAudioSrc; typedef struct _GstAudioBaseSrc GstAudioBaseSrc;
typedef struct _GstBaseAudioSrcClass GstBaseAudioSrcClass; typedef struct _GstAudioBaseSrcClass GstAudioBaseSrcClass;
typedef struct _GstBaseAudioSrcPrivate GstBaseAudioSrcPrivate; typedef struct _GstAudioBaseSrcPrivate GstAudioBaseSrcPrivate;
/** /**
* GstBaseAudioSrcSlaveMethod: * GstAudioBaseSrcSlaveMethod:
* @GST_BASE_AUDIO_SRC_SLAVE_RESAMPLE: Resample to match the master clock. * @GST_AUDIO_BASE_SRC_SLAVE_RESAMPLE: Resample to match the master clock.
* @GST_BASE_AUDIO_SRC_SLAVE_RETIMESTAMP: Retimestamp output buffers with master * @GST_AUDIO_BASE_SRC_SLAVE_RETIMESTAMP: Retimestamp output buffers with master
* clock time. * clock time.
* @GST_BASE_AUDIO_SRC_SLAVE_SKEW: Adjust capture pointer when master clock * @GST_AUDIO_BASE_SRC_SLAVE_SKEW: Adjust capture pointer when master clock
* drifts too much. * drifts too much.
* @GST_BASE_AUDIO_SRC_SLAVE_NONE: No adjustment is done. * @GST_AUDIO_BASE_SRC_SLAVE_NONE: No adjustment is done.
* *
* Different possible clock slaving algorithms when the internal audio clock was * Different possible clock slaving algorithms when the internal audio clock was
* not selected as the pipeline clock. * not selected as the pipeline clock.
*/ */
typedef enum typedef enum
{ {
GST_BASE_AUDIO_SRC_SLAVE_RESAMPLE, GST_AUDIO_BASE_SRC_SLAVE_RESAMPLE,
GST_BASE_AUDIO_SRC_SLAVE_RETIMESTAMP, GST_AUDIO_BASE_SRC_SLAVE_RETIMESTAMP,
GST_BASE_AUDIO_SRC_SLAVE_SKEW, GST_AUDIO_BASE_SRC_SLAVE_SKEW,
GST_BASE_AUDIO_SRC_SLAVE_NONE GST_AUDIO_BASE_SRC_SLAVE_NONE
} GstBaseAudioSrcSlaveMethod; } GstAudioBaseSrcSlaveMethod;
#define GST_TYPE_BASE_AUDIO_SRC_SLAVE_METHOD (gst_base_audio_src_slave_method_get_type ()) #define GST_TYPE_AUDIO_BASE_SRC_SLAVE_METHOD (gst_audio_base_src_slave_method_get_type ())
/** /**
* GstBaseAudioSrc: * GstAudioBaseSrc:
* *
* Opaque #GstBaseAudioSrc. * Opaque #GstAudioBaseSrc.
*/ */
struct _GstBaseAudioSrc { struct _GstAudioBaseSrc {
GstPushSrc element; GstPushSrc element;
/*< protected >*/ /* with LOCK */ /*< protected >*/ /* with LOCK */
@ -104,44 +104,44 @@ struct _GstBaseAudioSrc {
GstClock *clock; GstClock *clock;
/*< private >*/ /*< private >*/
GstBaseAudioSrcPrivate *priv; GstAudioBaseSrcPrivate *priv;
gpointer _gst_reserved[GST_PADDING - 1]; gpointer _gst_reserved[GST_PADDING - 1];
}; };
/** /**
* GstBaseAudioSrcClass: * GstAudioBaseSrcClass:
* @parent_class: the parent class. * @parent_class: the parent class.
* @create_ringbuffer: create and return a #GstAudioRingBuffer to read from. * @create_ringbuffer: create and return a #GstAudioRingBuffer to read from.
* *
* #GstBaseAudioSrc class. Override the vmethod to implement * #GstAudioBaseSrc class. Override the vmethod to implement
* functionality. * functionality.
*/ */
struct _GstBaseAudioSrcClass { struct _GstAudioBaseSrcClass {
GstPushSrcClass parent_class; GstPushSrcClass parent_class;
/* subclass ringbuffer allocation */ /* subclass ringbuffer allocation */
GstAudioRingBuffer* (*create_ringbuffer) (GstBaseAudioSrc *src); GstAudioRingBuffer* (*create_ringbuffer) (GstAudioBaseSrc *src);
/*< private >*/ /*< private >*/
gpointer _gst_reserved[GST_PADDING]; gpointer _gst_reserved[GST_PADDING];
}; };
GType gst_base_audio_src_get_type(void); GType gst_audio_base_src_get_type(void);
GType gst_base_audio_src_slave_method_get_type (void); GType gst_audio_base_src_slave_method_get_type (void);
GstAudioRingBuffer * GstAudioRingBuffer *
gst_base_audio_src_create_ringbuffer (GstBaseAudioSrc *src); gst_audio_base_src_create_ringbuffer (GstAudioBaseSrc *src);
void gst_base_audio_src_set_provide_clock (GstBaseAudioSrc *src, gboolean provide); void gst_audio_base_src_set_provide_clock (GstAudioBaseSrc *src, gboolean provide);
gboolean gst_base_audio_src_get_provide_clock (GstBaseAudioSrc *src); gboolean gst_audio_base_src_get_provide_clock (GstAudioBaseSrc *src);
void gst_base_audio_src_set_slave_method (GstBaseAudioSrc *src, void gst_audio_base_src_set_slave_method (GstAudioBaseSrc *src,
GstBaseAudioSrcSlaveMethod method); GstAudioBaseSrcSlaveMethod method);
GstBaseAudioSrcSlaveMethod GstAudioBaseSrcSlaveMethod
gst_base_audio_src_get_slave_method (GstBaseAudioSrc *src); gst_audio_base_src_get_slave_method (GstAudioBaseSrc *src);
G_END_DECLS G_END_DECLS
#endif /* __GST_BASE_AUDIO_SRC_H__ */ #endif /* __GST_AUDIO_BASE_SRC_H__ */