summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-18 19:04:30 +0100
committerwm4 <wm4@nowhere>2013-12-20 21:07:57 +0100
commit6a8fc3f5e38f93c36d18ad8407d4f3f345d893db (patch)
treead2567044e98efaad555366b2b5a2bf010e815ee /options
parent5162c2709ee9bfce15750fa47744861c50351ae5 (diff)
downloadmpv-6a8fc3f5e38f93c36d18ad8407d4f3f345d893db.tar.bz2
mpv-6a8fc3f5e38f93c36d18ad8407d4f3f345d893db.tar.xz
msg: change --msglevel, reduce legacy glue
Basically, reimplement --msglevel. Instead of making the new msg code use the legacy code, make the legacy code use the reimplemented functionality. The handling of the deprecated --identify switch changes. It temporarily stops working; this will be fixed in later commits. The actual sub-options syntax (like --msglevel-vo=...) goes away, but I bet nobody knew about this or used this anyway.
Diffstat (limited to 'options')
-rw-r--r--options/m_option.c41
-rw-r--r--options/m_option.h2
-rw-r--r--options/options.c104
-rw-r--r--options/options.h2
4 files changed, 47 insertions, 102 deletions
diff --git a/options/m_option.c b/options/m_option.c
index ba020f5375..32301b5ec3 100644
--- a/options/m_option.c
+++ b/options/m_option.c
@@ -1332,6 +1332,47 @@ const m_option_type_t m_option_type_subconfig_struct = {
.parse = parse_subconf,
};
+#undef VAL
+#define VAL(x) (*(char **)(x))
+
+static int parse_msglevels(const m_option_t *opt, struct bstr name,
+ struct bstr param, void *dst)
+{
+ if (param.start == NULL)
+ return M_OPT_MISSING_PARAM;
+
+ bstr s = param;
+ while (1) {
+ int res = mp_msg_split_msglevel(&s, &(bstr){0}, &(int){0});
+ if (res == 0)
+ break;
+ if (res < 0) {
+ mp_msg(MSGT_CFGPARSER, MSGL_ERR,
+ "Invalid syntax: %.*s\n", BSTR_P(s));
+ return M_OPT_INVALID;
+ }
+ }
+
+ if (dst) {
+ talloc_free(VAL(dst));
+ VAL(dst) = bstrdup0(NULL, param);
+ }
+
+ return 1;
+}
+
+const m_option_type_t m_option_type_msglevels = {
+ .name = "Output verbosity levels",
+ .size = sizeof(char *),
+ .flags = M_OPT_TYPE_DYNAMIC,
+ .parse = parse_msglevels,
+ .print = print_str,
+ .copy = copy_str,
+ .free = free_str,
+};
+
+#undef VAL
+
static int parse_color(const m_option_t *opt, struct bstr name,
struct bstr param, void *dst)
{
diff --git a/options/m_option.h b/options/m_option.h
index 8e3e958c63..bea7a4376a 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -48,7 +48,7 @@ extern const m_option_type_t m_option_type_string_list;
extern const m_option_type_t m_option_type_time;
extern const m_option_type_t m_option_type_rel_time;
extern const m_option_type_t m_option_type_choice;
-
+extern const m_option_type_t m_option_type_msglevels;
extern const m_option_type_t m_option_type_print;
extern const m_option_type_t m_option_type_print_func;
extern const m_option_type_t m_option_type_print_func_param;
diff --git a/options/options.c b/options/options.c
index d828df6179..fdb54ff115 100644
--- a/options/options.c
+++ b/options/options.c
@@ -190,105 +190,6 @@ static const m_option_t mfopts_conf[]={
{NULL, NULL, 0, 0, 0, 0, NULL}
};
-extern int mp_msg_levels[MSGT_MAX];
-extern int mp_msg_level_all;
-
-static const m_option_t msgl_config[]={
- { "all", &mp_msg_level_all, CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL},
-
- { "global", &mp_msg_levels[MSGT_GLOBAL], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "cplayer", &mp_msg_levels[MSGT_CPLAYER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "vo", &mp_msg_levels[MSGT_VO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "ao", &mp_msg_levels[MSGT_AO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "demuxer", &mp_msg_levels[MSGT_DEMUXER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "ds", &mp_msg_levels[MSGT_DS], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "demux", &mp_msg_levels[MSGT_DEMUX], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "header", &mp_msg_levels[MSGT_HEADER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "avsync", &mp_msg_levels[MSGT_AVSYNC], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "autoq", &mp_msg_levels[MSGT_AUTOQ], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "cfgparser", &mp_msg_levels[MSGT_CFGPARSER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "decaudio", &mp_msg_levels[MSGT_DECAUDIO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "decvideo", &mp_msg_levels[MSGT_DECVIDEO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "seek", &mp_msg_levels[MSGT_SEEK], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "win32", &mp_msg_levels[MSGT_WIN32], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "open", &mp_msg_levels[MSGT_OPEN], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "dvd", &mp_msg_levels[MSGT_DVD], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "parsees", &mp_msg_levels[MSGT_PARSEES], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "lirc", &mp_msg_levels[MSGT_LIRC], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "stream", &mp_msg_levels[MSGT_STREAM], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "cache", &mp_msg_levels[MSGT_CACHE], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "encode", &mp_msg_levels[MSGT_ENCODE], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "xacodec", &mp_msg_levels[MSGT_XACODEC], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "tv", &mp_msg_levels[MSGT_TV], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "radio", &mp_msg_levels[MSGT_RADIO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "osdep", &mp_msg_levels[MSGT_OSDEP], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "spudec", &mp_msg_levels[MSGT_SPUDEC], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "playtree", &mp_msg_levels[MSGT_PLAYTREE], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "input", &mp_msg_levels[MSGT_INPUT], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "vfilter", &mp_msg_levels[MSGT_VFILTER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "osd", &mp_msg_levels[MSGT_OSD], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "network", &mp_msg_levels[MSGT_NETWORK], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "cpudetect", &mp_msg_levels[MSGT_CPUDETECT], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "codeccfg", &mp_msg_levels[MSGT_CODECCFG], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "sws", &mp_msg_levels[MSGT_SWS], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "vobsub", &mp_msg_levels[MSGT_VOBSUB], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "subreader", &mp_msg_levels[MSGT_SUBREADER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "afilter", &mp_msg_levels[MSGT_AFILTER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "netst", &mp_msg_levels[MSGT_NETST], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "muxer", &mp_msg_levels[MSGT_MUXER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "identify", &mp_msg_levels[MSGT_IDENTIFY], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "ass", &mp_msg_levels[MSGT_ASS], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "statusline", &mp_msg_levels[MSGT_STATUSLINE], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "fixme", &mp_msg_levels[MSGT_FIXME], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- {"help", "Available msg modules:\n"
- " global - common player errors/information\n"
- " cplayer - console player (mplayer.c)\n"
- " vo - libvo\n"
- " ao - libao\n"
- " demuxer - demuxer.c (general stuff)\n"
- " ds - demux stream (add/read packet etc)\n"
- " demux - fileformat-specific stuff (demux_*.c)\n"
- " header - fileformat-specific header (*header.c)\n"
- " avsync - mplayer.c timer stuff\n"
- " autoq - mplayer.c auto-quality stuff\n"
- " cfgparser - cfgparser.c\n"
- " decaudio - av decoder\n"
- " decvideo\n"
- " seek - seeking code\n"
- " win32 - win32 dll stuff\n"
- " open - open.c (stream opening)\n"
- " dvd - open.c (DVD init/read/seek)\n"
- " parsees - parse_es.c (mpeg stream parser)\n"
- " lirc - lirc_mp.c and input lirc driver\n"
- " stream - stream.c\n"
- " cache - cache2.c\n"
- " encode - encode_lavc.c and associated vo/ao drivers\n"
- " xacodec - XAnim codecs\n"
- " tv - TV input subsystem\n"
- " osdep - OS-dependent parts\n"
- " spudec - spudec.c\n"
- " playtree - Playtree handling (playtree.c, playtreeparser.c)\n"
- " input\n"
- " vfilter\n"
- " osd\n"
- " network\n"
- " cpudetect\n"
- " codeccfg\n"
- " sws\n"
- " vobsub\n"
- " subreader\n"
- " afilter - Audio filter messages\n"
- " netst - Netstream\n"
- " muxer - muxer layer\n"
- " identify - identify output\n"
- " ass - libass messages\n"
- " statusline - playback/encoding status line\n"
- " fixme - messages not yet fixed to map to module\n"
- "\n", CONF_TYPE_PRINT, CONF_GLOBAL | CONF_NOCFG, 0, 0, NULL},
- {NULL, NULL, 0, 0, 0, 0, NULL}
-
-};
-
#if HAVE_TV
static const m_option_t tvscan_conf[]={
{"autostart", &stream_tv_defaults.scan, CONF_TYPE_FLAG, 0, 0, 1, NULL},
@@ -336,7 +237,8 @@ const m_option_t mp_opts[] = {
// ------------------------- common options --------------------
OPT_FLAG("quiet", quiet, CONF_GLOBAL),
{"really-quiet", &verbose, CONF_TYPE_STORE, CONF_GLOBAL|CONF_PRE_PARSE, 0, -10, NULL},
- {"msglevel", (void *) msgl_config, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
+ OPT_GENERAL(char*, "msglevel", msglevels, CONF_GLOBAL|CONF_PRE_PARSE,
+ .type = &m_option_type_msglevels),
{"msgcolor", &mp_msg_color, CONF_TYPE_FLAG, CONF_GLOBAL | CONF_PRE_PARSE, 0, 1, NULL},
{"msgmodule", &mp_msg_module, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
#if HAVE_PRIORITY
@@ -730,7 +632,7 @@ const m_option_t mp_opts[] = {
{"", (void *) mp_input_opts, CONF_TYPE_SUBCONFIG},
OPT_FLAG("list-properties", list_properties, CONF_GLOBAL),
- {"identify", &mp_msg_levels[MSGT_IDENTIFY], CONF_TYPE_FLAG, CONF_GLOBAL, 0, MSGL_V, NULL},
+ {"identify", &mp_smode, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
{"help", (void *) mp_help_text, CONF_TYPE_PRINT, CONF_NOCFG|CONF_GLOBAL, 0, 0, NULL},
{"h", (void *) mp_help_text, CONF_TYPE_PRINT, CONF_NOCFG|CONF_GLOBAL, 0, 0, NULL},
{"version", (void *)print_version_opt, CONF_TYPE_PRINT_FUNC, CONF_NOCFG|CONF_GLOBAL|M_OPT_PRE_PARSE},
diff --git a/options/options.h b/options/options.h
index d8f1d46488..b99c5d2746 100644
--- a/options/options.h
+++ b/options/options.h
@@ -44,6 +44,8 @@ typedef struct mp_vo_opts {
} mp_vo_opts;
typedef struct MPOpts {
+ char *msglevels;
+
char **reset_options;
char **lua_files;
int lua_load_osc;