From 5b946ac3606023bcfbfeb5912ce6aa5e5eac4fb2 Mon Sep 17 00:00:00 2001 From: llyyr Date: Wed, 30 Oct 2024 07:00:07 +0530 Subject: [PATCH] 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 dc3de14679..4a9700c7cd 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 8ed0f4d94d..f40e89abda 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);