From 0a2f757fae1c55c07ccb28a2cabb63d2f4d9d633 Mon Sep 17 00:00:00 2001 From: llyyr Date: Wed, 30 Oct 2024 06:59:17 +0530 Subject: [PATCH 1/2] options: remove stale comment about encoding mode being compiled-in Encoding mode used to be a compile time option, but now it's always compiled in. --- options/options.h | 1 - player/configfiles.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/options/options.h b/options/options.h index 8e9eee7de667d..35354f07f9699 100644 --- a/options/options.h +++ b/options/options.h @@ -373,7 +373,6 @@ typedef struct MPOpts { struct input_opts *input_opts; - // may be NULL if encoding is not compiled-in struct encode_opts *encode_opts; char *ipc_path; diff --git a/player/configfiles.c b/player/configfiles.c index b48c857b35cb6..dc3de1467959f 100644 --- a/player/configfiles.c +++ b/player/configfiles.c @@ -79,8 +79,7 @@ void mp_parse_cfgfiles(struct MPContext *mpctx) talloc_free(p2); char *section = NULL; - bool encoding = opts->encode_opts && - opts->encode_opts->file && opts->encode_opts->file[0]; + bool encoding = opts->encode_opts->file && opts->encode_opts->file[0]; // In encoding mode, we don't want to apply normal config options. // So we "divert" normal options into a separate section, and the diverted // section is never used - unless maybe it's explicitly referenced from an From 9944a818a2d9dce7ec55816f2c5c3255529158c1 Mon Sep 17 00:00:00 2001 From: llyyr Date: Wed, 30 Oct 2024 07:00:07 +0530 Subject: [PATCH 2/2] player: don't load encoding mode profile twice Also move the loading of profiles and input section activation in one place. Leaving this in mp_initialize has the drawback that encoding section profile will overwrite options set by the user in the command line, since it's set after the CLI options are parsed and processed. mp_parse_cfgfiles happens before parsing the CLI, so loading the profile there is better. --- player/configfiles.c | 5 ++++- player/main.c | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/player/configfiles.c b/player/configfiles.c index dc3de1467959f..4a9700c7cdbaa 100644 --- a/player/configfiles.c +++ b/player/configfiles.c @@ -44,6 +44,7 @@ #include "common/playlist.h" #include "options/options.h" #include "options/m_property.h" +#include "input/input.h" #include "stream/stream.h" @@ -91,8 +92,10 @@ void mp_parse_cfgfiles(struct MPContext *mpctx) load_all_cfgfiles(mpctx, section, "mpv.conf|config"); - if (encoding) + if (encoding) { m_config_set_profile(mpctx->mconfig, SECT_ENCODE, 0); + mp_input_enable_section(mpctx->input, "encode", MP_INPUT_EXCLUSIVE); + } } static int try_load_config(struct MPContext *mpctx, const char *file, int flags, diff --git a/player/main.c b/player/main.c index 8ed0f4d94df34..f40e89abda322 100644 --- a/player/main.c +++ b/player/main.c @@ -415,8 +415,6 @@ int mp_initialize(struct MPContext *mpctx, char **options) MP_INFO(mpctx, "Encoding initialization failed.\n"); return -1; } - m_config_set_profile(mpctx->mconfig, "encoding", 0); - mp_input_enable_section(mpctx->input, "encode", MP_INPUT_EXCLUSIVE); } mp_load_scripts(mpctx);