[MPlayer-dev-eng] [TEST PATCH] How to get rid of all sscanf() or new face of config :)

Andriy N. Gritsenko andrej at lucky.net
Tue Mar 25 22:34:21 CET 2003


    Hi, community!

    I know, this letter is big. I know, this patch is large. But, please,
read it to very end and try it. Nobody is perfect and I don't guarantee
if there are no bugs in it so I want your fixes, opinions, indignations,
etc. ;)
    What I propose? I want to get rid of -lavcopts, -lameopts, etc. And
at the same time get rid of sscanf() in filters. So I made that patch.
What's new/changed/featured:

    1. It doesn't touch old config. As Albeu said before he will remove
that stuff anyway. :)

    2. Sources are simpler, they are shorten by 436 lines already (but it
will be continued after removing more sscanf's):

grep '^[+]' MPlayer-20030325.diff|grep -v '^.[[:space:]]*[/][/]'|wc -l
    2278
grep '^[-]' MPlayer-20030325.diff|grep -v '^.[[:space:]]*[/][/]'|wc -l
    2714

    3. Changes in commandline parameters:
    3a. Options -vo, -ao, -vc, -ac, -vop, -af, -ovc, oac, -afm, -vfm now
work a bit different, for example:
-opt:subopt params      will set parameters but don't select codec/filter
-opt subopt:params      will select codec/filter and set parameters

    3b. Moved:
-lavdopts       -> -vc:ffmpeg
-xvidopts       -> -vc:xvid
-lameopts       -> -oac:mp3lame
-divx4opts      -> -ovc:divx4
-lavcopts       -> -ovc:lavc
-vfwopts        -> -ovc:vfw
-xvidencopts    -> -ovc:xvid
-nuvopts        -> -ovc:nuv
-jpeg           -> -vo:jpeg
-dxr2           -> -vo:dxr2
    Some of these options are still lists (I tried don't change syntax
except removing these options), so you can use -vo dxr2=params,x11 for
example. Without parameters they seems the same as old syntax. :)

    3c. Now config has built-in help, no some_subconfig_help() anymore!
You can type:

    mencoder -oac help
or
    mencoder -oac mp3lame:help
and even
    mencoder -oac mp3lame:padding=help

and you will get full list of options/choices! :)

    3d. All other commandline parametsers are not changed a bit.

    4. These options may be configured in config file, for example:
ovc:lavc = vcodec=mpeg4,vbitrate=1200
vop:dint = 0.02:0.15

    5. No extern struct's in cfg-*.h for codecs or filters (I think it's
another big step to get all codecs/filters/drivers modularized). ;)

    6. You can now remove all sscanf() stuff from all video and audio
filters since it may be parsed by config parser now.

    7. And most big feature for me - you can obtain full menu structure
for GUI via mconfig->opts! You don't need anymore have your own menu
config, it has all you want! See:
CONF_TYPE_FLAG                                      checkbox
CONF_TYPE_INT,CONF_TYPE_FLOAT,CONF_TYPE_POSITION    slider (may be)
CONF_TYPE_STRING,CONF_TYPE_SPAN                     input box
CONF_TYPE_SUBCONFIG                                 dialog box
CONF_TYPE_CHOOSE                                    select box
CONF_TYPE_LIST                  selection/reorder box, two-panel for example
    Unfortunately, I didn't find what to do with CONF_TYPE_FUNC* so they
may be just input fields (as string)? CONF_TYPE_PRINT just ignored.
    So from now what you have to do is to arrange all fields and you have
all your menu ready! Isn't it funny? :)

    Now more about it.
    How it works? In structure *_info_t added one new field, that field
has pointer to array of m_option_t - it's subconfig, of course. Fields of
that subconfig have to be fields of internal filter structure with
current values of fields. That scructure have to be copied into private
scructure of vf_instance_t* on filter init. It's a bit other way then
Albeu's. I think it's good to give next instance of filter to have as
default previous tunings.
My way:
1) set settings (in config file, for example)
2) init filter
3) change settings
4) init next filter instance
...
Albeu's way:
1) init filter
2) set settings from defaults
3) init next instance
4) set settings from defaults
...
Pro of my way in difference of Albeu's:
1) simple realisation;
2) can set start settings in config file;
3) can use the same setting in all instances.
Contra:
1) cannot get defaults back;
    Anyway any instance of filter has its own settings and if you want
change its "on the fly" then we can implement vf_reinit_filter() and so
on, to do it. :)

2GUI makers: As I said above, GUI may be very changed for new concept of
menu, so I didn't touch it at all. Sorry, I even didn't try to compile it.

2filters makers: Please, fill the config structures to get rid of sscanfs
and to have it usable in help/GUI menu. :)

2volunteers: help to fill all descriptions for all configs, please. For
options descriptions may be two-three words long, for items to select
they may be longer, more descriptive.

2anyone: Please, try it and send me your complains and so on. :)

    Sincerely Yours.
    Andriy.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MPlayer-20030325.diff.bz2
Type: application/x-bzip2
Size: 54156 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20030325/41184146/attachment.bin>


More information about the MPlayer-dev-eng mailing list