Skip to content

Commit

Permalink
player: don't load encoding mode profile twice
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
llyyr committed Oct 30, 2024
1 parent 0a2f757 commit 826fbe8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 4 additions & 1 deletion player/configfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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, SECT_ENCODE, MP_INPUT_EXCLUSIVE);
}
}

static int try_load_config(struct MPContext *mpctx, const char *file, int flags,
Expand Down
2 changes: 0 additions & 2 deletions player/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 826fbe8

Please sign in to comment.