> > 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.

how do you set a codec parameter?  

> 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.

How do I do that?

> 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.


ok...I now have a simple print function to print out params:

void print_params( const bg_parameter_info_t * params ) {
        int i = 0;
        int j =0;
        if (params[i].type == BG_PARAMETER_MULTI_MENU) {
                while(params[i].name ) {
                        //printf("param name: %s  longname:%s \n",
                        params[i].name, params[i].long_name, params[i].opt,
                                params[i].help_string);
                        printf("param name: %s  \n",  params[i].name);
                        j = 0;

                        while(params[i].multi_names[j] &&
                                        params[i].multi_labels[j]) {
                                printf("\tparam
                                                multi_name: %s ",
                                                params[i].multi_names[j]);
                                printf("\tparam
                                                multi_label:
                                                %s \n",
                                                params[i].multi_labels[j]);
                                
                                j++;
                        }

                        i++;
                }
        }
}


I then do :


if( plugin->max_audio_streams ) {
        audio_params = plugin->get_audio_parameters(h->priv);
        print_params( audio_params);
}

if (plugin->max_video_streams ) {
        video_params  = plugin->get_video_parameters(h->priv);
        print_params(video_params);
}


It then crashes with a segfault on default_timescale.  Why?


I can now print out audio and video parameters (except for crash).  I
still cannot figure out how to set parameters.     What is multi_parameters?
The doc says "Parameters for each option."   But, it does not say to
which options it is referring. 


Also, I can't find where to get_container_parameters() to set the
container format?
How do I set, for example, container:AVI   ACODEC:ac3  and VCODEC:mp4 ?


What is the general method here?  As a novice, I expect to be able to
query for available plugins, and then query for the plugin type, and
then query the plugin type for what I can set on it.   I kind of see
this is what is going on here, but all of the names and placement of
functions seems cryptic to me.  Can you help me out here?


many thanks -august.






------------------------------------------------------------------------------
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