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
{
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);
}
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;
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));
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;
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));
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 {
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",
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;
{
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
{
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);
}
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;
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));
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)
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));
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 {
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",
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;