mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
pbutils: 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
92579cb845
commit
511a8d7ddd
2 changed files with 16 additions and 10 deletions
|
@ -60,6 +60,7 @@ enum
|
|||
};
|
||||
|
||||
static GstBaseTransformClass *parent_class = NULL;
|
||||
static gint private_offset = 0;
|
||||
|
||||
static void gst_audio_visualizer_class_init (GstAudioVisualizerClass * klass);
|
||||
static void gst_audio_visualizer_init (GstAudioVisualizer * scope,
|
||||
|
@ -96,9 +97,6 @@ static gboolean gst_audio_visualizer_do_bufferpool (GstAudioVisualizer * scope,
|
|||
static gboolean
|
||||
default_decide_allocation (GstAudioVisualizer * scope, GstQuery * query);
|
||||
|
||||
#define GST_AUDIO_VISUALIZER_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_AUDIO_VISUALIZER, GstAudioVisualizerPrivate))
|
||||
|
||||
struct _GstAudioVisualizerPrivate
|
||||
{
|
||||
gboolean negotiated;
|
||||
|
@ -520,18 +518,29 @@ gst_audio_visualizer_get_type (void)
|
|||
/* TODO: rename when exporting it as a library */
|
||||
_type = g_type_register_static (GST_TYPE_ELEMENT,
|
||||
"GstAudioVisualizer", &audio_visualizer_info, G_TYPE_FLAG_ABSTRACT);
|
||||
|
||||
private_offset =
|
||||
g_type_add_instance_private (_type, sizeof (GstAudioVisualizerPrivate));
|
||||
|
||||
g_once_init_leave (&audio_visualizer_type, _type);
|
||||
}
|
||||
return (GType) audio_visualizer_type;
|
||||
}
|
||||
|
||||
static inline GstAudioVisualizerPrivate *
|
||||
gst_audio_visualizer_get_instance_private (GstAudioVisualizer * self)
|
||||
{
|
||||
return (G_STRUCT_MEMBER_P (self, private_offset));
|
||||
}
|
||||
|
||||
static void
|
||||
gst_audio_visualizer_class_init (GstAudioVisualizerClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||
GstElementClass *element_class = (GstElementClass *) klass;
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GstAudioVisualizerPrivate));
|
||||
if (private_offset != 0)
|
||||
g_type_class_adjust_private_offset (klass, &private_offset);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
|
@ -566,7 +575,7 @@ gst_audio_visualizer_init (GstAudioVisualizer * scope,
|
|||
{
|
||||
GstPadTemplate *pad_template;
|
||||
|
||||
scope->priv = GST_AUDIO_VISUALIZER_GET_PRIVATE (scope);
|
||||
scope->priv = gst_audio_visualizer_get_instance_private (scope);
|
||||
|
||||
/* create the sink and src pads */
|
||||
pad_template =
|
||||
|
|
|
@ -158,7 +158,7 @@ _do_init (void)
|
|||
};
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (GstDiscoverer, gst_discoverer, G_TYPE_OBJECT, 0,
|
||||
_do_init ());
|
||||
G_ADD_PRIVATE (GstDiscoverer) _do_init ());
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -212,8 +212,6 @@ gst_discoverer_class_init (GstDiscovererClass * klass)
|
|||
gobject_class->set_property = gst_discoverer_set_property;
|
||||
gobject_class->get_property = gst_discoverer_get_property;
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GstDiscovererPrivate));
|
||||
|
||||
/* properties */
|
||||
/**
|
||||
* GstDiscoverer:timeout:
|
||||
|
@ -312,8 +310,7 @@ gst_discoverer_init (GstDiscoverer * dc)
|
|||
GstElement *tmp;
|
||||
GstFormat format = GST_FORMAT_TIME;
|
||||
|
||||
dc->priv = G_TYPE_INSTANCE_GET_PRIVATE (dc, GST_TYPE_DISCOVERER,
|
||||
GstDiscovererPrivate);
|
||||
dc->priv = gst_discoverer_get_instance_private (dc);
|
||||
|
||||
dc->priv->timeout = DEFAULT_PROP_TIMEOUT;
|
||||
dc->priv->async = FALSE;
|
||||
|
|
Loading…
Reference in a new issue