Skip to content

Commit

Permalink
various: upgrade option flags to uint64_t
Browse files Browse the repository at this point in the history
So that they will already work after more UPDATE flags are added.
change_flags in m_config_core.h was already uint64_t.

Co-authored-by: Kacper Michajłow <[email protected]>
  • Loading branch information
guidocella and kasper93 committed Dec 8, 2024
1 parent bba54b5 commit 1c679ef
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion options/m_config_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ const char *m_config_get_positional_option(const struct m_config *config, int p)
static int handle_set_opt_flags(struct m_config *config,
struct m_config_option *co, int flags)
{
int optflags = co->opt->flags;
uint64_t optflags = co->opt->flags;
bool set = !(flags & M_SETOPT_CHECK_ONLY);

if ((flags & M_SETOPT_PRE_PARSE_ONLY) && !(optflags & M_OPT_PRE_PARSE))
Expand Down
2 changes: 1 addition & 1 deletion options/m_config_frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ typedef struct m_config {
// m_config_notify_change_opt_ptr(). If false, it's caused either by
// m_config_set_option_*() (and similar) calls or external updates.
void (*option_change_callback)(void *ctx, struct m_config_option *co,
int flags, bool self_update);
uint64_t flags, bool self_update);
void *option_change_callback_ctx;

// For the command line parser
Expand Down
4 changes: 2 additions & 2 deletions options/m_option.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ struct m_sub_options {
const void *defaults;
// Change flags passed to mp_option_change_callback() if any option that is
// directly or indirectly part of this group is changed.
int change_flags;
uint64_t change_flags;
// Return further sub-options, for example for optional components. If set,
// this is called with increasing index (starting from 0), as long as true
// is returned. If true is returned and *sub is set in any of these calls,
Expand Down Expand Up @@ -385,7 +385,7 @@ struct m_option {
const m_option_type_t *type;

// See \ref OptionFlags.
unsigned int flags;
uint64_t flags;

// Always force an option update even if the written value does not change.
bool force_update;
Expand Down
5 changes: 2 additions & 3 deletions player/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -7598,7 +7598,7 @@ static void update_track_switch(struct MPContext *mpctx, int order, int type)
mp_wakeup_core(mpctx);
}

void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags,
void mp_option_change_callback(void *ctx, struct m_config_option *co, uint64_t flags,
bool self_update)
{
struct MPContext *mpctx = ctx;
Expand All @@ -7622,8 +7622,7 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags,
struct track *track = mpctx->current_track[n][STREAM_SUB];
struct dec_sub *sub = track ? track->d_sub : NULL;
if (sub) {
int ret = sub_control(sub, SD_CTRL_UPDATE_OPTS,
(void *)(uintptr_t)flags);
int ret = sub_control(sub, SD_CTRL_UPDATE_OPTS, &flags);
if (ret == CONTROL_OK && flags & (UPDATE_SUB_FILT | UPDATE_SUB_HARD)) {
sub_redecode_cached_packets(sub);
sub_reset(sub);
Expand Down
2 changes: 1 addition & 1 deletion player/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void property_print_help(struct MPContext *mpctx);
int mp_property_do(const char* name, int action, void* val,
struct MPContext *mpctx);

void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags,
void mp_option_change_callback(void *ctx, struct m_config_option *co, uint64_t flags,
bool self_update);

void mp_notify(struct MPContext *mpctx, int event, void *arg);
Expand Down
2 changes: 1 addition & 1 deletion sub/dec_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ int sub_control(struct dec_sub *sub, enum sd_ctrl cmd, void *arg)
break;
}
case SD_CTRL_UPDATE_OPTS: {
int flags = (uintptr_t)arg;
uint64_t flags = *(uint64_t *)arg;
if (m_config_cache_update(sub->opts_cache))
update_subtitle_speed(sub);
m_config_cache_update(sub->shared_opts_cache);
Expand Down
2 changes: 1 addition & 1 deletion sub/sd_ass.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ static int control(struct sd *sd, enum sd_ctrl cmd, void *arg)
ctx->video_params = *(struct mp_image_params *)arg;
return CONTROL_OK;
case SD_CTRL_UPDATE_OPTS: {
int flags = (uintptr_t)arg;
uint64_t flags = *(uint64_t *)arg;
if (flags & UPDATE_SUB_FILT) {
filters_destroy(sd);
filters_init(sd);
Expand Down

0 comments on commit 1c679ef

Please sign in to comment.