summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2012-01-18 17:21:36 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2012-01-18 17:21:36 +0000
commit6b12cee5a8654cc0ae66aa07c061cba3964c3a93 (patch)
treead424caebb94561427d78a72ab4bf2ce50bc3eba
parentfa0464cd7aaca65b94095d34c30fb250d4182e64 (diff)
encoding: port to new GLib threading API
-rw-r--r--gst/encoding/gststreamcombiner.c19
-rw-r--r--gst/encoding/gststreamcombiner.h2
-rw-r--r--gst/encoding/gststreamsplitter.c23
-rw-r--r--gst/encoding/gststreamsplitter.h2
4 files changed, 25 insertions, 21 deletions
diff --git a/gst/encoding/gststreamcombiner.c b/gst/encoding/gststreamcombiner.c
index 19a6adfb5..d49e08376 100644
--- a/gst/encoding/gststreamcombiner.c
+++ b/gst/encoding/gststreamcombiner.c
@@ -38,10 +38,10 @@ GST_DEBUG_CATEGORY_STATIC (gst_stream_combiner_debug);
G_DEFINE_TYPE (GstStreamCombiner, gst_stream_combiner, GST_TYPE_ELEMENT);
-#define STREAMS_LOCK(obj) (g_mutex_lock(obj->lock))
-#define STREAMS_UNLOCK(obj) (g_mutex_unlock(obj->lock))
+#define STREAMS_LOCK(obj) (g_mutex_lock(&obj->lock))
+#define STREAMS_UNLOCK(obj) (g_mutex_unlock(&obj->lock))
-static void gst_stream_combiner_dispose (GObject * object);
+static void gst_stream_combiner_finalize (GObject * object);
static GstPad *gst_stream_combiner_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * name, const GstCaps * caps);
@@ -57,7 +57,7 @@ gst_stream_combiner_class_init (GstStreamCombinerClass * klass)
gobject_klass = (GObjectClass *) klass;
gstelement_klass = (GstElementClass *) klass;
- gobject_klass->dispose = gst_stream_combiner_dispose;
+ gobject_klass->finalize = gst_stream_combiner_finalize;
GST_DEBUG_CATEGORY_INIT (gst_stream_combiner_debug, "streamcombiner", 0,
"Stream Combiner");
@@ -79,16 +79,13 @@ gst_stream_combiner_class_init (GstStreamCombinerClass * klass)
}
static void
-gst_stream_combiner_dispose (GObject * object)
+gst_stream_combiner_finalize (GObject * object)
{
GstStreamCombiner *stream_combiner = (GstStreamCombiner *) object;
- if (stream_combiner->lock) {
- g_mutex_free (stream_combiner->lock);
- stream_combiner->lock = NULL;
- }
+ g_mutex_clear (&stream_combiner->lock);
- G_OBJECT_CLASS (gst_stream_combiner_parent_class)->dispose (object);
+ G_OBJECT_CLASS (gst_stream_combiner_parent_class)->finalize (object);
}
static GstFlowReturn
@@ -199,7 +196,7 @@ gst_stream_combiner_init (GstStreamCombiner * stream_combiner)
gst_stream_combiner_src_query);
gst_element_add_pad (GST_ELEMENT (stream_combiner), stream_combiner->srcpad);
- stream_combiner->lock = g_mutex_new ();
+ g_mutex_init (&stream_combiner->lock);
}
static GstPad *
diff --git a/gst/encoding/gststreamcombiner.h b/gst/encoding/gststreamcombiner.h
index ce67277d7..246d935ab 100644
--- a/gst/encoding/gststreamcombiner.h
+++ b/gst/encoding/gststreamcombiner.h
@@ -41,7 +41,7 @@ struct _GstStreamCombiner {
* * the current pad
* * the list of srcpads
*/
- GMutex *lock;
+ GMutex lock;
/* Currently activated srcpad */
GstPad *current;
GList *sinkpads;
diff --git a/gst/encoding/gststreamsplitter.c b/gst/encoding/gststreamsplitter.c
index d37f15e21..3f58b04ef 100644
--- a/gst/encoding/gststreamsplitter.c
+++ b/gst/encoding/gststreamsplitter.c
@@ -38,10 +38,11 @@ GST_DEBUG_CATEGORY_STATIC (gst_stream_splitter_debug);
G_DEFINE_TYPE (GstStreamSplitter, gst_stream_splitter, GST_TYPE_ELEMENT);
-#define STREAMS_LOCK(obj) (g_mutex_lock(obj->lock))
-#define STREAMS_UNLOCK(obj) (g_mutex_unlock(obj->lock))
+#define STREAMS_LOCK(obj) (g_mutex_lock(&obj->lock))
+#define STREAMS_UNLOCK(obj) (g_mutex_unlock(&obj->lock))
static void gst_stream_splitter_dispose (GObject * object);
+static void gst_stream_splitter_finalize (GObject * object);
static gboolean gst_stream_splitter_sink_setcaps (GstPad * pad, GstCaps * caps);
@@ -60,6 +61,7 @@ gst_stream_splitter_class_init (GstStreamSplitterClass * klass)
gstelement_klass = (GstElementClass *) klass;
gobject_klass->dispose = gst_stream_splitter_dispose;
+ gobject_klass->finalize = gst_stream_splitter_finalize;
GST_DEBUG_CATEGORY_INIT (gst_stream_splitter_debug, "streamsplitter", 0,
"Stream Splitter");
@@ -85,11 +87,6 @@ gst_stream_splitter_dispose (GObject * object)
{
GstStreamSplitter *stream_splitter = (GstStreamSplitter *) object;
- if (stream_splitter->lock) {
- g_mutex_free (stream_splitter->lock);
- stream_splitter->lock = NULL;
- }
-
g_list_foreach (stream_splitter->pending_events, (GFunc) gst_event_unref,
NULL);
g_list_free (stream_splitter->pending_events);
@@ -98,6 +95,16 @@ gst_stream_splitter_dispose (GObject * object)
G_OBJECT_CLASS (gst_stream_splitter_parent_class)->dispose (object);
}
+static void
+gst_stream_splitter_finalize (GObject * object)
+{
+ GstStreamSplitter *stream_splitter = (GstStreamSplitter *) object;
+
+ g_mutex_clear (&stream_splitter->lock);
+
+ G_OBJECT_CLASS (gst_stream_splitter_parent_class)->finalize (object);
+}
+
static GstFlowReturn
gst_stream_splitter_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
{
@@ -416,7 +423,7 @@ gst_stream_splitter_init (GstStreamSplitter * stream_splitter)
gst_stream_splitter_sink_query);
gst_element_add_pad (GST_ELEMENT (stream_splitter), stream_splitter->sinkpad);
- stream_splitter->lock = g_mutex_new ();
+ g_mutex_init (&stream_splitter->lock);
}
static GstPad *
diff --git a/gst/encoding/gststreamsplitter.h b/gst/encoding/gststreamsplitter.h
index b503c00fc..8fa1dea3c 100644
--- a/gst/encoding/gststreamsplitter.h
+++ b/gst/encoding/gststreamsplitter.h
@@ -41,7 +41,7 @@ struct _GstStreamSplitter {
* * the current pad
* * the list of srcpads
*/
- GMutex *lock;
+ GMutex lock;
/* Currently activated srcpad */
GstPad *current;
GList *srcpads;