[MPlayer-G2-dev] Re: G2 CLI/GUI

Andriy N. Gritsenko andrej at lucky.net
Tue May 13 00:50:41 CEST 2003


    Hi, Balatoni Denes!

Sometime (on Tuesday, May 13 at  1:25) I've received something...

>> > Ok. How are you going to add plugins to g2 without asking/waiting for
>> > weeks for somebody to commit your plugin to cvs ? You can make patch or
>> > fork mplayer too, but distributing a binary (+ source) is IMHO more
>> > flexible and convenient.

>> Huh? I didn't say anything about plugins being bad. What I said was
>> that it's not acceptable to scan/load them all at startup. MPlayer
>> MUST only load the stuff specifically requested by the user, so that
>> it starts instantly.

>I understand that, an indeed this should be possible. However if there is a 
>plugin, it has to be dlopened (or something) to tell what parameters it 
>excpects - that is if plugins can be added any time. 

Nope. :)  You can only tell at first if plugin is really exist. Then you
can dlopen() it only if you requested to. But all plugins are expected to
have ModuleInfo structure with certain order of fields. May be we have to
set there also some kind of magic ['M','P'] for example. So we will check
it on open:

....
plr->handle = dlopen (path, RTLD_NOW);
if (!handle) {
  return -1;
}
plr->info = dlsym (handle, "ModuleInfo");
if (!plr->info || plr->info->version[0] != PLUGIN_VERSION_MAJOR ||
    plr->info->version[1] < PLUGIN_VERSION_MINOR ||
    plr->info->version[2] != 'M' || plr->info->version[3] != 'P') {
  dlclose (plr->handle);
  return -1;
}
....

>Perhaps if a plugin is only opened when it's parameters are queried (and of 
>course when it is used)  than everybody will be happy - a cli to mplayer has 
>the choice not to query the plugin if it knows the parameters by heart.

I did it in the updated cfgparser.c - it remembers parameters for plugin
from config(s) to apply it only when plugin is about to open. But it is
details of implementation, nothing more, user application have to don't
worry about that and even know. :)

    Andriy.



More information about the MPlayer-G2-dev mailing list