diff options
author | Edward Hervey <edward.hervey@collabora.co.uk> | 2012-07-12 12:02:59 +0200 |
---|---|---|
committer | Edward Hervey <edward.hervey@collabora.co.uk> | 2012-07-12 16:17:53 +0200 |
commit | 9d5e10e86bbdd8c0c78b26af008785a5b03dae9c (patch) | |
tree | 780955f5e598557d0e917aeeaff4ff18e8ebe389 | |
parent | e02d8c7a3a140fb9f607ed14f8f233843b09d757 (diff) |
gst: Use new g_mutex API
-rw-r--r-- | clutter-gst/clutter-gst-auto-video-sink.c | 9 | ||||
-rw-r--r-- | clutter-gst/clutter-gst-auto-video-sink.h | 6 | ||||
-rw-r--r-- | clutter-gst/clutter-gst-video-sink.c | 28 |
3 files changed, 19 insertions, 24 deletions
diff --git a/clutter-gst/clutter-gst-auto-video-sink.c b/clutter-gst/clutter-gst-auto-video-sink.c index 83a6410..0b49a10 100644 --- a/clutter-gst/clutter-gst-auto-video-sink.c +++ b/clutter-gst/clutter-gst-auto-video-sink.c @@ -661,11 +661,7 @@ clutter_gst_auto_video_sink_finalize (GObject *object) _sinks_destroy (bin); - if (bin->lock) - { - g_mutex_free (bin->lock); - bin->lock = NULL; - } + g_mutex_clear (&bin->lock); GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object)); } @@ -804,6 +800,5 @@ clutter_gst_auto_video_sink_init (ClutterGstAutoVideoSink *bin) gst_element_add_pad (GST_ELEMENT (bin), bin->sink_pad); /* Setup the element */ GST_OBJECT_FLAG_SET (GST_OBJECT (bin), GST_ELEMENT_FLAG_SINK); - bin->lock = g_mutex_new (); - return; + g_mutex_init (&bin->lock); } diff --git a/clutter-gst/clutter-gst-auto-video-sink.h b/clutter-gst/clutter-gst-auto-video-sink.h index bcee56d..7dadd6e 100644 --- a/clutter-gst/clutter-gst-auto-video-sink.h +++ b/clutter-gst/clutter-gst-auto-video-sink.h @@ -65,7 +65,7 @@ G_BEGIN_DECLS GST_LOG_OBJECT (obj, \ "locking from thread %p", \ g_thread_self ()); \ - g_mutex_lock (CLUTTER_GST_AUTO_VIDEO_SINK(obj)->lock); \ + g_mutex_lock (&CLUTTER_GST_AUTO_VIDEO_SINK(obj)->lock); \ GST_LOG_OBJECT (obj, \ "locked from thread %p", \ g_thread_self ()); \ @@ -75,7 +75,7 @@ G_BEGIN_DECLS GST_LOG_OBJECT (obj, \ "unlocking from thread %p", \ g_thread_self ()); \ - g_mutex_unlock (CLUTTER_GST_AUTO_VIDEO_SINK(obj)->lock); \ + g_mutex_unlock (&CLUTTER_GST_AUTO_VIDEO_SINK(obj)->lock); \ } G_STMT_END typedef struct _ClutterGstAutoVideoSink ClutterGstAutoVideoSink; @@ -100,7 +100,7 @@ struct _ClutterGstAutoVideoSink ClutterTexture *texture; - GMutex *lock; + GMutex lock; }; struct _ClutterGstAutoVideoSinkClass diff --git a/clutter-gst/clutter-gst-video-sink.c b/clutter-gst/clutter-gst-video-sink.c index 397fe84..0e9538a 100644 --- a/clutter-gst/clutter-gst-video-sink.c +++ b/clutter-gst/clutter-gst-video-sink.c @@ -172,7 +172,7 @@ typedef struct _ClutterGstSource GSource source; ClutterGstVideoSink *sink; - GMutex *buffer_lock; /* mutex for the buffer */ + GMutex buffer_lock; /* mutex for the buffer */ GstBuffer *buffer; gboolean has_new_caps; gboolean stage_lost; @@ -263,7 +263,7 @@ clutter_gst_source_new (ClutterGstVideoSink *sink) g_source_set_priority (source, priv->priority); gst_source->sink = sink; - gst_source->buffer_lock = g_mutex_new (); + g_mutex_init (&gst_source->buffer_lock); gst_source->buffer = NULL; return gst_source; @@ -274,12 +274,12 @@ clutter_gst_source_finalize (GSource *source) { ClutterGstSource *gst_source = (ClutterGstSource *) source; - g_mutex_lock (gst_source->buffer_lock); + g_mutex_lock (&gst_source->buffer_lock); if (gst_source->buffer) gst_buffer_unref (gst_source->buffer); gst_source->buffer = NULL; - g_mutex_unlock (gst_source->buffer_lock); - g_mutex_free (gst_source->buffer_lock); + g_mutex_unlock (&gst_source->buffer_lock); + g_mutex_clear (&gst_source->buffer_lock); } static gboolean @@ -461,7 +461,7 @@ on_stage_destroyed (ClutterStage *stage, ClutterGstSource *gst_source = user_data; ClutterGstVideoSinkPrivate *priv = gst_source->sink->priv; - g_mutex_lock (gst_source->buffer_lock); + g_mutex_lock (&gst_source->buffer_lock); clutter_actor_hide (CLUTTER_ACTOR (stage)); clutter_container_remove_actor (CLUTTER_CONTAINER (stage), @@ -474,7 +474,7 @@ on_stage_destroyed (ClutterStage *stage, gst_source->buffer = NULL; priv->texture = NULL; - g_mutex_unlock (gst_source->buffer_lock); + g_mutex_unlock (&gst_source->buffer_lock); return TRUE; } @@ -508,7 +508,7 @@ clutter_gst_source_dispatch (GSource *source, ClutterGstVideoSinkPrivate *priv = gst_source->sink->priv; GstBuffer *buffer; - g_mutex_lock (gst_source->buffer_lock); + g_mutex_lock (&gst_source->buffer_lock); if (G_UNLIKELY (gst_source->has_new_caps)) { @@ -556,7 +556,7 @@ clutter_gst_source_dispatch (GSource *source, buffer = gst_source->buffer; gst_source->buffer = NULL; - g_mutex_unlock (gst_source->buffer_lock); + g_mutex_unlock (&gst_source->buffer_lock); if (buffer) { @@ -1299,14 +1299,14 @@ clutter_gst_video_sink_render (GstBaseSink *bsink, ClutterGstSource *gst_source = priv->source; - g_mutex_lock (gst_source->buffer_lock); + g_mutex_lock (&gst_source->buffer_lock); if (gst_source->stage_lost) { GST_ELEMENT_ERROR (bsink, RESOURCE, CLOSE, ("The window has been closed."), ("The window has been closed.")); - g_mutex_unlock (gst_source->buffer_lock); + g_mutex_unlock (&gst_source->buffer_lock); return GST_FLOW_ERROR; } @@ -1314,7 +1314,7 @@ clutter_gst_video_sink_render (GstBaseSink *bsink, gst_buffer_unref (gst_source->buffer); gst_source->buffer = gst_buffer_ref (buffer); - g_mutex_unlock (gst_source->buffer_lock); + g_mutex_unlock (&gst_source->buffer_lock); g_main_context_wakeup (priv->clutter_main_context); @@ -1343,9 +1343,9 @@ clutter_gst_video_sink_set_caps (GstBaseSink *bsink, if (!clutter_gst_parse_caps (caps, sink, FALSE)) return FALSE; - g_mutex_lock (priv->source->buffer_lock); + g_mutex_lock (&priv->source->buffer_lock); priv->source->has_new_caps = TRUE; - g_mutex_unlock (priv->source->buffer_lock); + g_mutex_unlock (&priv->source->buffer_lock); return TRUE; } |