Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

player: don't load encoding mode profile twice #15227

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion options/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 5 additions & 3 deletions 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 @@ -79,8 +80,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
Expand All @@ -92,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);
llyyr marked this conversation as resolved.
Show resolved Hide resolved
}
}

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
Loading