mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
audio: Update for g_type_class_add_private() deprecation in recent GLib
https://gitlab.gnome.org/GNOME/glib/merge_requests/7
This commit is contained in:
parent
7b98593280
commit
fae8c24590
6 changed files with 42 additions and 51 deletions
|
@ -106,7 +106,7 @@ struct _GstAudioAggregatorPadPrivate
|
|||
/*****************************************
|
||||
* 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
|
||||
|
@ -136,8 +136,6 @@ gst_audio_aggregator_pad_class_init (GstAudioAggregatorPadClass * klass)
|
|||
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);
|
||||
}
|
||||
|
@ -145,9 +143,7 @@ gst_audio_aggregator_pad_class_init (GstAudioAggregatorPadClass * klass)
|
|||
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);
|
||||
|
||||
|
@ -187,8 +183,8 @@ struct _GstAudioAggregatorConvertPadPrivate
|
|||
};
|
||||
|
||||
|
||||
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
|
||||
|
@ -337,8 +333,6 @@ gst_audio_aggregator_convert_pad_class_init (GstAudioAggregatorConvertPadClass *
|
|||
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;
|
||||
|
@ -361,9 +355,7 @@ gst_audio_aggregator_convert_pad_class_init (GstAudioAggregatorConvertPadClass *
|
|||
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);
|
||||
}
|
||||
|
||||
/**************************************
|
||||
|
@ -441,7 +433,7 @@ enum
|
|||
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 *
|
||||
|
@ -462,8 +454,6 @@ gst_audio_aggregator_class_init (GstAudioAggregatorClass * klass)
|
|||
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;
|
||||
|
@ -516,9 +506,7 @@ gst_audio_aggregator_class_init (GstAudioAggregatorClass * klass)
|
|||
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);
|
||||
|
||||
|
|
|
@ -39,9 +39,6 @@
|
|||
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 */
|
||||
|
@ -125,7 +122,7 @@ enum
|
|||
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);
|
||||
|
||||
|
@ -180,8 +177,6 @@ gst_audio_base_sink_class_init (GstAudioBaseSinkClass * klass)
|
|||
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;
|
||||
|
@ -278,9 +273,10 @@ gst_audio_base_sink_class_init (GstAudioBaseSinkClass * klass)
|
|||
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;
|
||||
|
@ -296,7 +292,6 @@ gst_audio_base_sink_init (GstAudioBaseSink * audiobasesink)
|
|||
(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;
|
||||
|
||||
|
|
|
@ -45,9 +45,6 @@
|
|||
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 */
|
||||
|
@ -97,6 +94,7 @@ _do_init (GType type)
|
|||
|
||||
#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,
|
||||
|
@ -136,8 +134,6 @@ gst_audio_base_src_class_init (GstAudioBaseSrcClass * klass)
|
|||
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;
|
||||
|
@ -217,7 +213,7 @@ gst_audio_base_src_class_init (GstAudioBaseSrcClass * klass)
|
|||
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;
|
||||
|
|
|
@ -179,6 +179,7 @@ static GstIndex *gst_audio_cd_src_get_index (GstElement * src);
|
|||
|
||||
#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));
|
||||
|
||||
|
@ -216,8 +217,6 @@ gst_audio_cd_src_class_init (GstAudioCdSrcClass * klass)
|
|||
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");
|
||||
|
@ -285,9 +284,7 @@ gst_audio_cd_src_class_init (GstAudioCdSrcClass * klass)
|
|||
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);
|
||||
|
|
|
@ -129,10 +129,6 @@
|
|||
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
|
||||
|
@ -312,6 +308,7 @@ static gboolean gst_audio_decoder_transform_meta_default (GstAudioDecoder *
|
|||
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,
|
||||
|
@ -338,11 +335,20 @@ gst_audio_decoder_get_type (void)
|
|||
|
||||
_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)
|
||||
|
@ -357,7 +363,8 @@ 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");
|
||||
|
@ -412,7 +419,7 @@ gst_audio_decoder_init (GstAudioDecoder * dec, GstAudioDecoderClass * klass)
|
|||
|
||||
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 =
|
||||
|
|
|
@ -137,10 +137,6 @@
|
|||
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,
|
||||
|
@ -247,6 +243,7 @@ struct _GstAudioEncoderPrivate
|
|||
|
||||
|
||||
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,
|
||||
|
@ -278,12 +275,22 @@ gst_audio_encoder_get_type (void)
|
|||
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);
|
||||
|
||||
|
@ -345,7 +352,8 @@ gst_audio_encoder_class_init (GstAudioEncoderClass * klass)
|
|||
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;
|
||||
|
@ -392,7 +400,7 @@ gst_audio_encoder_init (GstAudioEncoder * enc, GstAudioEncoderClass * bclass)
|
|||
|
||||
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 =
|
||||
|
|
Loading…
Reference in a new issue