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.
This commit is contained in:
llyyr 2024-10-30 07:00:07 +05:30 committed by Kacper Michajłow
parent e28bfadbea
commit 5b946ac360
2 changed files with 4 additions and 3 deletions

View File

@ -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,

View File

@ -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);