[MPlayer-dev-eng] [PATCH] Flag option parse from config file

danny guru at digitalfantasy.it
Sat Aug 13 07:01:21 CEST 2005


Hi to all.

I'm trying to setup some profile or preset for mencoder / mplayer and I start 
to look at the option parsing for the config file.

You must put a  "yes" or "no" clause on the flag option, for example in the 
command line you write

	-lavcopts vcodec=mpeg4:psnr:vbitrate=1500

If you want the same thing in a config file (for example to use with -include 
<file>) you have to write

	-lavcopts vcodec=mpeg4:psnr=yes:vbitrate=1500

to have the same result.

Till here nothing wrong, it's different but ...

The bad part is that internaly the option strings (for example -oac or -ovc) 
are treated as flag so if you put in the file

     oac = copy

you get an error (option oac:copy need a parameter)

The right way to do this is to put 

	oac = copy=yes

and I don't like this very much.

Tha baddest part is that if you put

	oac = copy=no

the option copy will be active (probably because is the first) and if you put

	oac = lavc=no

will be active (always) copy.

So, to avoid a little this scenario I made this (simple) patch that, if you 
don't pass any parameter, the parser consider that you want to put yes (or 
activate the option).

In this way  you can put the same command in the file as you type on the 
command line (except, of course, for the '-'):

	oac=copy
	ovc=lavc
	lavcopts=vcodec=mpeg4:psnr:vbitrate=800

are all correct command.

I don't know if there are some reason to keep the thing as they are now, with 
this patch you get something more, you can always put a =no in the option if 
you want to deactivate.

	Daniele Forghieri



-------------- next part --------------
A non-text attachment was scrubbed...
Name: opt_file.diff
Type: text/x-diff
Size: 783 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050813/e0baf9a7/attachment.diff>


More information about the MPlayer-dev-eng mailing list