[Gstreamer-openmax] [PATCH v2] Initial support for configuration file

Clark, Rob rob at ti.com
Tue Mar 2 18:06:24 PST 2010


On Mar 2, 2010, at 6:35 PM, Felipe Contreras wrote:

> On Wed, Mar 3, 2010 at 2:15 AM, Felipe Contreras
> <felipe.contreras at nokia.com> wrote:
>> diff --git a/omx/gstomx.c b/omx/gstomx.c
> 
> [...]
> 
>> +static GstStructure *element_table = NULL;
>> +
>> +const gchar *default_config = NULL;
> 
> Note that the default_config is NULL, but will be updated by a
> subsequent patch to use the extern one.
> 
> [...]
> 
>> +/* TODO: we can cache table w/ gst_plugin_{get,set}_cache_data..
>> + */
>> +static GstStructure *
>> +get_element_table (void)
>> +{
>> +    static volatile gsize gonce_data = 0;
>> +    if (g_once_init_enter (&gonce_data))
>> +    {
>> +        gchar *path;
>> +        gchar *config, *s;
>> +        GstStructure *element;
>> +
>> +        path = g_strdup (g_getenv ("OMX_REGISTRY"));
>> +        if (!path)
>> +        {
>> +            path = g_build_filename (g_get_user_config_dir (),
>> +                    "gst-openmax.conf", NULL);
>> +        }
>> +
>> +        if (!g_file_get_contents (path, &config, NULL, NULL))
>> +        {
>> +            g_warning ("could not find config file '%s'.. using defaults!", path);
>> +            config = (gchar *) default_config;
> 
> Note that here I'm not creating a file with the default_config.
> 
> I think it's a bad idea; the conf file wouldn't be human readable, and
> in case gst-omx is updated with a new default_config it will not be
> used because the old one is already stored.

re: human-readable:  as long as you aren't using gst_structure_to_string(), it should be readable..

re: writing default config:   I was debating back and forth on this.. it would be nice to make it easier for someone to take the current config, and make a few tweaks.  Maybe the better approach would be to write out gst-openmax.conf-example which the user could modify and rename if desired..

(other note.. current patch I sent was not handling case where .config directory does not exist yet)

BR,
-R


> 
> [...]
> 
> Cheers.
> 
> -- 
> Felipe Contreras
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Gstreamer-openmax mailing list
> Gstreamer-openmax at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-openmax





More information about the Gstreamer-openmax mailing list