Hi,
august wrote:
> Burkhard,
>
> Thanks for your patience so far. I hope this is helpful for us
> both.
It is.
>
> Instead of getting the plugin like you suggested, I get it by name::
>
> info = bg_plugin_find_by_name(plug_reg, "e_ffmpeg");
>
That's completely ok, if you are prepared for the case, that the e_ffmpeg
plugin is missing....
> I then set up the handle like you say.
>
>> bg_plugin_handle_t * h;
>>
>> bg_encoder_plugin_t * plugin; // Contains function pointers for encoding
>>
>> h = bg_plugin_load(plugin_reg, info);
>>
>> /* h->plugin is of type bg_plugin_common_t, so we must cast it */
>> plugin = (bg_encoder_plugin_t*)(h->plugin);
>>
>> Then you can call the encoding functions with h->priv as first argument.
>
>
> Now, I am wondering how I read and set the parameters for a particular
> codec. I do:
>
> const bg_parameter_info_t * params;
> params = plugin->get_audio_parameters(h->priv);
> printf("param name: %s longname:%s opt:%s help_string:%s \n",
> params->name, params->long_name, params->opt,
> params->help_string);
>
> But, this only prints out: "param name: codec longname:Codec ..."
>
>
> How do I loop through the parameters of a given codec and get/set them?
First of all: Looping through a parameter array happens with
i = 0;
while(params[i].name)
{
/* do something */
i++;
}
In this case, params is of type BG_PARAMETER_MULTI_MENU.
Then, the following additional members are set:
char ** multi_names; /* Short name for each codec (to be passed via
set_parameter())
char ** multi_labels; /* Human readable and translatable name for each
codec */
char ** multi_descriptions; /* Description for each codec */
bg_parameter_info_t ** multi_parameters; /* Parameters for each codec */
Looping through all possible menuitems (i.e. codecs) happens with:
j = 0;
while(params[i].multi_names[j])
{
/* do something */
j++;
}
Note that some codecs might have no parameters. In that case
multi_parameters[k] == NULL.
Getting parameter values from the plugin is not possible, but the val_default
member of
the parameter info contains a sensible default.
Setting the parameters is easy: First set the "codec" parameter (codec name as
string).
Then, set all parameters for that codec.
Also important is the following: plugins or other modules *never* set their
parameters
to defaults automatically. They just tell the defaults they like via
val_default.
For the general plugin parameters, the plugin registry takes care of it. For
the per stream
parameters (set_[audio|video]_parameter()), you have to do it.
I.e. if you don't set the audio codec, it will be NULL and plugin will crash :)
If you don't set the bitrate it will also be 0.
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