From b430c886aa33813287499df075aad8dadb6bd7b3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 21 Apr 2014 23:52:14 +0200 Subject: client API: make mpv_set_option set options natively This should fix some issues, such as not being able to set the "no-video" option with MPV_FORMAT_FLAG. Note that this changes semantics a bit. Now setting an option strictly overwrite it, even if the corresponding command line option does not. For example, if we change --sub to append by default, then setting the "sub" option via the client API would still never append. (Oddly, this also applies to --vf-add, which will overwrite the old value when using the client API.) I'm doing this because there's no proper separation between the command line parser and setting an option using the MPV_FORMAT_STRING format. Maybe the solution to this mess would be adding format aware code (i.e. m_option_set_node) to every option type, and falling back to strings only if needed - but this would mean that you couldn't set e.g. an integer option using MPV_FORMAT_STRING, which doesn't seem to be ideal either. In conclusion, the current approach seems to be most robust, but I'm open to suggestions should someone find that these semantics are a problem. --- player/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'player') diff --git a/player/client.c b/player/client.c index 9e12d75afa..afcff83f9f 100644 --- a/player/client.c +++ b/player/client.c @@ -652,7 +652,7 @@ int mpv_set_option(mpv_handle *ctx, const char *name, mpv_format format, data = &tmp; } int err = m_config_set_option_node(ctx->mpctx->mconfig, bstr0(name), - data, 0); + data); switch (err) { case M_OPT_MISSING_PARAM: case M_OPT_INVALID: -- cgit v1.2.3