Hi,

august wrote
>> These are basically the steps:
>>
>> 1. Create a configuration registry
>
> How do I do this?
>
> config_reg = bg_cfg_registry_create();
> // what do I load here if I want an encoder????
> tmp_path =  bg_search_file_read("recorder", "config.xml");
> bg_cfg_registry_load(config_reg, tmp_path);

You'll always load all kinds of plugins.

The "recorder" means, that we will try to load
~/.gmerlin/recorder/config.xml, it's basically the name of the
application, which will translate into a directory under ~/.gmerlin.
In this directory, applications can store all their private data. E.g.
the GUI player saves the media tree here.

You can use any other path for this of course.

>> 2. Create a plugin registry
>
> I see I am supposed to do something like:
>       section = bg_cfg_registry_find_section(config_reg, "plugins");
>       plug_reg = bg_plugin_registry_create(section);
>
> what is a bg_cfg_section_t ?

A section is a like a "directory" in the config registry. It can contain
parameters (name-value pairs) and subsections.
In all my applications I have a section "plugins". It contains
one subsection for each plugin.

Passing the "plugins" section to the plugin registry has the advantage,
that the plugin registry will usually set the plugin parameters to the
the last saved values when it loads a plugin. All you need to do is to
store all parameters, you pass via set_parameter(), also in the
section for the plugin. My gtk dialogs do this automatically.

Splitting the configuration registry into sections has the advantage, that
it's less painful to find unique names for parameters if you have a large
number of plugins. parameter names must only be unique within their
section.

> What are all these steps?   I can't find any doku or simple source code
> on it and I have been looking for days now.

If you have an idea to improve the documentation or provide some simple
examples, go ahead. Of course clarifying patches for Doxygen comments
are *highly* welcome.

Once you created a plugin registry, you can get the available encoders
with:

const bg_plugin_info_t * info;

int num =
bg_plugin_registry_get_num_plugins(plugin_reg,
                                   BG_PLUGIN_ENCODER_AUDIO |
                                   BG_PLUGIN_ENCODER_VIDEO |
                                   BG_PLUGIN_ENCODER,
                                   BG_PLUGIN_FILE);

for(i = 0; i < num; i++)
  {
  info = bg_plugin_find_by_index(plugin_reg, i,
                                 BG_PLUGIN_ENCODER_AUDIO |
                                 BG_PLUGIN_ENCODER_VIDEO |
                                 BG_PLUGIN_ENCODER,
                                 BG_PLUGIN_FILE);
  }

With this method you can query for any combination of plugin types.
Only the last 2 arguments must be identical for 
bg_plugin_registry_get_num_plugins() and bg_plugin_find_by_index().

> I can't get past steps 1 and 2.  I'm sure I'll have questions on the
> rest soon.

No problem. Maybe telling others how to use this helps me finding ways to
make it easier (or explain better).

Burkhard


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Gmerlin-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gmerlin-general

Reply via email to