videoaggregator: Update for g_type_class_add_private() deprecation in recent GLib

This commit is contained in:
Tim-Philipp Müller 2018-06-24 00:17:26 +02:00
parent 69534fe9a0
commit b342955a64

View file

@ -83,7 +83,7 @@ struct _GstVideoAggregatorPadPrivate
}; };
G_DEFINE_TYPE (GstVideoAggregatorPad, gst_video_aggregator_pad, G_DEFINE_TYPE_WITH_PRIVATE (GstVideoAggregatorPad, gst_video_aggregator_pad,
GST_TYPE_AGGREGATOR_PAD); GST_TYPE_AGGREGATOR_PAD);
static void static void
@ -218,8 +218,6 @@ gst_video_aggregator_pad_class_init (GstVideoAggregatorPadClass * klass)
DEFAULT_PAD_REPEAT_AFTER_EOS, DEFAULT_PAD_REPEAT_AFTER_EOS,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
g_type_class_add_private (klass, sizeof (GstVideoAggregatorPadPrivate));
aggpadclass->flush = GST_DEBUG_FUNCPTR (_flush_pad); aggpadclass->flush = GST_DEBUG_FUNCPTR (_flush_pad);
aggpadclass->skip_buffer = aggpadclass->skip_buffer =
GST_DEBUG_FUNCPTR (gst_video_aggregator_pad_skip_buffer); GST_DEBUG_FUNCPTR (gst_video_aggregator_pad_skip_buffer);
@ -231,9 +229,7 @@ gst_video_aggregator_pad_class_init (GstVideoAggregatorPadClass * klass)
static void static void
gst_video_aggregator_pad_init (GstVideoAggregatorPad * vaggpad) gst_video_aggregator_pad_init (GstVideoAggregatorPad * vaggpad)
{ {
vaggpad->priv = vaggpad->priv = gst_video_aggregator_pad_get_instance_private (vaggpad);
G_TYPE_INSTANCE_GET_PRIVATE (vaggpad, GST_TYPE_VIDEO_AGGREGATOR_PAD,
GstVideoAggregatorPadPrivate);
vaggpad->priv->zorder = DEFAULT_PAD_ZORDER; vaggpad->priv->zorder = DEFAULT_PAD_ZORDER;
vaggpad->priv->repeat_after_eos = DEFAULT_PAD_REPEAT_AFTER_EOS; vaggpad->priv->repeat_after_eos = DEFAULT_PAD_REPEAT_AFTER_EOS;
@ -354,8 +350,8 @@ struct _GstVideoAggregatorConvertPadPrivate
gboolean converter_config_changed; gboolean converter_config_changed;
}; };
G_DEFINE_TYPE (GstVideoAggregatorConvertPad, gst_video_aggregator_convert_pad, G_DEFINE_TYPE_WITH_PRIVATE (GstVideoAggregatorConvertPad,
GST_TYPE_VIDEO_AGGREGATOR_PAD); gst_video_aggregator_convert_pad, GST_TYPE_VIDEO_AGGREGATOR_PAD);
static void static void
gst_video_aggregator_convert_pad_finalize (GObject * o) gst_video_aggregator_convert_pad_finalize (GObject * o)
@ -596,9 +592,6 @@ gst_video_aggregator_convert_pad_class_init (GstVideoAggregatorConvertPadClass *
gobject_class->set_property = gobject_class->set_property =
GST_DEBUG_FUNCPTR (gst_video_aggregator_convert_pad_set_property); GST_DEBUG_FUNCPTR (gst_video_aggregator_convert_pad_set_property);
g_type_class_add_private (klass,
sizeof (GstVideoAggregatorConvertPadPrivate));
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_CONVERT_PAD_CONVERTER_CONFIG, g_param_spec_boxed ("converter-config", PROP_CONVERT_PAD_CONVERTER_CONFIG, g_param_spec_boxed ("converter-config",
"Converter configuration", "Converter configuration",
@ -622,9 +615,7 @@ static void
gst_video_aggregator_convert_pad_init (GstVideoAggregatorConvertPad * vaggpad) gst_video_aggregator_convert_pad_init (GstVideoAggregatorConvertPad * vaggpad)
{ {
vaggpad->priv = vaggpad->priv =
G_TYPE_INSTANCE_GET_PRIVATE (vaggpad, gst_video_aggregator_convert_pad_get_instance_private (vaggpad);
GST_TYPE_VIDEO_AGGREGATOR_CONVERT_PAD,
GstVideoAggregatorConvertPadPrivate);
vaggpad->priv->converted_buffer = NULL; vaggpad->priv->converted_buffer = NULL;
vaggpad->priv->convert = NULL; vaggpad->priv->convert = NULL;
@ -700,6 +691,7 @@ static void gst_video_aggregator_init (GstVideoAggregator * self,
GstVideoAggregatorClass * klass); GstVideoAggregatorClass * klass);
static void gst_video_aggregator_class_init (GstVideoAggregatorClass * klass); static void gst_video_aggregator_class_init (GstVideoAggregatorClass * klass);
static gpointer gst_video_aggregator_parent_class = NULL; static gpointer gst_video_aggregator_parent_class = NULL;
static gint video_aggregator_private_offset = 0;
GType GType
gst_video_aggregator_get_type (void) gst_video_aggregator_get_type (void)
@ -714,11 +706,22 @@ gst_video_aggregator_get_type (void)
sizeof (GstVideoAggregator), sizeof (GstVideoAggregator),
(GInstanceInitFunc) gst_video_aggregator_init, (GInstanceInitFunc) gst_video_aggregator_init,
(GTypeFlags) G_TYPE_FLAG_ABSTRACT); (GTypeFlags) G_TYPE_FLAG_ABSTRACT);
video_aggregator_private_offset =
g_type_add_instance_private (g_define_type_id,
sizeof (GstVideoAggregatorPrivate));
g_once_init_leave (&g_define_type_id_volatile, g_define_type_id); g_once_init_leave (&g_define_type_id_volatile, g_define_type_id);
} }
return g_define_type_id_volatile; return g_define_type_id_volatile;
} }
static inline GstVideoAggregatorPrivate *
gst_video_aggregator_get_instance_private (GstVideoAggregator * self)
{
return (G_STRUCT_MEMBER_P (self, video_aggregator_private_offset));
}
static void static void
gst_video_aggregator_find_best_format (GstVideoAggregator * vagg, gst_video_aggregator_find_best_format (GstVideoAggregator * vagg,
GstCaps * downstream_caps, GstVideoInfo * best_info, GstCaps * downstream_caps, GstVideoInfo * best_info,
@ -2515,7 +2518,9 @@ gst_video_aggregator_class_init (GstVideoAggregatorClass * klass)
gst_video_aggregator_parent_class = g_type_class_peek_parent (klass); gst_video_aggregator_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (GstVideoAggregatorPrivate)); if (video_aggregator_private_offset != 0)
g_type_class_adjust_private_offset (klass,
&video_aggregator_private_offset);
gobject_class->finalize = gst_video_aggregator_finalize; gobject_class->finalize = gst_video_aggregator_finalize;
gobject_class->dispose = gst_video_aggregator_dispose; gobject_class->dispose = gst_video_aggregator_dispose;
@ -2556,9 +2561,7 @@ static void
gst_video_aggregator_init (GstVideoAggregator * vagg, gst_video_aggregator_init (GstVideoAggregator * vagg,
GstVideoAggregatorClass * klass) GstVideoAggregatorClass * klass)
{ {
vagg->priv = vagg->priv = gst_video_aggregator_get_instance_private (vagg);
G_TYPE_INSTANCE_GET_PRIVATE (vagg, GST_TYPE_VIDEO_AGGREGATOR,
GstVideoAggregatorPrivate);
vagg->priv->current_caps = NULL; vagg->priv->current_caps = NULL;