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

Vladimir Voroshilov voroshil at gmail.com
Mon Sep 10 20:35:23 CEST 2007


Hi, Otvos.

2007/9/9, Ötvös Attila <oattila at chello.hu>:
> Hi All!
>
> This patch realize load/save tv config options (store -tvscan found
channels).
>
> Default config file: tv.conf
> Config file structure:
> [global]
> # tv options
> driver=v4l2
> device=/dev/video0
> tdevice=/dev/vbi0
> alsa=yes
> # ...
>
> [default]
> # default options to channels
>
> [1. BBC]
> # channels settings
> channels=e5
> freqcorr=1
>
> [2. CNN]
> freq=455250
>
> This patch need print-imgfmt-option.patch because crash in outfmt options.

>
> TV config options don't rewrite setted options in command line or config.
> saveconfig() don't store unsetted options (see saveall/nosaveall).
>
> Now, this patch don't keep remarks in config file if saved :(

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.

>+static void parse_channels_priv(tvi_handle_t *tvh)
>+{

What is this supposed to do?

>+ 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)" ?


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..

(Parsing code was not review yet).

-- 
Regards,
Vladimir Voroshilov     mailto: voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
ICQ: 95587719


More information about the MPlayer-dev-eng mailing list