summaryrefslogtreecommitdiffstats
path: root/options/options.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-06-15 15:15:05 +0200
committerwm4 <wm4@nowhere>2017-06-15 15:23:25 +0200
commitfd7de84833a7f492678e0caa18125ff9f9aa38a5 (patch)
tree1d1d8997ca4d29576a0734b19e08ff6eeb66e743 /options/options.c
parent6489b112ad8f3edf19bc7e741980414d8e93dcbd (diff)
downloadmpv-fd7de84833a7f492678e0caa18125ff9f9aa38a5.tar.bz2
mpv-fd7de84833a7f492678e0caa18125ff9f9aa38a5.tar.xz
options: make mess to allow setting profile option with libmpv
Certain options, such as --profile, --help, and many others require special-handling, because they don't fit conceptually into the option and property model. They don't store data, but perform actions. This caused the situation that profiles could not be set when using libmpv in encoding mode (although you should probably not used libmpv in encoding mode). Using libmpv always ends up in calling m_config_set_option_raw_direct(), while --profile was handled in m_config_parse_option(). Solve this by moving the handling of this from m_config_parse_option() to m_config_set_option_raw_direct(). Actually we just stuff most of this into m_config_handle_special_options(), which is only called by the aforementioned function. Strangely this also means that the --h/--help option declarations need to be changed, because they used OPT_PRINT, and now the option "parser" is always invoked before the special code. Thus, make them a string. Them being OPT_PRINT was apparently always redundant. (The other option declarations are moved for cosmetic purposes only.) The most weird change is how co->data==NULL is handled. We now allow passing down involved options to m_config_set_option_raw_direct(). The thing is that we don't want them to error if the command line parser is using them (with special handling done there), while all other code paths should raise an error. We try using M_SETOPT_FROM_CMDLINE to distinguish these cases. Note that normal libmpv users are supposed to use the "apply-profile" command instead. This probably contains a bunch of bugs, which you should report.
Diffstat (limited to 'options/options.c')
-rw-r--r--options/options.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/options/options.c b/options/options.c
index 324a1c9a3e..1bcdc720f2 100644
--- a/options/options.c
+++ b/options/options.c
@@ -56,18 +56,11 @@
#include "video/out/opengl/hwdec.h"
#endif
-extern const char mp_help_text[];
-
static void print_version(struct mp_log *log)
{
mp_print_version(log, true);
}
-static void print_help(struct mp_log *log)
-{
- mp_info(log, "%s", mp_help_text);
-}
-
extern const struct m_sub_options tv_params_conf;
extern const struct m_sub_options stream_cdda_conf;
extern const struct m_sub_options stream_dvb_conf;
@@ -274,6 +267,12 @@ const m_option_t mp_opts[] = {
{ "list-options", CONF_TYPE_STORE, CONF_NOCFG | M_OPT_FIXED, .offset = -1},
OPT_FLAG("list-properties", property_print_help,
CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP),
+ { "help", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_FIXED, .offset = -1},
+ { "h", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_FIXED, .offset = -1},
+
+ OPT_PRINT("list-protocols", stream_print_proto_list),
+ OPT_PRINT("version", print_version),
+ OPT_PRINT("V", print_version),
OPT_CHOICE("player-operation-mode", operation_mode,
M_OPT_FIXED | M_OPT_PRE_PARSE | M_OPT_NOPROP,
@@ -704,12 +703,6 @@ const m_option_t mp_opts[] = {
OPT_SUBSTRUCT("", input_opts, input_config, 0),
- OPT_PRINT("list-protocols", stream_print_proto_list),
- OPT_PRINT("help", print_help),
- OPT_PRINT("h", print_help),
- OPT_PRINT("version", print_version),
- OPT_PRINT("V", print_version),
-
OPT_SUBSTRUCT("", vo, vo_sub_opts, 0),
OPT_SUBSTRUCT("", demux_opts, demux_conf, 0),