libs: 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 fc4f861d48
commit 86c1a7b4ad
4 changed files with 22 additions and 24 deletions

View file

@ -126,10 +126,6 @@ that the demux object and its streams are not changed by anybody else.
GST_DEBUG_CATEGORY (adaptivedemux_debug);
#define GST_CAT_DEFAULT adaptivedemux_debug
#define GST_ADAPTIVE_DEMUX_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_ADAPTIVE_DEMUX, \
GstAdaptiveDemuxPrivate))
#define MAX_DOWNLOAD_ERROR_COUNT 3
#define DEFAULT_FAILED_COUNT 3
#define DEFAULT_CONNECTION_SPEED 0
@ -222,6 +218,8 @@ typedef struct _GstAdaptiveDemuxTimer
} GstAdaptiveDemuxTimer;
static GstBinClass *parent_class = NULL;
static gint private_offset = 0;
static void gst_adaptive_demux_class_init (GstAdaptiveDemuxClass * klass);
static void gst_adaptive_demux_init (GstAdaptiveDemux * dec,
GstAdaptiveDemuxClass * klass);
@ -331,11 +329,21 @@ gst_adaptive_demux_get_type (void)
_type = g_type_register_static (GST_TYPE_BIN,
"GstAdaptiveDemux", &info, G_TYPE_FLAG_ABSTRACT);
private_offset =
g_type_add_instance_private (_type, sizeof (GstAdaptiveDemuxPrivate));
g_once_init_leave (&type, _type);
}
return type;
}
static inline GstAdaptiveDemuxPrivate *
gst_adaptive_demux_get_instance_private (GstAdaptiveDemux * self)
{
return (G_STRUCT_MEMBER_P (self, private_offset));
}
static void
gst_adaptive_demux_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
@ -401,7 +409,9 @@ gst_adaptive_demux_class_init (GstAdaptiveDemuxClass * klass)
"Base Adaptive Demux");
parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (GstAdaptiveDemuxPrivate));
if (private_offset != 0)
g_type_class_adjust_private_offset (klass, &private_offset);
gobject_class->set_property = gst_adaptive_demux_set_property;
gobject_class->get_property = gst_adaptive_demux_get_property;
@ -443,7 +453,7 @@ gst_adaptive_demux_init (GstAdaptiveDemux * demux,
GST_DEBUG_OBJECT (demux, "gst_adaptive_demux_init");
demux->priv = GST_ADAPTIVE_DEMUX_GET_PRIVATE (demux);
demux->priv = gst_adaptive_demux_get_instance_private (demux);
demux->priv->input_adapter = gst_adapter_new ();
demux->downloader = gst_uri_downloader_new ();
gst_uri_downloader_set_parent (demux->downloader, GST_ELEMENT_CAST (demux));

View file

@ -120,7 +120,7 @@ static void gst_insert_bin_do_change (GstInsertBin * self, GstPad * pad);
static GstPadProbeReturn pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info,
gpointer user_data);
G_DEFINE_TYPE (GstInsertBin, gst_insert_bin, GST_TYPE_BIN);
G_DEFINE_TYPE_WITH_PRIVATE (GstInsertBin, gst_insert_bin, GST_TYPE_BIN);
static void
gst_insert_bin_class_init (GstInsertBinClass * klass)
@ -130,8 +130,6 @@ gst_insert_bin_class_init (GstInsertBinClass * klass)
GST_DEBUG_CATEGORY_INIT (insert_bin_debug, "insertbin", 0, "Insert Bin");
g_type_class_add_private (klass, sizeof (GstInsertBinPrivate));
gst_element_class_add_static_pad_template (gstelement_class,
&gst_insert_bin_src_template);
gst_element_class_add_static_pad_template (gstelement_class,
@ -273,8 +271,7 @@ gst_insert_bin_init (GstInsertBin * self)
{
GstProxyPad *internal;
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GST_TYPE_INSERT_BIN,
GstInsertBinPrivate);
self->priv = gst_insert_bin_get_instance_private (self);
g_queue_init (&self->priv->change_queue);

View file

@ -27,8 +27,6 @@
#define GST_CAT_DEFAULT uridownloader_debug
#define GST_FRAGMENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_FRAGMENT, GstFragmentPrivate))
enum
{
PROP_0,
@ -48,7 +46,7 @@ struct _GstFragmentPrivate
GMutex lock;
};
G_DEFINE_TYPE (GstFragment, gst_fragment, G_TYPE_OBJECT);
G_DEFINE_TYPE_WITH_PRIVATE (GstFragment, gst_fragment, G_TYPE_OBJECT);
static void gst_fragment_dispose (GObject * object);
static void gst_fragment_finalize (GObject * object);
@ -116,8 +114,6 @@ gst_fragment_class_init (GstFragmentClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GstFragmentPrivate));
gobject_class->set_property = gst_fragment_set_property;
gobject_class->get_property = gst_fragment_get_property;
gobject_class->dispose = gst_fragment_dispose;
@ -156,7 +152,7 @@ gst_fragment_init (GstFragment * fragment)
{
GstFragmentPrivate *priv;
fragment->priv = priv = GST_FRAGMENT_GET_PRIVATE (fragment);
fragment->priv = priv = gst_fragment_get_instance_private (fragment);
g_mutex_init (&fragment->priv->lock);
priv->buffer = NULL;

View file

@ -27,10 +27,6 @@
#define GST_CAT_DEFAULT uridownloader_debug
GST_DEBUG_CATEGORY (uridownloader_debug);
#define GST_URI_DOWNLOADER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
GST_TYPE_URI_DOWNLOADER, GstUriDownloaderPrivate))
struct _GstUriDownloaderPrivate
{
/* Fragments fetcher */
@ -75,6 +71,7 @@ static GstStaticPadTemplate sinkpadtemplate = GST_STATIC_PAD_TEMPLATE ("sink",
}
G_DEFINE_TYPE_WITH_CODE (GstUriDownloader, gst_uri_downloader, GST_TYPE_OBJECT,
G_ADD_PRIVATE (GstUriDownloader)
_do_init);
static void
@ -84,8 +81,6 @@ gst_uri_downloader_class_init (GstUriDownloaderClass * klass)
gobject_class = (GObjectClass *) klass;
g_type_class_add_private (klass, sizeof (GstUriDownloaderPrivate));
gobject_class->dispose = gst_uri_downloader_dispose;
gobject_class->finalize = gst_uri_downloader_finalize;
}
@ -93,7 +88,7 @@ gst_uri_downloader_class_init (GstUriDownloaderClass * klass)
static void
gst_uri_downloader_init (GstUriDownloader * downloader)
{
downloader->priv = GST_URI_DOWNLOADER_GET_PRIVATE (downloader);
downloader->priv = gst_uri_downloader_get_instance_private (downloader);
/* Initialize the sink pad. This pad will be connected to the src pad of the
* element created with gst_element_make_from_uri and will handle the download */