summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2014-05-15 13:21:07 +0200
committerSebastian Dröge <sebastian@centricular.com>2014-05-15 13:21:07 +0200
commit40869afea7134bb28828ec3e4cdab7f2e070c467 (patch)
tree9f340131188d99d15f896bc477b1a94e0d1d19c9
parent4e20116bc602567a1c977455c8bffd756f31320e (diff)
omxvideoenc: 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/gstomxvideoenc.c47
1 files changed, 36 insertions, 11 deletions
diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c
index 4014421..f61c45b 100644
--- a/omx/gstomxvideoenc.c
+++ b/omx/gstomxvideoenc.c
@@ -1094,26 +1094,51 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder,
return FALSE;
if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone)
return FALSE;
+
+ if ((klass->cdata.hacks & GST_OMX_HACK_NO_DISABLE_OUTPORT)) {
+ if (gst_omx_port_set_enabled (self->enc_out_port, TRUE) != OMX_ErrorNone)
+ return FALSE;
+ if (gst_omx_port_allocate_buffers (self->enc_out_port) != OMX_ErrorNone)
+ return FALSE;
+
+ if (gst_omx_port_wait_enabled (self->enc_out_port,
+ 5 * GST_SECOND) != OMX_ErrorNone)
+ return FALSE;
+ }
+
if (gst_omx_port_wait_enabled (self->enc_in_port,
5 * GST_SECOND) != OMX_ErrorNone)
return FALSE;
if (gst_omx_port_mark_reconfigured (self->enc_in_port) != OMX_ErrorNone)
return FALSE;
} else {
- /* Disable output port */
- if (gst_omx_port_set_enabled (self->enc_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->enc_out_port, FALSE) != OMX_ErrorNone)
+ return FALSE;
- if (gst_omx_port_wait_enabled (self->enc_out_port,
- 1 * GST_SECOND) != OMX_ErrorNone)
- return FALSE;
+ if (gst_omx_port_wait_enabled (self->enc_out_port,
+ 1 * GST_SECOND) != OMX_ErrorNone)
+ return FALSE;
- if (gst_omx_component_set_state (self->enc, OMX_StateIdle) != OMX_ErrorNone)
- return FALSE;
+ if (gst_omx_component_set_state (self->enc,
+ OMX_StateIdle) != OMX_ErrorNone)
+ return FALSE;
- /* Need to allocate buffers to reach Idle state */
- if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone)
- return FALSE;
+ /* Need to allocate buffers to reach Idle state */
+ if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone)
+ return FALSE;
+ } else {
+ if (gst_omx_component_set_state (self->enc,
+ OMX_StateIdle) != OMX_ErrorNone)
+ return FALSE;
+
+ /* Need to allocate buffers to reach Idle state */
+ if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone)
+ return FALSE;
+ if (gst_omx_port_allocate_buffers (self->enc_out_port) != OMX_ErrorNone)
+ return FALSE;
+ }
if (gst_omx_component_get_state (self->enc,
GST_CLOCK_TIME_NONE) != OMX_StateIdle)