diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2014-05-15 10:58:34 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-05-15 10:59:35 +0200 |
commit | 4e20116bc602567a1c977455c8bffd756f31320e (patch) | |
tree | 3c476b54d61ee1d9316fc1452bb9745a5092dd53 | |
parent | e08540d969c170a37425b07b8e5b97b2bfbf880a (diff) |
omx: Add a 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/gstomx.c | 2 | ||||
-rw-r--r-- | omx/gstomx.h | 5 | ||||
-rw-r--r-- | omx/gstomxvideodec.c | 47 |
3 files changed, 43 insertions, 11 deletions
diff --git a/omx/gstomx.c b/omx/gstomx.c index 4c05c0e..fecae5a 100644 --- a/omx/gstomx.c +++ b/omx/gstomx.c @@ -2458,6 +2458,8 @@ gst_omx_parse_hacks (gchar ** hacks) hacks_flags |= GST_OMX_HACK_DRAIN_MAY_NOT_RETURN; else if (g_str_equal (*hacks, "no-component-role")) hacks_flags |= GST_OMX_HACK_NO_COMPONENT_ROLE; + else if (g_str_equal (*hacks, "no-disable-outport")) + hacks_flags |= GST_OMX_HACK_NO_DISABLE_OUTPORT; else GST_WARNING ("Unknown hack: %s", *hacks); hacks++; diff --git a/omx/gstomx.h b/omx/gstomx.h index 8efe23d..f78bbf9 100644 --- a/omx/gstomx.h +++ b/omx/gstomx.h @@ -107,6 +107,11 @@ G_BEGIN_DECLS */ #define GST_OMX_HACK_NO_COMPONENT_ROLE G_GUINT64_CONSTANT (0x0000000000000080) +/* If the component doesn't allow disabling the outport while + * when setting the format until the output format is known. + */ +#define GST_OMX_HACK_NO_DISABLE_OUTPORT G_GUINT64_CONSTANT (0x0000000000000100) + typedef struct _GstOMXCore GstOMXCore; typedef struct _GstOMXPort GstOMXPort; typedef enum _GstOMXPortDirection GstOMXPortDirection; diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index 256694c..335d17c 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -1860,6 +1860,18 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder, 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; @@ -1869,20 +1881,33 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder, if (!gst_omx_video_dec_negotiate (self)) GST_LOG_OBJECT (self, "Negotiation failed, will get output format later"); - /* 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) |