audio: Use G_DEFINE_TYPE instead of GST_BOILERPLATE

This commit is contained in:
Sebastian Dröge 2011-04-19 10:52:00 +02:00
parent 0f1741da23
commit f50b3af5d7
4 changed files with 28 additions and 72 deletions

View file

@ -574,20 +574,15 @@ enum
ARG_0,
};
#define _do_init(bla) \
#define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_audio_sink_debug, "audiosink", 0, "audiosink element");
GST_BOILERPLATE_FULL (GstAudioSink, gst_audio_sink, GstBaseAudioSink,
#define gst_audio_sink_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstAudioSink, gst_audio_sink,
GST_TYPE_BASE_AUDIO_SINK, _do_init);
static GstRingBuffer *gst_audio_sink_create_ringbuffer (GstBaseAudioSink *
sink);
static void
gst_audio_sink_base_init (gpointer g_class)
{
}
static void
gst_audio_sink_class_init (GstAudioSinkClass * klass)
{
@ -602,7 +597,7 @@ gst_audio_sink_class_init (GstAudioSinkClass * klass)
}
static void
gst_audio_sink_init (GstAudioSink * audiosink, GstAudioSinkClass * g_class)
gst_audio_sink_init (GstAudioSink * audiosink)
{
}

View file

@ -488,19 +488,14 @@ enum
ARG_0,
};
#define _do_init(bla) \
#define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_audio_src_debug, "audiosrc", 0, "audiosrc element");
GST_BOILERPLATE_FULL (GstAudioSrc, gst_audio_src, GstBaseAudioSrc,
#define gst_audio_src_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstAudioSrc, gst_audio_src,
GST_TYPE_BASE_AUDIO_SRC, _do_init);
static GstRingBuffer *gst_audio_src_create_ringbuffer (GstBaseAudioSrc * src);
static void
gst_audio_src_base_init (gpointer g_class)
{
}
static void
gst_audio_src_class_init (GstAudioSrcClass * klass)
{
@ -515,7 +510,7 @@ gst_audio_src_class_init (GstAudioSrcClass * klass)
}
static void
gst_audio_src_init (GstAudioSrc * audiosrc, GstAudioSrcClass * g_class)
gst_audio_src_init (GstAudioSrc * audiosrc)
{
}

View file

@ -57,7 +57,6 @@ struct _GstBaseAudioSinkPrivate
GstClockTime eos_time;
gboolean do_time_offset;
/* number of microseconds we alow timestamps or clock slaving to drift
* before resyncing */
guint64 drift_tolerance;
@ -119,10 +118,10 @@ gst_base_audio_sink_slave_method_get_type (void)
}
#define _do_init(bla) \
#define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_base_audio_sink_debug, "baseaudiosink", 0, "baseaudiosink element");
GST_BOILERPLATE_FULL (GstBaseAudioSink, gst_base_audio_sink, GstBaseSink,
#define gst_base_audio_sink_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstBaseAudioSink, gst_base_audio_sink,
GST_TYPE_BASE_SINK, _do_init);
static void gst_base_audio_sink_dispose (GObject * object);
@ -166,11 +165,6 @@ static gboolean gst_base_audio_sink_query_pad (GstPad * pad, GstQuery * query);
/* static guint gst_base_audio_sink_signals[LAST_SIGNAL] = { 0 }; */
static void
gst_base_audio_sink_base_init (gpointer g_class)
{
}
static void
gst_base_audio_sink_class_init (GstBaseAudioSinkClass * klass)
{
@ -257,10 +251,8 @@ gst_base_audio_sink_class_init (GstBaseAudioSinkClass * klass)
}
static void
gst_base_audio_sink_init (GstBaseAudioSink * baseaudiosink,
GstBaseAudioSinkClass * g_class)
gst_base_audio_sink_init (GstBaseAudioSink * baseaudiosink)
{
GstPluginFeature *feature;
GstBaseSink *basesink;
baseaudiosink->priv = GST_BASE_AUDIO_SINK_GET_PRIVATE (baseaudiosink);
@ -283,25 +275,6 @@ gst_base_audio_sink_init (GstBaseAudioSink * baseaudiosink,
/* install some custom pad_query functions */
gst_pad_set_query_function (GST_BASE_SINK_PAD (baseaudiosink),
GST_DEBUG_FUNCPTR (gst_base_audio_sink_query_pad));
baseaudiosink->priv->do_time_offset = TRUE;
/* check the factory, pulsesink < 0.10.17 does the timestamp offset itself so
* we should not do ourselves */
feature =
GST_PLUGIN_FEATURE_CAST (GST_ELEMENT_CLASS (g_class)->elementfactory);
GST_DEBUG ("created from factory %p", feature);
/* HACK for old pulsesink that did the time_offset themselves */
if (feature) {
if (strcmp (gst_plugin_feature_get_name (feature), "pulsesink") == 0) {
if (!gst_plugin_feature_check_version (feature, 0, 10, 17)) {
/* we're dealing with an old pulsesink, we need to disable time corection */
GST_DEBUG ("disable time offset");
baseaudiosink->priv->do_time_offset = FALSE;
}
}
}
}
static void
@ -1585,7 +1558,6 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
GST_TIME_ARGS (render_start), GST_TIME_ARGS (render_stop));
/* bring to position in the ringbuffer */
if (sink->priv->do_time_offset) {
time_offset =
GST_AUDIO_CLOCK_CAST (sink->provided_clock)->abidata.ABI.time_offset;
GST_DEBUG_OBJECT (sink,
@ -1598,7 +1570,6 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
render_stop -= time_offset;
else
render_stop = 0;
}
/* and bring the time to the rate corrected offset in the buffer */
render_start = gst_util_uint64_scale_int (render_start,

View file

@ -119,8 +119,9 @@ _do_init (GType type)
#endif /* ENABLE_NLS */
}
GST_BOILERPLATE_FULL (GstBaseAudioSrc, gst_base_audio_src, GstPushSrc,
GST_TYPE_PUSH_SRC, _do_init);
#define gst_base_audio_src_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstBaseAudioSrc, gst_base_audio_src, GST_TYPE_PUSH_SRC,
_do_init (g_define_type_id));
static void gst_base_audio_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@ -148,11 +149,6 @@ static void gst_base_audio_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
/* static guint gst_base_audio_src_signals[LAST_SIGNAL] = { 0 }; */
static void
gst_base_audio_src_base_init (gpointer g_class)
{
}
static void
gst_base_audio_src_class_init (GstBaseAudioSrcClass * klass)
{
@ -241,8 +237,7 @@ gst_base_audio_src_class_init (GstBaseAudioSrcClass * klass)
}
static void
gst_base_audio_src_init (GstBaseAudioSrc * baseaudiosrc,
GstBaseAudioSrcClass * g_class)
gst_base_audio_src_init (GstBaseAudioSrc * baseaudiosrc)
{
baseaudiosrc->priv = GST_BASE_AUDIO_SRC_GET_PRIVATE (baseaudiosrc);