Commit 6b12cee5 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller

encoding: port to new GLib threading API

parent fa0464cd
......@@ -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 *
......
......@@ -41,7 +41,7 @@ struct _GstStreamCombiner {
* * the current pad
* * the list of srcpads
*/
GMutex *lock;
GMutex lock;
/* Currently activated srcpad */
GstPad *current;
GList *sinkpads;
......
......@@ -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 *
......
......@@ -41,7 +41,7 @@ struct _GstStreamSplitter {
* * the current pad
* * the list of srcpads
*/
GMutex *lock;
GMutex lock;
/* Currently activated srcpad */
GstPad *current;
GList *srcpads;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment