[Gstreamer-openmax] [PATCH 4/5] Make {component, library}-name read-only

Stefan Kost ensonic at hora-obscura.de
Thu Mar 4 00:18:23 PST 2010


Felipe Contreras wrote:
> As suggested by Rob Clark.
>
> Signed-off-by: Felipe Contreras <felipe.contreras at nokia.com>
> ---
>  omx/gstomx_base_filter.c |   12 ++----------
>  omx/gstomx_base_sink.c   |   12 ++----------
>  omx/gstomx_base_src.c    |   12 ++----------
>  3 files changed, 6 insertions(+), 30 deletions(-)
>
> diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
> index 01ca10a..da41b4d 100644
> --- a/omx/gstomx_base_filter.c
> +++ b/omx/gstomx_base_filter.c
> @@ -201,14 +201,6 @@ set_property (GObject *obj,
>  
>      switch (prop_id)
>      {
> -        case ARG_COMPONENT_NAME:
> -            g_free (self->gomx->component_name);
> -            self->gomx->component_name = g_value_dup_string (value);
> -            break;
> -        case ARG_LIBRARY_NAME:
> -            g_free (self->gomx->library_name);
> -            self->gomx->library_name = g_value_dup_string (value);
> -            break;
>          case ARG_USE_TIMESTAMPS:
>              self->use_timestamps = g_value_get_boolean (value);
>              break;
> @@ -268,12 +260,12 @@ type_class_init (gpointer g_class,
>          g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
>                                           g_param_spec_string ("component-name", "Component name",
>                                                                "Name of the OpenMAX IL component to use",
> -                                                              NULL, G_PARAM_READWRITE));
> +                                                              NULL, G_PARAM_READABLE));
>  
>          g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
>                                           g_param_spec_string ("library-name", "Library name",
>                                                                "Name of the OpenMAX IL implementation library to use",
> -                                                              NULL, G_PARAM_READWRITE));
> +                                                              NULL, G_PARAM_READABLE));
>  
>          g_object_class_install_property (gobject_class, ARG_USE_TIMESTAMPS,
>                                           g_param_spec_boolean ("use-timestamps", "Use timestamps",
> diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
> index ac32799..b042f33 100644
> --- a/omx/gstomx_base_sink.c
> +++ b/omx/gstomx_base_sink.c
> @@ -295,14 +295,6 @@ set_property (GObject *obj,
>  
>      switch (prop_id)
>      {
> -        case ARG_COMPONENT_NAME:
> -            g_free (self->gomx->component_name);
> -            self->gomx->component_name = g_value_dup_string (value);
> -            break;
> -        case ARG_LIBRARY_NAME:
> -            g_free (self->gomx->library_name);
> -            self->gomx->library_name = g_value_dup_string (value);
> -            break;
>          default:
>              G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
>              break;
> @@ -363,12 +355,12 @@ type_class_init (gpointer g_class,
>          g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
>                                           g_param_spec_string ("component-name", "Component name",
>                                                                "Name of the OpenMAX IL component to use",
> -                                                              NULL, G_PARAM_READWRITE));
> +                                                              NULL, G_PARAM_READABLE));
>  
>          g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
>                                           g_param_spec_string ("library-name", "Library name",
>                                                                "Name of the OpenMAX IL implementation library to use",
> -                                                              NULL, G_PARAM_READWRITE));
> +                                                              NULL, G_PARAM_READABLE));
>      }
>  }
>  
> diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
> index 51aa189..bd25c6d 100644
> --- a/omx/gstomx_base_src.c
> +++ b/omx/gstomx_base_src.c
> @@ -359,14 +359,6 @@ set_property (GObject *obj,
>  
>      switch (prop_id)
>      {
> -        case ARG_COMPONENT_NAME:
> -            g_free (self->gomx->component_name);
> -            self->gomx->component_name = g_value_dup_string (value);
> -            break;
> -        case ARG_LIBRARY_NAME:
> -            g_free (self->gomx->library_name);
> -            self->gomx->library_name = g_value_dup_string (value);
> -            break;
>          default:
>              G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
>              break;
> @@ -424,12 +416,12 @@ type_class_init (gpointer g_class,
>          g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
>                                           g_param_spec_string ("component-name", "Component name",
>                                                                "Name of the OpenMAX IL component to use",
> -                                                              NULL, G_PARAM_READWRITE));
> +                                                              NULL, G_PARAM_READABLE));
>  
>          g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
>                                           g_param_spec_string ("library-name", "Library name",
>                                                                "Name of the OpenMAX IL implementation library to use",
> -                                                              NULL, G_PARAM_READWRITE));
> +                                                              NULL, G_PARAM_READABLE));
>      }
>  }
>  
>   

As a minor optimization I'd suggest to use G_PARAM_STATIC_STRINGS in
addition. This avoids copying the ("library-name", "Library name", "Name
of the OpenMAX IL implementation library to use") stings. There is a
flag for each string, if only some are static.

Stefan





More information about the Gstreamer-openmax mailing list