From acde0579f8a51c903c5cc0cecc11eb29a681ae0b Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Sun, 9 Sep 2012 20:34:35 -0300 Subject: [PATCH] app: port to the new GLib thread API --- gst-libs/gst/app/gstappsink.c | 132 +++++++++++++++++++++--------------------- gst-libs/gst/app/gstappsrc.c | 121 +++++++++++++++++++------------------- 2 files changed, 127 insertions(+), 126 deletions(-) diff --git a/gst-libs/gst/app/gstappsink.c b/gst-libs/gst/app/gstappsink.c index 5270b51..791c3f0 100644 --- a/gst-libs/gst/app/gstappsink.c +++ b/gst-libs/gst/app/gstappsink.c @@ -82,8 +82,8 @@ struct _GstAppSinkPrivate guint max_buffers; gboolean drop; - GCond *cond; - GMutex *mutex; + GCond cond; + GMutex mutex; GQueue *queue; GstBuffer *preroll; GstCaps *preroll_caps; @@ -351,8 +351,8 @@ gst_app_sink_init (GstAppSink * appsink) G_TYPE_INSTANCE_GET_PRIVATE (appsink, GST_TYPE_APP_SINK, GstAppSinkPrivate); - priv->mutex = g_mutex_new (); - priv->cond = g_cond_new (); + g_mutex_init (&priv->mutex); + g_cond_init (&priv->cond); priv->queue = g_queue_new (); priv->emit_signals = DEFAULT_PROP_EMIT_SIGNALS; @@ -380,13 +380,13 @@ gst_app_sink_dispose (GObject * obj) GST_OBJECT_UNLOCK (appsink); - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); while ((queue_obj = g_queue_pop_head (priv->queue))) gst_mini_object_unref (queue_obj); gst_buffer_replace (&priv->preroll, NULL); gst_caps_replace (&priv->preroll_caps, NULL); gst_caps_replace (&priv->last_caps, NULL); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); G_OBJECT_CLASS (parent_class)->dispose (obj); } @@ -397,8 +397,8 @@ gst_app_sink_finalize (GObject * obj) GstAppSink *appsink = GST_APP_SINK_CAST (obj); GstAppSinkPrivate *priv = appsink->priv; - g_mutex_free (priv->mutex); - g_cond_free (priv->cond); + g_mutex_clear (&priv->mutex); + g_cond_clear (&priv->cond); g_queue_free (priv->queue); G_OBJECT_CLASS (parent_class)->finalize (obj); @@ -470,11 +470,11 @@ gst_app_sink_unlock_start (GstBaseSink * bsink) GstAppSink *appsink = GST_APP_SINK_CAST (bsink); GstAppSinkPrivate *priv = appsink->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); GST_DEBUG_OBJECT (appsink, "unlock start"); priv->unlock = TRUE; - g_cond_signal (priv->cond); - g_mutex_unlock (priv->mutex); + g_cond_signal (&priv->cond); + g_mutex_unlock (&priv->mutex); return TRUE; } @@ -485,11 +485,11 @@ gst_app_sink_unlock_stop (GstBaseSink * bsink) GstAppSink *appsink = GST_APP_SINK_CAST (bsink); GstAppSinkPrivate *priv = appsink->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); GST_DEBUG_OBJECT (appsink, "unlock stop"); priv->unlock = FALSE; - g_cond_signal (priv->cond); - g_mutex_unlock (priv->mutex); + g_cond_signal (&priv->cond); + g_mutex_unlock (&priv->mutex); return TRUE; } @@ -506,7 +506,7 @@ gst_app_sink_flush_unlocked (GstAppSink * appsink) while ((obj = g_queue_pop_head (priv->queue))) gst_mini_object_unref (obj); priv->num_buffers = 0; - g_cond_signal (priv->cond); + g_cond_signal (&priv->cond); } static gboolean @@ -515,12 +515,12 @@ gst_app_sink_start (GstBaseSink * psink) GstAppSink *appsink = GST_APP_SINK_CAST (psink); GstAppSinkPrivate *priv = appsink->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); GST_DEBUG_OBJECT (appsink, "starting"); priv->flushing = FALSE; priv->started = TRUE; gst_segment_init (&priv->last_segment, GST_FORMAT_TIME); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return TRUE; } @@ -531,14 +531,14 @@ gst_app_sink_stop (GstBaseSink * psink) GstAppSink *appsink = GST_APP_SINK_CAST (psink); GstAppSinkPrivate *priv = appsink->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); GST_DEBUG_OBJECT (appsink, "stopping"); priv->flushing = TRUE; priv->started = FALSE; gst_app_sink_flush_unlocked (appsink); gst_caps_replace (&priv->preroll_caps, NULL); gst_caps_replace (&priv->last_caps, NULL); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return TRUE; } @@ -549,11 +549,11 @@ gst_app_sink_setcaps (GstBaseSink * sink, GstCaps * caps) GstAppSink *appsink = GST_APP_SINK_CAST (sink); GstAppSinkPrivate *priv = appsink->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); GST_DEBUG_OBJECT (appsink, "receiving CAPS"); g_queue_push_tail (priv->queue, gst_event_new_caps (caps)); gst_caps_replace (&priv->preroll_caps, caps); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return TRUE; } @@ -566,17 +566,17 @@ gst_app_sink_event (GstBaseSink * sink, GstEvent * event) switch (event->type) { case GST_EVENT_SEGMENT: - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); GST_DEBUG_OBJECT (appsink, "receiving SEGMENT"); g_queue_push_tail (priv->queue, gst_event_ref (event)); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); break; case GST_EVENT_EOS: - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); GST_DEBUG_OBJECT (appsink, "receiving EOS"); priv->is_eos = TRUE; - g_cond_signal (priv->cond); - g_mutex_unlock (priv->mutex); + g_cond_signal (&priv->cond); + g_mutex_unlock (&priv->mutex); /* emit EOS now */ if (priv->callbacks.eos) @@ -591,10 +591,10 @@ gst_app_sink_event (GstBaseSink * sink, GstEvent * event) GST_DEBUG_OBJECT (appsink, "received FLUSH_START"); break; case GST_EVENT_FLUSH_STOP: - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); GST_DEBUG_OBJECT (appsink, "received FLUSH_STOP"); gst_app_sink_flush_unlocked (appsink); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); break; default: break; @@ -610,16 +610,16 @@ gst_app_sink_preroll (GstBaseSink * psink, GstBuffer * buffer) GstAppSinkPrivate *priv = appsink->priv; gboolean emit; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); if (priv->flushing) goto flushing; GST_DEBUG_OBJECT (appsink, "setting preroll buffer %p", buffer); gst_buffer_replace (&priv->preroll, buffer); - g_cond_signal (priv->cond); + g_cond_signal (&priv->cond); emit = priv->emit_signals; - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); if (priv->callbacks.new_preroll) res = priv->callbacks.new_preroll (appsink, priv->user_data); @@ -631,7 +631,7 @@ gst_app_sink_preroll (GstBaseSink * psink, GstBuffer * buffer) flushing: { GST_DEBUG_OBJECT (appsink, "we are flushing"); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return GST_FLOW_FLUSHING; } } @@ -689,7 +689,7 @@ gst_app_sink_render (GstBaseSink * psink, GstBuffer * buffer) gboolean emit; restart: - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); if (priv->flushing) goto flushing; @@ -720,7 +720,7 @@ restart: if (priv->unlock) { /* we are asked to unlock, call the wait_preroll method */ - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); if ((ret = gst_base_sink_wait_preroll (psink)) != GST_FLOW_OK) goto stopping; @@ -729,7 +729,7 @@ restart: } /* wait for a buffer to be removed or flush */ - g_cond_wait (priv->cond, priv->mutex); + g_cond_wait (&priv->cond, &priv->mutex); if (priv->flushing) goto flushing; } @@ -737,9 +737,9 @@ restart: /* we need to ref the buffer when pushing it in the queue */ g_queue_push_tail (priv->queue, gst_buffer_ref (buffer)); priv->num_buffers++; - g_cond_signal (priv->cond); + g_cond_signal (&priv->cond); emit = priv->emit_signals; - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); if (priv->callbacks.new_sample) priv->callbacks.new_sample (appsink, priv->user_data); @@ -751,7 +751,7 @@ restart: flushing: { GST_DEBUG_OBJECT (appsink, "we are flushing"); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return GST_FLOW_FLUSHING; } stopping: @@ -889,7 +889,7 @@ gst_app_sink_is_eos (GstAppSink * appsink) priv = appsink->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); if (!priv->started) goto not_started; @@ -900,14 +900,14 @@ gst_app_sink_is_eos (GstAppSink * appsink) GST_DEBUG_OBJECT (appsink, "we are not yet EOS"); ret = FALSE; } - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return ret; not_started: { GST_DEBUG_OBJECT (appsink, "we are stopped, return TRUE"); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return TRUE; } } @@ -930,9 +930,9 @@ gst_app_sink_set_emit_signals (GstAppSink * appsink, gboolean emit) priv = appsink->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); priv->emit_signals = emit; - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); } /** @@ -954,9 +954,9 @@ gst_app_sink_get_emit_signals (GstAppSink * appsink) priv = appsink->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); result = priv->emit_signals; - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return result; } @@ -979,13 +979,13 @@ gst_app_sink_set_max_buffers (GstAppSink * appsink, guint max) priv = appsink->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); if (max != priv->max_buffers) { priv->max_buffers = max; /* signal the change */ - g_cond_signal (priv->cond); + g_cond_signal (&priv->cond); } - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); } /** @@ -1006,9 +1006,9 @@ gst_app_sink_get_max_buffers (GstAppSink * appsink) priv = appsink->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); result = priv->max_buffers; - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return result; } @@ -1030,13 +1030,13 @@ gst_app_sink_set_drop (GstAppSink * appsink, gboolean drop) priv = appsink->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); if (priv->drop != drop) { priv->drop = drop; /* signal the change */ - g_cond_signal (priv->cond); + g_cond_signal (&priv->cond); } - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); } /** @@ -1059,9 +1059,9 @@ gst_app_sink_get_drop (GstAppSink * appsink) priv = appsink->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); result = priv->drop; - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return result; } @@ -1099,7 +1099,7 @@ gst_app_sink_pull_preroll (GstAppSink * appsink) priv = appsink->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); while (TRUE) { GST_DEBUG_OBJECT (appsink, "trying to grab a buffer"); @@ -1114,13 +1114,13 @@ gst_app_sink_pull_preroll (GstAppSink * appsink) /* nothing to return, wait */ GST_DEBUG_OBJECT (appsink, "waiting for the preroll buffer"); - g_cond_wait (priv->cond, priv->mutex); + g_cond_wait (&priv->cond, &priv->mutex); } sample = gst_sample_new (priv->preroll, priv->preroll_caps, &priv->last_segment, NULL); GST_DEBUG_OBJECT (appsink, "we have the preroll sample %p", sample); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return sample; @@ -1128,13 +1128,13 @@ gst_app_sink_pull_preroll (GstAppSink * appsink) eos: { GST_DEBUG_OBJECT (appsink, "we are EOS, return NULL"); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return NULL; } not_started: { GST_DEBUG_OBJECT (appsink, "we are stopped, return NULL"); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return NULL; } } @@ -1169,7 +1169,7 @@ gst_app_sink_pull_sample (GstAppSink * appsink) priv = appsink->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); while (TRUE) { GST_DEBUG_OBJECT (appsink, "trying to grab a buffer"); @@ -1184,15 +1184,15 @@ gst_app_sink_pull_sample (GstAppSink * appsink) /* nothing to return, wait */ GST_DEBUG_OBJECT (appsink, "waiting for a buffer"); - g_cond_wait (priv->cond, priv->mutex); + g_cond_wait (&priv->cond, &priv->mutex); } buffer = dequeue_buffer (appsink); GST_DEBUG_OBJECT (appsink, "we have a buffer %p", buffer); sample = gst_sample_new (buffer, priv->last_caps, &priv->last_segment, NULL); gst_buffer_unref (buffer); - g_cond_signal (priv->cond); - g_mutex_unlock (priv->mutex); + g_cond_signal (&priv->cond); + g_mutex_unlock (&priv->mutex); return sample; @@ -1200,13 +1200,13 @@ gst_app_sink_pull_sample (GstAppSink * appsink) eos: { GST_DEBUG_OBJECT (appsink, "we are EOS, return NULL"); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return NULL; } not_started: { GST_DEBUG_OBJECT (appsink, "we are stopped, return NULL"); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return NULL; } } diff --git a/gst-libs/gst/app/gstappsrc.c b/gst-libs/gst/app/gstappsrc.c index d096a23..4772d99 100644 --- a/gst-libs/gst/app/gstappsrc.c +++ b/gst-libs/gst/app/gstappsrc.c @@ -102,8 +102,8 @@ struct _GstAppSrcPrivate { - GCond *cond; - GMutex *mutex; + GCond cond; + GMutex mutex; GQueue *queue; GstCaps *caps; @@ -492,8 +492,8 @@ gst_app_src_init (GstAppSrc * appsrc) priv = appsrc->priv = G_TYPE_INSTANCE_GET_PRIVATE (appsrc, GST_TYPE_APP_SRC, GstAppSrcPrivate); - priv->mutex = g_mutex_new (); - priv->cond = g_cond_new (); + g_mutex_init (&priv->mutex); + g_cond_init (&priv->cond); priv->queue = g_queue_new (); priv->size = DEFAULT_PROP_SIZE; @@ -541,8 +541,9 @@ gst_app_src_finalize (GObject * obj) GstAppSrc *appsrc = GST_APP_SRC_CAST (obj); GstAppSrcPrivate *priv = appsrc->priv; - g_mutex_free (priv->mutex); - g_cond_free (priv->cond); + g_mutex_clear (&priv->mutex); + g_cond_clear (&priv->cond); + g_cond_clear (&priv->cond); g_queue_free (priv->queue); g_free (priv->uri); @@ -689,11 +690,11 @@ gst_app_src_unlock (GstBaseSrc * bsrc) GstAppSrc *appsrc = GST_APP_SRC_CAST (bsrc); GstAppSrcPrivate *priv = appsrc->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); GST_DEBUG_OBJECT (appsrc, "unlock start"); priv->flushing = TRUE; - g_cond_broadcast (priv->cond); - g_mutex_unlock (priv->mutex); + g_cond_broadcast (&priv->cond); + g_mutex_unlock (&priv->mutex); return TRUE; } @@ -704,11 +705,11 @@ gst_app_src_unlock_stop (GstBaseSrc * bsrc) GstAppSrc *appsrc = GST_APP_SRC_CAST (bsrc); GstAppSrcPrivate *priv = appsrc->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); GST_DEBUG_OBJECT (appsrc, "unlock stop"); priv->flushing = FALSE; - g_cond_broadcast (priv->cond); - g_mutex_unlock (priv->mutex); + g_cond_broadcast (&priv->cond); + g_mutex_unlock (&priv->mutex); return TRUE; } @@ -719,7 +720,7 @@ gst_app_src_start (GstBaseSrc * bsrc) GstAppSrc *appsrc = GST_APP_SRC_CAST (bsrc); GstAppSrcPrivate *priv = appsrc->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); GST_DEBUG_OBJECT (appsrc, "starting"); priv->new_caps = FALSE; priv->started = TRUE; @@ -727,7 +728,7 @@ gst_app_src_start (GstBaseSrc * bsrc) * in random-access mode. */ priv->offset = -1; priv->flushing = FALSE; - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); gst_base_src_set_format (bsrc, priv->format); @@ -740,13 +741,13 @@ gst_app_src_stop (GstBaseSrc * bsrc) GstAppSrc *appsrc = GST_APP_SRC_CAST (bsrc); GstAppSrcPrivate *priv = appsrc->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); GST_DEBUG_OBJECT (appsrc, "stopping"); priv->is_eos = FALSE; priv->flushing = TRUE; priv->started = FALSE; gst_app_src_flush_queued (appsrc); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return TRUE; } @@ -796,12 +797,12 @@ gst_app_src_query (GstBaseSrc * src, GstQuery * query) res = gst_base_src_query_latency (src, &live, &min, &max); /* overwrite with our values when we need to */ - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); if (priv->min_latency != -1) min = priv->min_latency; if (priv->max_latency != -1) max = priv->max_latency; - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); gst_query_set_latency (query, live, min, max); break; @@ -853,9 +854,9 @@ gst_app_src_do_seek (GstBaseSrc * src, GstSegment * segment) else { gboolean emit; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); emit = priv->emit_signals; - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); if (emit) g_signal_emit (appsrc, gst_app_src_signals[SIGNAL_SEEK_DATA], 0, @@ -882,7 +883,7 @@ gst_app_src_emit_seek (GstAppSrc * appsrc, guint64 offset) GstAppSrcPrivate *priv = appsrc->priv; emit = priv->emit_signals; - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); GST_DEBUG_OBJECT (appsrc, "we are at %" G_GINT64_FORMAT ", seek to %" G_GINT64_FORMAT, @@ -894,7 +895,7 @@ gst_app_src_emit_seek (GstAppSrc * appsrc, guint64 offset) g_signal_emit (appsrc, gst_app_src_signals[SIGNAL_SEEK_DATA], 0, offset, &res); - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); return res; } @@ -908,7 +909,7 @@ gst_app_src_emit_need_data (GstAppSrc * appsrc, guint size) GstAppSrcPrivate *priv = appsrc->priv; emit = priv->emit_signals; - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); /* we have no data, we need some. We fire the signal with the size hint. */ if (priv->callbacks.need_data) @@ -917,7 +918,7 @@ gst_app_src_emit_need_data (GstAppSrc * appsrc, guint size) g_signal_emit (appsrc, gst_app_src_signals[SIGNAL_NEED_DATA], 0, size, NULL); - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); /* we can be flushing now because we released the lock */ } @@ -950,10 +951,10 @@ gst_app_src_negotiate (GstBaseSrc * basesrc) GstAppSrcPrivate *priv = appsrc->priv; gboolean result; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); result = gst_app_src_do_negotiate (basesrc); priv->new_caps = FALSE; - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return result; } @@ -980,7 +981,7 @@ gst_app_src_create (GstBaseSrc * bsrc, guint64 offset, guint size, GST_OBJECT_UNLOCK (appsrc); } - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); /* check flushing first */ if (G_UNLIKELY (priv->flushing)) goto flushing; @@ -1024,7 +1025,7 @@ gst_app_src_create (GstBaseSrc * bsrc, guint64 offset, guint size, priv->offset += buf_size; /* signal that we removed an item */ - g_cond_broadcast (priv->cond); + g_cond_broadcast (&priv->cond); /* see if we go lower than the empty-percent */ if (priv->min_percent && priv->max_bytes) { @@ -1058,27 +1059,27 @@ gst_app_src_create (GstBaseSrc * bsrc, guint64 offset, guint size, goto eos; /* nothing to return, wait a while for new data or flushing. */ - g_cond_wait (priv->cond, priv->mutex); + g_cond_wait (&priv->cond, &priv->mutex); } - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return ret; /* ERRORS */ flushing: { GST_DEBUG_OBJECT (appsrc, "we are flushing"); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return GST_FLOW_FLUSHING; } eos: { GST_DEBUG_OBJECT (appsrc, "we are EOS"); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return GST_FLOW_EOS; } seek_error: { - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); GST_ELEMENT_ERROR (appsrc, RESOURCE, READ, ("failed to seek"), GST_ERROR_SYSTEM); return GST_FLOW_ERROR; @@ -1116,9 +1117,9 @@ gst_app_src_set_caps (GstAppSrc * appsrc, const GstCaps * caps) priv->caps = NULL; if (old) gst_caps_unref (old); - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); priv->new_caps = TRUE; - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); } GST_OBJECT_UNLOCK (appsrc); } @@ -1259,14 +1260,14 @@ gst_app_src_set_max_bytes (GstAppSrc * appsrc, guint64 max) priv = appsrc->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); if (max != priv->max_bytes) { GST_DEBUG_OBJECT (appsrc, "setting max-bytes to %" G_GUINT64_FORMAT, max); priv->max_bytes = max; /* signal the change */ - g_cond_broadcast (priv->cond); + g_cond_broadcast (&priv->cond); } - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); } /** @@ -1287,10 +1288,10 @@ gst_app_src_get_max_bytes (GstAppSrc * appsrc) priv = appsrc->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); result = priv->max_bytes; GST_DEBUG_OBJECT (appsrc, "getting max-bytes of %" G_GUINT64_FORMAT, result); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return result; } @@ -1302,7 +1303,7 @@ gst_app_src_set_latencies (GstAppSrc * appsrc, gboolean do_min, guint64 min, GstAppSrcPrivate *priv = appsrc->priv; gboolean changed = FALSE; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); if (do_min && priv->min_latency != min) { priv->min_latency = min; changed = TRUE; @@ -1311,7 +1312,7 @@ gst_app_src_set_latencies (GstAppSrc * appsrc, gboolean do_min, guint64 min, priv->max_latency = max; changed = TRUE; } - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); if (changed) { GST_DEBUG_OBJECT (appsrc, "posting latency changed"); @@ -1352,12 +1353,12 @@ gst_app_src_get_latency (GstAppSrc * appsrc, guint64 * min, guint64 * max) priv = appsrc->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); if (min) *min = priv->min_latency; if (max) *max = priv->max_latency; - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); } /** @@ -1378,9 +1379,9 @@ gst_app_src_set_emit_signals (GstAppSrc * appsrc, gboolean emit) priv = appsrc->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); priv->emit_signals = emit; - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); } /** @@ -1402,9 +1403,9 @@ gst_app_src_get_emit_signals (GstAppSrc * appsrc) priv = appsrc->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); result = priv->emit_signals; - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return result; } @@ -1421,7 +1422,7 @@ gst_app_src_push_buffer_full (GstAppSrc * appsrc, GstBuffer * buffer, priv = appsrc->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); while (TRUE) { /* can't accept buffers when we are flushing or EOS */ @@ -1441,7 +1442,7 @@ gst_app_src_push_buffer_full (GstAppSrc * appsrc, GstBuffer * buffer, emit = priv->emit_signals; /* only signal on the first push */ - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); if (priv->callbacks.enough_data) priv->callbacks.enough_data (appsrc, priv->user_data); @@ -1449,7 +1450,7 @@ gst_app_src_push_buffer_full (GstAppSrc * appsrc, GstBuffer * buffer, g_signal_emit (appsrc, gst_app_src_signals[SIGNAL_ENOUGH_DATA], 0, NULL); - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); /* continue to check for flushing/eos after releasing the lock */ first = FALSE; continue; @@ -1458,7 +1459,7 @@ gst_app_src_push_buffer_full (GstAppSrc * appsrc, GstBuffer * buffer, GST_DEBUG_OBJECT (appsrc, "waiting for free space"); /* we are filled, wait until a buffer gets popped or when we * flush. */ - g_cond_wait (priv->cond, priv->mutex); + g_cond_wait (&priv->cond, &priv->mutex); } else { /* no need to wait for free space, we just pump more data into the * queue hoping that the caller reacts to the enough-data signal and @@ -1474,8 +1475,8 @@ gst_app_src_push_buffer_full (GstAppSrc * appsrc, GstBuffer * buffer, gst_buffer_ref (buffer); g_queue_push_tail (priv->queue, buffer); priv->queued_bytes += gst_buffer_get_size (buffer); - g_cond_broadcast (priv->cond); - g_mutex_unlock (priv->mutex); + g_cond_broadcast (&priv->cond); + g_mutex_unlock (&priv->mutex); return GST_FLOW_OK; @@ -1485,7 +1486,7 @@ flushing: GST_DEBUG_OBJECT (appsrc, "refuse buffer %p, we are flushing", buffer); if (steal_ref) gst_buffer_unref (buffer); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return GST_FLOW_FLUSHING; } eos: @@ -1493,7 +1494,7 @@ eos: GST_DEBUG_OBJECT (appsrc, "refuse buffer %p, we are EOS", buffer); if (steal_ref) gst_buffer_unref (buffer); - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); return GST_FLOW_EOS; } } @@ -1546,7 +1547,7 @@ gst_app_src_end_of_stream (GstAppSrc * appsrc) priv = appsrc->priv; - g_mutex_lock (priv->mutex); + g_mutex_lock (&priv->mutex); /* can't accept buffers when we are flushing. We can accept them when we are * EOS although it will not do anything. */ if (priv->flushing) @@ -1554,15 +1555,15 @@ gst_app_src_end_of_stream (GstAppSrc * appsrc) GST_DEBUG_OBJECT (appsrc, "sending EOS"); priv->is_eos = TRUE; - g_cond_broadcast (priv->cond); - g_mutex_unlock (priv->mutex); + g_cond_broadcast (&priv->cond); + g_mutex_unlock (&priv->mutex); return GST_FLOW_OK; /* ERRORS */ flushing: { - g_mutex_unlock (priv->mutex); + g_mutex_unlock (&priv->mutex); GST_DEBUG_OBJECT (appsrc, "refuse EOS, we are flushing"); return GST_FLOW_FLUSHING; } -- 2.7.4