diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2014-05-15 13:24:39 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-07-02 09:21:00 +0200 |
commit | c27053c94e188cc69691079b84b3b2ba9373a9db (patch) | |
tree | 1fc1196abdd6e00d74ccaae3599167dab29af51a | |
parent | 0c3b3ef3d091fdd67a16c0dc2dcddb5f564ee3e4 (diff) | |
download | gst-omx-c27053c94e188cc69691079b84b3b2ba9373a9db.tar.gz |
omxaudiodec: Implement hack for not disabling the output port after set_format until the output format is known
Needed on some OMX implementations, e.g. the one from Atmel. It does
not send the settings-changed event on the output port if it is
disabled.
-rw-r--r-- | omx/gstomxaudiodec.c | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/omx/gstomxaudiodec.c b/omx/gstomxaudiodec.c index d155017..3dc5784 100644 --- a/omx/gstomxaudiodec.c +++ b/omx/gstomxaudiodec.c @@ -842,26 +842,51 @@ gst_omx_audio_dec_set_format (GstAudioDecoder * decoder, GstCaps * caps) return FALSE; if (gst_omx_port_allocate_buffers (self->dec_in_port) != OMX_ErrorNone) return FALSE; + + if ((klass->cdata.hacks & GST_OMX_HACK_NO_DISABLE_OUTPORT)) { + if (gst_omx_port_set_enabled (self->dec_out_port, TRUE) != OMX_ErrorNone) + return FALSE; + if (gst_omx_port_allocate_buffers (self->dec_out_port) != OMX_ErrorNone) + return FALSE; + + if (gst_omx_port_wait_enabled (self->dec_out_port, + 5 * GST_SECOND) != OMX_ErrorNone) + return FALSE; + } + if (gst_omx_port_wait_enabled (self->dec_in_port, 5 * GST_SECOND) != OMX_ErrorNone) return FALSE; if (gst_omx_port_mark_reconfigured (self->dec_in_port) != OMX_ErrorNone) return FALSE; } else { - /* Disable output port */ - if (gst_omx_port_set_enabled (self->dec_out_port, FALSE) != OMX_ErrorNone) - return FALSE; + if (!(klass->cdata.hacks & GST_OMX_HACK_NO_DISABLE_OUTPORT)) { + /* Disable output port */ + if (gst_omx_port_set_enabled (self->dec_out_port, FALSE) != OMX_ErrorNone) + return FALSE; - if (gst_omx_port_wait_enabled (self->dec_out_port, - 1 * GST_SECOND) != OMX_ErrorNone) - return FALSE; + if (gst_omx_port_wait_enabled (self->dec_out_port, + 1 * GST_SECOND) != OMX_ErrorNone) + return FALSE; - if (gst_omx_component_set_state (self->dec, OMX_StateIdle) != OMX_ErrorNone) - return FALSE; + if (gst_omx_component_set_state (self->dec, + OMX_StateIdle) != OMX_ErrorNone) + return FALSE; - /* Need to allocate buffers to reach Idle state */ - if (gst_omx_port_allocate_buffers (self->dec_in_port) != OMX_ErrorNone) - return FALSE; + /* Need to allocate buffers to reach Idle state */ + if (gst_omx_port_allocate_buffers (self->dec_in_port) != OMX_ErrorNone) + return FALSE; + } else { + if (gst_omx_component_set_state (self->dec, + OMX_StateIdle) != OMX_ErrorNone) + return FALSE; + + /* Need to allocate buffers to reach Idle state */ + if (gst_omx_port_allocate_buffers (self->dec_in_port) != OMX_ErrorNone) + return FALSE; + if (gst_omx_port_allocate_buffers (self->dec_out_port) != OMX_ErrorNone) + return FALSE; + } if (gst_omx_component_get_state (self->dec, GST_CLOCK_TIME_NONE) != OMX_StateIdle) |