[MPlayer-dev-eng] [PATCH] list_options valid for MEncoder

Diego Biurrun diego at biurrun.de
Sat Jan 14 02:47:06 CET 2006


On Mon, Jan 09, 2006 at 05:54:28PM +0100, Danny - liste wrote:
> Diego Biurrun wrote:
> >On Mon, Jan 09, 2006 at 09:02:59AM +0100, Danny - liste wrote:
> >  
> >>Working on a profile support for MEncoder I find useful have the 
> >>-list-options avaible also for MEncoder and not only for MPlayer and I 
> >>made this little patch.
> >>
> >>--- orig/parser-mecmd.c	2006-01-01 02:19:25.000000000 +0100
> >>+++ main/parser-mecmd.c	2006-01-08 20:09:35.902161608 +0100
> >>@@ -85,6 +85,12 @@
> >> 	/* remove trailing '-' */
> >> 	opt++;
> >> 	mp_msg(MSGT_CFGPARSER, MSGL_DBG3, "this_opt = option: %s\n", opt);
> >>+
> >>+        if(strcasecmp(opt,"list-options") == 0) {
> >>+	  m_config_print_option_list(config);
> >>+         exit(1);
> >>+        } else {
> >
> >Hmm, this just duplicates the code from parser-mpcmd.c.  Isn't there a
> >cleaner solution?
> 
>    1. Make a function that prints the option ( list_options( m_option_t
> *config) ) and use the standard option handling adding in the common
> options a line with:
>        {"list-options",  list_options, CONF_TYPE_FUNC, CONF_GLOBAL |
> CONF_NOSAVE, 0, 0, NULL},
> 
>    2. Make a function that handle the common part and return 0 if the
> caller must process the option (but only for this option is too much work).
> 
>    The code duplication seems so small that other solutions may be too
> expensive ;)

Yes, the code duplication is very small.  Feel free to commit, but
please add a comment indicating the duplication to both instances of the
code.

Diego




More information about the MPlayer-dev-eng mailing list