From 3ac983fe16297e0c9a3a214f3fbb89ec7f6071a1 Mon Sep 17 00:00:00 2001 From: Sebastian Dröge Date: Mon, 12 Nov 2012 11:32:44 +0100 Subject: androidmedia: Update to new GLib thread API --- sys/androidmedia/gstamcaudiodec.c | 32 ++++++++++++++++---------------- sys/androidmedia/gstamcaudiodec.h | 4 ++-- sys/androidmedia/gstamcvideodec.c | 32 ++++++++++++++++---------------- sys/androidmedia/gstamcvideodec.h | 4 ++-- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/sys/androidmedia/gstamcaudiodec.c b/sys/androidmedia/gstamcaudiodec.c index 886556ae2..e34a0574c 100644 --- a/sys/androidmedia/gstamcaudiodec.c +++ b/sys/androidmedia/gstamcaudiodec.c @@ -323,8 +323,8 @@ gst_amc_audio_dec_init (GstAmcAudioDec * self) gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (self), TRUE); gst_audio_decoder_set_drainable (GST_AUDIO_DECODER (self), TRUE); - self->drain_lock = g_mutex_new (); - self->drain_cond = g_cond_new (); + g_mutex_init (&self->drain_lock); + g_cond_init (&self->drain_cond); } static gboolean @@ -370,8 +370,8 @@ gst_amc_audio_dec_finalize (GObject * object) { GstAmcAudioDec *self = GST_AMC_AUDIO_DEC (object); - g_mutex_free (self->drain_lock); - g_cond_free (self->drain_cond); + g_mutex_clear (&self->drain_lock); + g_cond_clear (&self->drain_cond); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -399,10 +399,10 @@ gst_amc_audio_dec_change_state (GstElement * element, GstStateChange transition) case GST_STATE_CHANGE_PAUSED_TO_READY: self->flushing = TRUE; gst_amc_codec_flush (self->codec); - g_mutex_lock (self->drain_lock); + g_mutex_lock (&self->drain_lock); self->draining = FALSE; - g_cond_broadcast (self->drain_cond); - g_mutex_unlock (self->drain_lock); + g_cond_broadcast (&self->drain_cond); + g_mutex_unlock (&self->drain_lock); break; default: break; @@ -640,16 +640,16 @@ done: if (is_eos || flow_ret == GST_FLOW_EOS) { GST_AUDIO_DECODER_STREAM_UNLOCK (self); - g_mutex_lock (self->drain_lock); + g_mutex_lock (&self->drain_lock); if (self->draining) { GST_DEBUG_OBJECT (self, "Drained"); self->draining = FALSE; - g_cond_broadcast (self->drain_cond); + g_cond_broadcast (&self->drain_cond); } else if (flow_ret == GST_FLOW_OK) { GST_DEBUG_OBJECT (self, "Component signalled EOS"); flow_ret = GST_FLOW_EOS; } - g_mutex_unlock (self->drain_lock); + g_mutex_unlock (&self->drain_lock); GST_AUDIO_DECODER_STREAM_LOCK (self); } else { GST_DEBUG_OBJECT (self, "Finished frame: %s", gst_flow_get_name (flow_ret)); @@ -801,10 +801,10 @@ gst_amc_audio_dec_stop (GstAudioDecoder * decoder) self->downstream_flow_ret = GST_FLOW_FLUSHING; self->eos = FALSE; - g_mutex_lock (self->drain_lock); + g_mutex_lock (&self->drain_lock); self->draining = FALSE; - g_cond_broadcast (self->drain_cond); - g_mutex_unlock (self->drain_lock); + g_cond_broadcast (&self->drain_cond); + g_mutex_unlock (&self->drain_lock); GST_DEBUG_OBJECT (self, "Stopped decoder"); return TRUE; @@ -1226,7 +1226,7 @@ gst_amc_audio_dec_drain (GstAmcAudioDec * self) GstAmcBufferInfo buffer_info; GST_AUDIO_DECODER_STREAM_UNLOCK (self); - g_mutex_lock (self->drain_lock); + g_mutex_lock (&self->drain_lock); self->draining = TRUE; memset (&buffer_info, 0, sizeof (buffer_info)); @@ -1237,7 +1237,7 @@ gst_amc_audio_dec_drain (GstAmcAudioDec * self) if (gst_amc_codec_queue_input_buffer (self->codec, idx, &buffer_info)) { GST_DEBUG_OBJECT (self, "Waiting until codec is drained"); - g_cond_wait (self->drain_cond, self->drain_lock); + g_cond_wait (&self->drain_cond, &self->drain_lock); GST_DEBUG_OBJECT (self, "Drained codec"); ret = GST_FLOW_OK; } else { @@ -1245,7 +1245,7 @@ gst_amc_audio_dec_drain (GstAmcAudioDec * self) ret = GST_FLOW_ERROR; } - g_mutex_unlock (self->drain_lock); + g_mutex_unlock (&self->drain_lock); GST_AUDIO_DECODER_STREAM_LOCK (self); } else if (idx >= self->n_input_buffers) { GST_ERROR_OBJECT (self, "Invalid input buffer index %d of %d", diff --git a/sys/androidmedia/gstamcaudiodec.h b/sys/androidmedia/gstamcaudiodec.h index 0e0c6e10b..ee5218190 100644 --- a/sys/androidmedia/gstamcaudiodec.h +++ b/sys/androidmedia/gstamcaudiodec.h @@ -73,8 +73,8 @@ struct _GstAmcAudioDec GstClockTime last_upstream_ts; /* Draining state */ - GMutex *drain_lock; - GCond *drain_cond; + GMutex drain_lock; + GCond drain_cond; /* TRUE if EOS buffers shouldn't be forwarded */ gboolean draining; diff --git a/sys/androidmedia/gstamcvideodec.c b/sys/androidmedia/gstamcvideodec.c index 5e702ee75..225682872 100644 --- a/sys/androidmedia/gstamcvideodec.c +++ b/sys/androidmedia/gstamcvideodec.c @@ -454,8 +454,8 @@ gst_amc_video_dec_init (GstAmcVideoDec * self) { gst_video_decoder_set_packetized (GST_VIDEO_DECODER (self), TRUE); - self->drain_lock = g_mutex_new (); - self->drain_cond = g_cond_new (); + g_mutex_init (&self->drain_lock); + g_cond_init (&self->drain_cond); } static gboolean @@ -501,8 +501,8 @@ gst_amc_video_dec_finalize (GObject * object) { GstAmcVideoDec *self = GST_AMC_VIDEO_DEC (object); - g_mutex_free (self->drain_lock); - g_cond_free (self->drain_cond); + g_mutex_clear (&self->drain_lock); + g_cond_clear (&self->drain_cond); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -530,10 +530,10 @@ gst_amc_video_dec_change_state (GstElement * element, GstStateChange transition) case GST_STATE_CHANGE_PAUSED_TO_READY: self->flushing = TRUE; gst_amc_codec_flush (self->codec); - g_mutex_lock (self->drain_lock); + g_mutex_lock (&self->drain_lock); self->draining = FALSE; - g_cond_broadcast (self->drain_cond); - g_mutex_unlock (self->drain_lock); + g_cond_broadcast (&self->drain_cond); + g_mutex_unlock (&self->drain_lock); break; default: break; @@ -1092,16 +1092,16 @@ retry: if (is_eos || flow_ret == GST_FLOW_EOS) { GST_VIDEO_DECODER_STREAM_UNLOCK (self); - g_mutex_lock (self->drain_lock); + g_mutex_lock (&self->drain_lock); if (self->draining) { GST_DEBUG_OBJECT (self, "Drained"); self->draining = FALSE; - g_cond_broadcast (self->drain_cond); + g_cond_broadcast (&self->drain_cond); } else if (flow_ret == GST_FLOW_OK) { GST_DEBUG_OBJECT (self, "Component signalled EOS"); flow_ret = GST_FLOW_EOS; } - g_mutex_unlock (self->drain_lock); + g_mutex_unlock (&self->drain_lock); GST_VIDEO_DECODER_STREAM_LOCK (self); } else { GST_DEBUG_OBJECT (self, "Finished frame: %s", gst_flow_get_name (flow_ret)); @@ -1236,10 +1236,10 @@ gst_amc_video_dec_stop (GstVideoDecoder * decoder) self->downstream_flow_ret = GST_FLOW_FLUSHING; self->eos = FALSE; - g_mutex_lock (self->drain_lock); + g_mutex_lock (&self->drain_lock); self->draining = FALSE; - g_cond_broadcast (self->drain_cond); - g_mutex_unlock (self->drain_lock); + g_cond_broadcast (&self->drain_cond); + g_mutex_unlock (&self->drain_lock); g_free (self->codec_data); self->codec_data_size = 0; if (self->input_state) @@ -1647,7 +1647,7 @@ gst_amc_video_dec_drain (GstAmcVideoDec * self, gboolean at_eos) GstAmcBufferInfo buffer_info; GST_VIDEO_DECODER_STREAM_UNLOCK (self); - g_mutex_lock (self->drain_lock); + g_mutex_lock (&self->drain_lock); self->draining = TRUE; memset (&buffer_info, 0, sizeof (buffer_info)); @@ -1658,7 +1658,7 @@ gst_amc_video_dec_drain (GstAmcVideoDec * self, gboolean at_eos) if (gst_amc_codec_queue_input_buffer (self->codec, idx, &buffer_info)) { GST_DEBUG_OBJECT (self, "Waiting until codec is drained"); - g_cond_wait (self->drain_cond, self->drain_lock); + g_cond_wait (&self->drain_cond, &self->drain_lock); GST_DEBUG_OBJECT (self, "Drained codec"); ret = GST_FLOW_OK; } else { @@ -1666,7 +1666,7 @@ gst_amc_video_dec_drain (GstAmcVideoDec * self, gboolean at_eos) ret = GST_FLOW_ERROR; } - g_mutex_unlock (self->drain_lock); + g_mutex_unlock (&self->drain_lock); GST_VIDEO_DECODER_STREAM_LOCK (self); } else if (idx >= self->n_input_buffers) { GST_ERROR_OBJECT (self, "Invalid input buffer index %d of %d", diff --git a/sys/androidmedia/gstamcvideodec.h b/sys/androidmedia/gstamcvideodec.h index 8709d1169..3353dc68e 100644 --- a/sys/androidmedia/gstamcvideodec.h +++ b/sys/androidmedia/gstamcvideodec.h @@ -74,8 +74,8 @@ struct _GstAmcVideoDec GstClockTime last_upstream_ts; /* Draining state */ - GMutex *drain_lock; - GCond *drain_cond; + GMutex drain_lock; + GCond drain_cond; /* TRUE if EOS buffers shouldn't be forwarded */ gboolean draining; -- cgit v1.2.3