mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 05:16:05 +00:00
tag: 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
18c457dfb4
commit
92579cb845
2 changed files with 26 additions and 6 deletions
|
@ -167,6 +167,7 @@ static void gst_tag_demux_class_init (gpointer g_class, gpointer d);
|
|||
static void gst_tag_demux_init (GstTagDemux * obj, GstTagDemuxClass * klass);
|
||||
|
||||
static gpointer parent_class; /* NULL */
|
||||
static gint private_offset = 0;
|
||||
|
||||
/* Cannot use boilerplate macros here because we want the abstract flag */
|
||||
GType
|
||||
|
@ -189,11 +190,20 @@ gst_tag_demux_get_type (void)
|
|||
|
||||
object_type = g_type_register_static (GST_TYPE_ELEMENT,
|
||||
"GstTagDemux", &object_info, G_TYPE_FLAG_ABSTRACT);
|
||||
|
||||
private_offset =
|
||||
g_type_add_instance_private (object_type, sizeof (GstTagDemuxPrivate));
|
||||
}
|
||||
|
||||
return object_type;
|
||||
}
|
||||
|
||||
static inline GstTagDemuxPrivate *
|
||||
gst_tag_demux_get_instance_private (GstTagDemux * self)
|
||||
{
|
||||
return (G_STRUCT_MEMBER_P (self, private_offset));
|
||||
}
|
||||
|
||||
static void
|
||||
gst_tag_demux_base_init (gpointer klass)
|
||||
{
|
||||
|
@ -218,7 +228,8 @@ gst_tag_demux_class_init (gpointer klass, gpointer d)
|
|||
|
||||
element_class->change_state = GST_DEBUG_FUNCPTR (gst_tag_demux_change_state);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GstTagDemuxPrivate));
|
||||
if (private_offset != 0)
|
||||
g_type_class_adjust_private_offset (klass, &private_offset);
|
||||
|
||||
/* subclasses must set at least one of these */
|
||||
tagdemux_class->min_start_size = 0;
|
||||
|
@ -267,8 +278,7 @@ gst_tag_demux_init (GstTagDemux * demux, GstTagDemuxClass * gclass)
|
|||
GstElementClass *element_klass = GST_ELEMENT_CLASS (gclass);
|
||||
GstPadTemplate *tmpl;
|
||||
|
||||
demux->priv = g_type_instance_get_private ((GTypeInstance *) demux,
|
||||
GST_TYPE_TAG_DEMUX);
|
||||
demux->priv = gst_tag_demux_get_instance_private (demux);
|
||||
|
||||
/* sink pad */
|
||||
tmpl = gst_element_class_get_pad_template (element_klass, "sink");
|
||||
|
|
|
@ -74,6 +74,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_tag_mux_debug);
|
|||
#define GST_CAT_DEFAULT gst_tag_mux_debug
|
||||
|
||||
static GstElementClass *parent_class;
|
||||
static gint private_offset = 0;
|
||||
|
||||
static void gst_tag_mux_class_init (GstTagMuxClass * klass);
|
||||
static void gst_tag_mux_init (GstTagMux * mux, GstTagMuxClass * mux_class);
|
||||
|
@ -100,6 +101,9 @@ gst_tag_mux_get_type (void)
|
|||
(GClassInitFunc) gst_tag_mux_class_init, sizeof (GstTagMux),
|
||||
(GInstanceInitFunc) gst_tag_mux_init, G_TYPE_FLAG_ABSTRACT);
|
||||
|
||||
private_offset =
|
||||
g_type_add_instance_private (_type, sizeof (GstTagMuxPrivate));
|
||||
|
||||
g_type_add_interface_static (_type, GST_TYPE_TAG_SETTER, &interface_info);
|
||||
|
||||
g_once_init_leave (&tag_mux_type, _type);
|
||||
|
@ -107,6 +111,12 @@ gst_tag_mux_get_type (void)
|
|||
return tag_mux_type;
|
||||
}
|
||||
|
||||
static inline GstTagMuxPrivate *
|
||||
gst_tag_mux_get_instance_private (GstTagMux * self)
|
||||
{
|
||||
return (G_STRUCT_MEMBER_P (self, private_offset));
|
||||
}
|
||||
|
||||
static void
|
||||
gst_tag_mux_finalize (GObject * obj)
|
||||
{
|
||||
|
@ -144,7 +154,8 @@ gst_tag_mux_class_init (GstTagMuxClass * klass)
|
|||
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_tag_mux_finalize);
|
||||
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_tag_mux_change_state);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GstTagMuxPrivate));
|
||||
if (private_offset != 0)
|
||||
g_type_class_adjust_private_offset (klass, &private_offset);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_tag_mux_debug, "tagmux", 0,
|
||||
"tag muxer base class");
|
||||
|
@ -156,8 +167,7 @@ gst_tag_mux_init (GstTagMux * mux, GstTagMuxClass * mux_class)
|
|||
GstElementClass *element_klass = GST_ELEMENT_CLASS (mux_class);
|
||||
GstPadTemplate *tmpl;
|
||||
|
||||
mux->priv =
|
||||
G_TYPE_INSTANCE_GET_PRIVATE (mux, GST_TYPE_TAG_MUX, GstTagMuxPrivate);
|
||||
mux->priv = gst_tag_mux_get_instance_private (mux);
|
||||
|
||||
/* pad through which data comes in to the element */
|
||||
tmpl = gst_element_class_get_pad_template (element_klass, "sink");
|
||||
|
|
Loading…
Reference in a new issue