discoverer: port to new GLib thread API

This commit is contained in:
Tim-Philipp Müller 2012-09-10 01:10:33 +01:00
parent 952f347146
commit c4bd7c2391

View file

@ -79,7 +79,7 @@ struct _GstDiscovererPrivate
/* list of pending URI to process (current excluded) */ /* list of pending URI to process (current excluded) */
GList *pending_uris; GList *pending_uris;
GMutex *lock; GMutex lock;
/* TRUE if processing a URI */ /* TRUE if processing a URI */
gboolean processing; gboolean processing;
@ -124,8 +124,8 @@ struct _GstDiscovererPrivate
gulong bus_cb_id; gulong bus_cb_id;
}; };
#define DISCO_LOCK(dc) g_mutex_lock (dc->priv->lock); #define DISCO_LOCK(dc) g_mutex_lock (&dc->priv->lock);
#define DISCO_UNLOCK(dc) g_mutex_unlock (dc->priv->lock); #define DISCO_UNLOCK(dc) g_mutex_unlock (&dc->priv->lock);
static void static void
_do_init (void) _do_init (void)
@ -176,6 +176,7 @@ static void uridecodebin_source_changed_cb (GstElement * uridecodebin,
GParamSpec * pspec, GstDiscoverer * dc); GParamSpec * pspec, GstDiscoverer * dc);
static void gst_discoverer_dispose (GObject * dc); static void gst_discoverer_dispose (GObject * dc);
static void gst_discoverer_finalize (GObject * dc);
static void gst_discoverer_set_property (GObject * object, guint prop_id, static void gst_discoverer_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
static void gst_discoverer_get_property (GObject * object, guint prop_id, static void gst_discoverer_get_property (GObject * object, guint prop_id,
@ -187,6 +188,7 @@ gst_discoverer_class_init (GstDiscovererClass * klass)
GObjectClass *gobject_class = (GObjectClass *) klass; GObjectClass *gobject_class = (GObjectClass *) klass;
gobject_class->dispose = gst_discoverer_dispose; gobject_class->dispose = gst_discoverer_dispose;
gobject_class->finalize = gst_discoverer_finalize;
gobject_class->set_property = gst_discoverer_set_property; gobject_class->set_property = gst_discoverer_set_property;
gobject_class->get_property = gst_discoverer_get_property; gobject_class->get_property = gst_discoverer_get_property;
@ -297,7 +299,7 @@ gst_discoverer_init (GstDiscoverer * dc)
dc->priv->async = FALSE; dc->priv->async = FALSE;
dc->priv->async_done = FALSE; dc->priv->async_done = FALSE;
dc->priv->lock = g_mutex_new (); g_mutex_init (&dc->priv->lock);
dc->priv->pending_subtitle_pads = 0; dc->priv->pending_subtitle_pads = 0;
@ -395,11 +397,6 @@ gst_discoverer_dispose (GObject * obj)
gst_discoverer_stop (dc); gst_discoverer_stop (dc);
if (dc->priv->lock) {
g_mutex_free (dc->priv->lock);
dc->priv->lock = NULL;
}
if (dc->priv->seeking_query) { if (dc->priv->seeking_query) {
gst_query_unref (dc->priv->seeking_query); gst_query_unref (dc->priv->seeking_query);
dc->priv->seeking_query = NULL; dc->priv->seeking_query = NULL;
@ -408,6 +405,16 @@ gst_discoverer_dispose (GObject * obj)
G_OBJECT_CLASS (gst_discoverer_parent_class)->dispose (obj); G_OBJECT_CLASS (gst_discoverer_parent_class)->dispose (obj);
} }
static void
gst_discoverer_finalize (GObject * obj)
{
GstDiscoverer *dc = (GstDiscoverer *) obj;
g_mutex_clear (&dc->priv->lock);
G_OBJECT_CLASS (gst_discoverer_parent_class)->finalize (obj);
}
static void static void
gst_discoverer_set_property (GObject * object, guint prop_id, gst_discoverer_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec) const GValue * value, GParamSpec * pspec)