[MPlayer-dev-eng] [PATCH] tv config in file (load/save)

Ötvös Attila oattila at chello.hu
Mon Sep 10 21:31:25 CEST 2007


2007. szeptember 10. 20.35 dátummal Vladimir Voroshilov ezt írta:

Hi Vladimir Voroshilov!

> Goo work, Otvos.
> Here are some issues (i did not make full review yet).
>
> >+#define ST_OFF(f) M_ST_OFF(tv_param_t,f)
> >+static m_option_t tv_global_opts_fields[] = {
> >+    {"immediatemode", ST_OFF(immediate), CONF_TYPE_INT,CONF_RANGE, 0, 1,
>
> NULL},
>
> >+    {"noaudio", ST_OFF(noaudio), CONF_TYPE_FLAG, 0, 0, 1, NULL},
> >[...]
> >+ {"saveall", ST_OFF(saveall), CONF_TYPE_FLAG, 0, 0, 1, NULL},
> >+ { NULL, NULL, 0, 0, 0, 0, NULL }
> >+};
>
> Is this copy of structure defined in сfg-common.h?
> Is it poosible to reuse those definition?
> I'm against this code duplication if it is possible to avoid it.

tv_global_opts_fields[] : allow in tv config file (global section)
tv_global_opts_fields_mix[]: disallow in tv config file (global section)

> >+static void parse_channels_priv(tvi_handle_t *tvh)
> >+{
>
> What is this supposed to do?

convert from channel_priv_t to tv_channels_t

> >+ int notvconfig; ///< don't use tv.conf
> >+ char *tvconfigfile; ///< config file name
> >+ char *tvconfigfilesave; ///< config file name with save
> >+ int tvconfigsave; ///< save config file if close
> >+ int saveall; ///< save all fields
> >+ void *channels_priv;
> >} tv_param_t;
>
> Is notvconfig really needed?
> Why not "notvconfig<=>(configfile==NULL)" ?

If exist tv.conf (default config file) in mplayer home dir 
(~/.mplayer/tv.conf) is use this. The notvconfig options disable usage defult 
file if exist.

>
> What about putting config file parsing code (or at least for "global"
> section) into
> stream_open of stream/stream_tv.c (before stream->priv assignement) ?
> In this case both default and assigned values for options will be available
> and duplicated structure definitions will not be needed..

Problem similar -gui options.
If order is:
1. parse ~/.mplayer/config
2. parse mplayer arguments - overwrite config
3. parse ~/.mplayer/tv.conf or other if set configfile parameter - overwrite 
config and mplayer arguments

User can't specity arguments in this case because overwrite tv.conf.

If order is:
1. parse ~/.mplayer/config
2. parse ~/.mplayer/tv.conf - overwrite config
3. parse mplayer arguments - overwrite config and tv.conf

User can't specify tv config file in this case because loadtvconfig() after 
parsing mplayer arguments where specify tv config file.

This patch:
1. parse ~/.mplayer/config to stream_tv_defaults[]
2. parse mplayer arguments to stream_tv_defaults[]
3. parse tv config file to tv_param_cfg[]
4. mix stream_tv_default[] + tv_param_cfg[] in mix_tv_param():

if stream_tv_defaults.opt == empty_tv_defaults.opt and
tv_param_cfg.opt == empty_tv_defaults.opt:
no specify config/arguments/tv.conf -> overwrite tv_defaults.opt

if stream_tv_defaults.opt == empty_tv_defaults.opt and
tv_param_cfg.opt != empty_tv_defaults.opt:
specify only tv.conf -> overwrite tv_param_cfg.opt

if stream_tv_defaults.opt != empty_tv_defaults.opt:
specify config/argumnets -> drop specify in tv.conf 

Best regard.
Attila



More information about the MPlayer-dev-eng mailing list