[MPlayer-G2-dev] G2 CLI/GUI and config API again - a little request.
Andriy N. Gritsenko
andrej at lucky.net
Mon May 12 23:14:50 CEST 2003
Hi, Arpi!
I have a little question. When I thought how to get rid of static
variables for -vf then I've decided we have to have some structure for
context. There is draft for that structure. I very want to see if you
want to change anything in it (you said before you don't mind of that
struct at all). I propose also other structure - play_stream. I'll tell
you why I want to have two new structs below.
typedef struct play_context {
int audios; // number of streams in audio_stream[]
struct play_stream audio_stream[];
int videos;
struct play_stream video_stream[];
double pts; // presentation time stamp for parallel play sync
cfg_tree_t *tree; // root of config for that context
} play_context;
typedef struct play_stream {
demux_stream_t *ds;
void *chain; // sh_video_t or sh_audio_t
void *out; // vo_instance_t or ao_functions_t
play_context *ctx; // where it belongs to
} play_stream;
Why I want that API? I want to add play_stream* to pl_instance_t so
we could have another config context for each stream and any parsing
function will know it's context - I mean vf_create_chain() from my
previous letter to add new filter in the filter chain. So config belongs
to play context and play stream has only one play context.
So with that API we will get what you want and UI will create chain
by itself. Each time any UI/parser can parse input in only one stream
context, isn't it? Initiating new filter will work in order:
1) parse input in current stream context (directly from Gui or for
current input file/sid from config parser);
2) load loadable plugin if need and get it's config structure;
3) call vf_create_chain() - it is vf_open_filter() but for plugin API;
3a) vf_open_filter() calling vf->open();
3b) open() creating new params instance with defaults or previous
settings (in depending of config variable alike "persistent_filters",
some people will like one way, some other);
3c) open() calling cfg_parse_config() for that play_stream and own params
instance;
3d) cfg_parse_config() setting parameters for instance;
4) continue parsing... :)
Runtime change of parameters:
some UI calls vf->control(vf,VFCTRL_SET_PARAMS,NULL); that control() call
will do:
1) create new copy of vf->priv;
2) run cfg_parse_config() for own play_stream and copy of vf->priv;
3) update variables if it's possible;
4) free the copy of vf->priv.
I hope it's the best way that can get rid of statics at all. Arpi,
please, correct all what you don't like in these structs and that scheme
(but I hope that scheme is already what you wanted :) and I will apply it
all in version 2 of config API. :)
With the best wishes.
Andriy.
More information about the MPlayer-G2-dev
mailing list