[Gstreamer-openmax] [PATCH 6/8] Add input-buffers/output-buffers properties to the base classes
Felipe Contreras
felipe.contreras at gmail.com
Tue Mar 23 15:44:01 PDT 2010
On Thu, Mar 18, 2010 at 1:58 AM, Rob Clark <rob at ti.com> wrote:
> ---
> omx/gstomx_base_filter.c | 62 ++++++++++++++++++++++++++++++++++++++
> omx/gstomx_base_sink.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++
> omx/gstomx_base_src.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 210 insertions(+), 0 deletions(-)
>
> diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
> index 98b40d5..76ec085 100644
> --- a/omx/gstomx_base_filter.c
> +++ b/omx/gstomx_base_filter.c
> @@ -28,6 +28,8 @@
> enum
> {
> ARG_USE_TIMESTAMPS = GSTOMX_NUM_COMMON_PROP,
> + ARG_NUM_INPUT_BUFFERS,
> + ARG_NUM_OUTPUT_BUFFERS,
> };
>
> static void init_interfaces (GType type);
> @@ -182,6 +184,36 @@ set_property (GObject *obj,
> case ARG_USE_TIMESTAMPS:
> self->use_timestamps = g_value_get_boolean (value);
> break;
> + case ARG_NUM_INPUT_BUFFERS:
> + case ARG_NUM_OUTPUT_BUFFERS:
> + if (G_LIKELY (self->gomx->omx_handle))
> + {
Too nested.
How about:
if (G_UNLIKELY(!omx_handle)) {
GST_WARNING_OBJECT(self, "no component");
break;
}
/* rest of the stuff */
This applies all over the place.
> + OMX_PARAM_PORTDEFINITIONTYPE param;
> + OMX_U32 nBufferCountActual = g_value_get_uint (value);
> + GOmxPort *port = (prop_id == ARG_NUM_INPUT_BUFFERS) ?
> + self->in_port : self->out_port;
> +
> + G_OMX_INIT_PARAM (param);
> +
> + param.nPortIndex = port->port_index;
> + OMX_GetParameter (self->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
> +
> + if (nBufferCountActual < param.nBufferCountMin)
> + {
> + GST_ERROR_OBJECT (self, "buffer count %lu is less than minimum %lu",
> + nBufferCountActual, param.nBufferCountMin);
> + return;
> + }
> +
> + param.nBufferCountActual = nBufferCountActual;
> +
> + OMX_SetParameter (self->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
> + }
> + else
> + {
> + GST_WARNING_OBJECT (self, "no component");
> + }
> + break;
--
Felipe Contreras
More information about the Gstreamer-openmax
mailing list