/*****************************************
* GstAudioAggregatorPad implementation *
*****************************************/
-G_DEFINE_TYPE (GstAudioAggregatorPad, gst_audio_aggregator_pad,
+G_DEFINE_TYPE_WITH_PRIVATE (GstAudioAggregatorPad, gst_audio_aggregator_pad,
GST_TYPE_AGGREGATOR_PAD);
enum
GObjectClass *gobject_class = (GObjectClass *) klass;
GstAggregatorPadClass *aggpadclass = (GstAggregatorPadClass *) klass;
- g_type_class_add_private (klass, sizeof (GstAudioAggregatorPadPrivate));
-
gobject_class->finalize = gst_audio_aggregator_pad_finalize;
aggpadclass->flush = GST_DEBUG_FUNCPTR (gst_audio_aggregator_pad_flush_pad);
}
static void
gst_audio_aggregator_pad_init (GstAudioAggregatorPad * pad)
{
- pad->priv =
- G_TYPE_INSTANCE_GET_PRIVATE (pad, GST_TYPE_AUDIO_AGGREGATOR_PAD,
- GstAudioAggregatorPadPrivate);
+ pad->priv = gst_audio_aggregator_pad_get_instance_private (pad);
gst_audio_info_init (&pad->info);
};
-G_DEFINE_TYPE (GstAudioAggregatorConvertPad, gst_audio_aggregator_convert_pad,
- GST_TYPE_AUDIO_AGGREGATOR_PAD);
+G_DEFINE_TYPE_WITH_PRIVATE (GstAudioAggregatorConvertPad,
+ gst_audio_aggregator_convert_pad, GST_TYPE_AUDIO_AGGREGATOR_PAD);
static void
gst_audio_aggregator_convert_pad_update_converter (GstAudioAggregatorConvertPad
GObjectClass *gobject_class = (GObjectClass *) klass;
GstAudioAggregatorPadClass *aaggpad_class =
(GstAudioAggregatorPadClass *) klass;
- g_type_class_add_private (klass,
- sizeof (GstAudioAggregatorConvertPadPrivate));
gobject_class->set_property = gst_audio_aggregator_convert_pad_set_property;
gobject_class->get_property = gst_audio_aggregator_convert_pad_get_property;
static void
gst_audio_aggregator_convert_pad_init (GstAudioAggregatorConvertPad * pad)
{
- pad->priv =
- G_TYPE_INSTANCE_GET_PRIVATE (pad, GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD,
- GstAudioAggregatorConvertPadPrivate);
+ pad->priv = gst_audio_aggregator_convert_pad_get_instance_private (pad);
}
/**************************************
PROP_DISCONT_WAIT,
};
-G_DEFINE_ABSTRACT_TYPE (GstAudioAggregator, gst_audio_aggregator,
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GstAudioAggregator, gst_audio_aggregator,
GST_TYPE_AGGREGATOR);
static GstBuffer *
GObjectClass *gobject_class = (GObjectClass *) klass;
GstAggregatorClass *gstaggregator_class = (GstAggregatorClass *) klass;
- g_type_class_add_private (klass, sizeof (GstAudioAggregatorPrivate));
-
gobject_class->set_property = gst_audio_aggregator_set_property;
gobject_class->get_property = gst_audio_aggregator_get_property;
gobject_class->dispose = gst_audio_aggregator_dispose;
static void
gst_audio_aggregator_init (GstAudioAggregator * aagg)
{
- aagg->priv =
- G_TYPE_INSTANCE_GET_PRIVATE (aagg, GST_TYPE_AUDIO_AGGREGATOR,
- GstAudioAggregatorPrivate);
+ aagg->priv = gst_audio_aggregator_get_instance_private (aagg);
g_mutex_init (&aagg->priv->mutex);
GST_DEBUG_CATEGORY_STATIC (gst_audio_base_sink_debug);
#define GST_CAT_DEFAULT gst_audio_base_sink_debug
-#define GST_AUDIO_BASE_SINK_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_AUDIO_BASE_SINK, GstAudioBaseSinkPrivate))
-
struct _GstAudioBaseSinkPrivate
{
/* upstream latency */
GST_DEBUG_CATEGORY_INIT (gst_audio_base_sink_debug, "audiobasesink", 0, "audiobasesink element");
#define gst_audio_base_sink_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstAudioBaseSink, gst_audio_base_sink,
- GST_TYPE_BASE_SINK, _do_init);
+ GST_TYPE_BASE_SINK, G_ADD_PRIVATE (GstAudioBaseSink) _do_init);
static void gst_audio_base_sink_dispose (GObject * object);
gstelement_class = (GstElementClass *) klass;
gstbasesink_class = (GstBaseSinkClass *) klass;
- g_type_class_add_private (klass, sizeof (GstAudioBaseSinkPrivate));
-
gobject_class->set_property = gst_audio_base_sink_set_property;
gobject_class->get_property = gst_audio_base_sink_get_property;
gobject_class->dispose = gst_audio_base_sink_dispose;
static void
gst_audio_base_sink_init (GstAudioBaseSink * audiobasesink)
{
- GstBaseSink *basesink;
+ GstBaseSink *basesink = GST_BASE_SINK_CAST (audiobasesink);
- audiobasesink->priv = GST_AUDIO_BASE_SINK_GET_PRIVATE (audiobasesink);
+ audiobasesink->priv =
+ gst_audio_base_sink_get_instance_private (audiobasesink);
audiobasesink->buffer_time = DEFAULT_BUFFER_TIME;
audiobasesink->latency_time = DEFAULT_LATENCY_TIME;
(GstAudioClockGetTimeFunc) gst_audio_base_sink_get_time, audiobasesink,
NULL);
- basesink = GST_BASE_SINK_CAST (audiobasesink);
basesink->can_activate_push = TRUE;
basesink->can_activate_pull = DEFAULT_CAN_ACTIVATE_PULL;
GST_DEBUG_CATEGORY_STATIC (gst_audio_base_src_debug);
#define GST_CAT_DEFAULT gst_audio_base_src_debug
-#define GST_AUDIO_BASE_SRC_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_AUDIO_BASE_SRC, GstAudioBaseSrcPrivate))
-
struct _GstAudioBaseSrcPrivate
{
/* the clock slaving algorithm in use */
#define gst_audio_base_src_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstAudioBaseSrc, gst_audio_base_src, GST_TYPE_PUSH_SRC,
+ G_ADD_PRIVATE (GstAudioBaseSrc)
_do_init (g_define_type_id));
static void gst_audio_base_src_set_property (GObject * object, guint prop_id,
gstelement_class = (GstElementClass *) klass;
gstbasesrc_class = (GstBaseSrcClass *) klass;
- g_type_class_add_private (klass, sizeof (GstAudioBaseSrcPrivate));
-
gobject_class->set_property = gst_audio_base_src_set_property;
gobject_class->get_property = gst_audio_base_src_get_property;
gobject_class->dispose = gst_audio_base_src_dispose;
static void
gst_audio_base_src_init (GstAudioBaseSrc * audiobasesrc)
{
- audiobasesrc->priv = GST_AUDIO_BASE_SRC_GET_PRIVATE (audiobasesrc);
+ audiobasesrc->priv = gst_audio_base_src_get_instance_private (audiobasesrc);
audiobasesrc->buffer_time = DEFAULT_BUFFER_TIME;
audiobasesrc->latency_time = DEFAULT_LATENCY_TIME;
#define gst_audio_cd_src_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstAudioCdSrc, gst_audio_cd_src, GST_TYPE_PUSH_SRC,
+ G_ADD_PRIVATE (GstAudioCdSrc)
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
gst_audio_cd_src_uri_handler_init));
GST_DEBUG_CATEGORY_INIT (gst_audio_cd_src_debug, "audiocdsrc", 0,
"Audio CD source base class");
- g_type_class_add_private (klass, sizeof (GstAudioCdSrcPrivate));
-
/* our very own formats */
track_format = gst_format_register ("track", "CD track");
sector_format = gst_format_register ("sector", "CD sector");
static void
gst_audio_cd_src_init (GstAudioCdSrc * src)
{
- src->priv =
- G_TYPE_INSTANCE_GET_PRIVATE (src, GST_TYPE_AUDIO_CD_SRC,
- GstAudioCdSrcPrivate);
+ src->priv = gst_audio_cd_src_get_instance_private (src);
/* we're not live and we operate in time */
gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
GST_DEBUG_CATEGORY (audiodecoder_debug);
#define GST_CAT_DEFAULT audiodecoder_debug
-#define GST_AUDIO_DECODER_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_AUDIO_DECODER, \
- GstAudioDecoderPrivate))
-
enum
{
LAST_SIGNAL
decoder, GstBuffer * outbuf, GstMeta * meta, GstBuffer * inbuf);
static GstElementClass *parent_class = NULL;
+static gint private_offset = 0;
static void gst_audio_decoder_class_init (GstAudioDecoderClass * klass);
static void gst_audio_decoder_init (GstAudioDecoder * dec,
_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstAudioDecoder", &audio_decoder_info, G_TYPE_FLAG_ABSTRACT);
+
+ private_offset =
+ g_type_add_instance_private (_type, sizeof (GstAudioDecoderPrivate));
+
g_once_init_leave (&audio_decoder_type, _type);
}
return audio_decoder_type;
}
+static inline GstAudioDecoderPrivate *
+gst_audio_decoder_get_instance_private (GstAudioDecoder * self)
+{
+ return (G_STRUCT_MEMBER_P (self, private_offset));
+}
static void
gst_audio_decoder_class_init (GstAudioDecoderClass * klass)
parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private (klass, sizeof (GstAudioDecoderPrivate));
+ if (private_offset != 0)
+ g_type_class_adjust_private_offset (klass, &private_offset);
GST_DEBUG_CATEGORY_INIT (audiodecoder_debug, "audiodecoder", 0,
"audio decoder base class");
GST_DEBUG_OBJECT (dec, "gst_audio_decoder_init");
- dec->priv = GST_AUDIO_DECODER_GET_PRIVATE (dec);
+ dec->priv = gst_audio_decoder_get_instance_private (dec);
/* Setup sink pad */
pad_template =
GST_DEBUG_CATEGORY_STATIC (gst_audio_encoder_debug);
#define GST_CAT_DEFAULT gst_audio_encoder_debug
-#define GST_AUDIO_ENCODER_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_AUDIO_ENCODER, \
- GstAudioEncoderPrivate))
-
enum
{
PROP_0,
static GstElementClass *parent_class = NULL;
+static gint private_offset = 0;
static void gst_audio_encoder_class_init (GstAudioEncoderClass * klass);
static void gst_audio_encoder_init (GstAudioEncoder * parse,
audio_encoder_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstAudioEncoder", &audio_encoder_info, G_TYPE_FLAG_ABSTRACT);
+ private_offset =
+ g_type_add_instance_private (audio_encoder_type,
+ sizeof (GstAudioEncoderPrivate));
+
g_type_add_interface_static (audio_encoder_type, GST_TYPE_PRESET,
&preset_interface_info);
}
return audio_encoder_type;
}
+static inline GstAudioEncoderPrivate *
+gst_audio_encoder_get_instance_private (GstAudioEncoder * self)
+{
+ return (G_STRUCT_MEMBER_P (self, private_offset));
+}
+
static void gst_audio_encoder_finalize (GObject * object);
static void gst_audio_encoder_reset (GstAudioEncoder * enc, gboolean full);
GST_DEBUG_CATEGORY_INIT (gst_audio_encoder_debug, "audioencoder", 0,
"audio encoder base class");
- g_type_class_add_private (klass, sizeof (GstAudioEncoderPrivate));
+ if (private_offset != 0)
+ g_type_class_adjust_private_offset (klass, &private_offset);
gobject_class->set_property = gst_audio_encoder_set_property;
gobject_class->get_property = gst_audio_encoder_get_property;
GST_DEBUG_OBJECT (enc, "gst_audio_encoder_init");
- enc->priv = GST_AUDIO_ENCODER_GET_PRIVATE (enc);
+ enc->priv = gst_audio_encoder_get_instance_private (enc);
/* only push mode supported */
pad_template =