[Gstreamer-openmax] [PATCH] a small bit of refactoring to gstomx_util, to allow for more flexibility of when the OMX component and port is instantiated

Stefan Kost ensonic at hora-obscura.de
Thu Nov 5 13:21:07 PST 2009


Rob Clark schrieb:
> Signed-off-by: Rob Clark <rob at ti.com>
> ---
>  omx/gstomx_base_filter.c |   24 ++------
>  omx/gstomx_base_sink.c   |   21 ++------
>  omx/gstomx_base_src.c    |   22 ++------
>  omx/gstomx_util.c        |  133 +++++++++++++++++++++++++++++++++++-----------
>  omx/gstomx_util.h        |   12 +++--
>  5 files changed, 123 insertions(+), 89 deletions(-)
> 

>  void
> -g_omx_core_init (GOmxCore *core,
> -                 const gchar *library_name,
> -                 const gchar *component_name)
> +g_omx_core_init (GOmxCore *core)
>  {
> +    gchar *library_name=NULL, *component_name=NULL;
> +
> +    if (core->omx_handle)
> +      return;
> +
> +    GST_DEBUG_OBJECT (core->object, "loading: %s (%s)", component_name, library_name);
> +
> +    g_object_get (core->object,
> +        "component-name", &component_name,
> +        "library-name", &library_name,
> +        NULL);
> +
> +    g_return_if_fail (component_name);
> +    g_return_if_fail (library_name);
> +
>      core->imp = request_imp (library_name);
>  

just use g_assert here, if that is never supposed to fail. g_return_if_fail is
to handle external wrong api usage (things that you can't control), and g_assert
is for own mistakes. People who are using stable releases of a software would
turn the assert off. When they ship their product and its well tested, they
could turn the g_return_if_fail off too (if there are not going to be other
users of the library).

Stefan




More information about the Gstreamer-openmax mailing list