options: transition commands from OPT_FLAG to OPT_BOOL

This commit is contained in:
Christoph Heinrich 2023-02-20 06:44:22 +01:00 committed by Dudemanguy
parent 91cc0d8cf6
commit 4ebfe9851c
13 changed files with 27 additions and 19 deletions

View File

@ -461,6 +461,7 @@ const struct ao_driver audio_out_coreaudio_exclusive = {
.hog_pid = -1,
.stream = 0,
.stream_idx = -1,
.changed_mixing = false,
},
.options = (const struct m_option[]){
{"spdif-hack", OPT_BOOL(spdif_hack)},

View File

@ -404,5 +404,6 @@ const struct ao_driver audio_out_oss = {
.priv_size = sizeof(struct priv),
.priv_defaults = &(const struct priv) {
.dsp_fd = -1,
.playing = false,
},
};

View File

@ -693,6 +693,7 @@ struct mp_hwdec_ctx *mp_filter_load_hwdec_device(struct mp_filter *f, int imgfmt
struct hwdec_imgfmt_request params = {
.imgfmt = imgfmt,
.probing = false,
};
hwdec_devices_request_for_img_fmt(info->hwdec_devs, &params);

View File

@ -85,6 +85,7 @@ enum mp_cmd_flags {
struct mp_cmd_arg {
const struct m_option *type;
union {
bool b;
int i;
int64_t i64;
float f;

View File

@ -1474,6 +1474,7 @@ void mp_input_bind_key(struct input_ctx *ictx, int key, bstr command)
.cmd = bstrdup0(bs->binds, command),
.location = talloc_strdup(bs->binds, "keybind-command"),
.owner = bs,
.is_builtin = false,
.num_keys = 1,
};
memcpy(bind->keys, &key, 1 * sizeof(bind->keys[0]));

View File

@ -4574,8 +4574,8 @@ static void cmd_osd_overlay(void *p)
.res_x = cmd->args[3].v.i,
.res_y = cmd->args[4].v.i,
.z = cmd->args[5].v.i,
.hidden = cmd->args[6].v.i,
.out_rc = cmd->args[7].v.i ? rc : NULL,
.hidden = cmd->args[6].v.b,
.out_rc = cmd->args[7].v.b ? rc : NULL,
};
osd_set_external(mpctx->osd, &ov);
@ -5516,7 +5516,7 @@ static void cmd_track_add(void *p)
struct MPContext *mpctx = cmd->mpctx;
int type = *(int *)cmd->priv;
bool is_albumart = type == STREAM_VIDEO &&
cmd->args[4].v.i;
cmd->args[4].v.b;
if (mpctx->stop_play) {
cmd->success = false;
@ -5694,11 +5694,11 @@ static void cmd_subprocess(void *p)
struct mp_cmd_ctx *cmd = p;
struct MPContext *mpctx = cmd->mpctx;
char **args = cmd->args[0].v.str_list;
bool playback_only = cmd->args[1].v.i;
bool detach = cmd->args[5].v.i;
bool playback_only = cmd->args[1].v.b;
bool detach = cmd->args[5].v.b;
char **env = cmd->args[6].v.str_list;
bstr stdin_data = bstr0(cmd->args[7].v.s);
bool passthrough_stdin = cmd->args[8].v.i;
bool passthrough_stdin = cmd->args[8].v.b;
if (env && !env[0])
env = NULL; // do not actually set an empty environment
@ -5727,8 +5727,8 @@ static void cmd_subprocess(void *p)
.msgl = fd == 2 ? MSGL_ERR : MSGL_INFO,
};
}
fdctx[1].capture = cmd->args[3].v.i;
fdctx[2].capture = cmd->args[4].v.i;
fdctx[1].capture = cmd->args[3].v.b;
fdctx[2].capture = cmd->args[4].v.b;
pthread_mutex_lock(&mpctx->abort_lock);
cmd->abort->coupled_to_playback = playback_only;
@ -6367,7 +6367,7 @@ const struct mp_cmd_def mp_cmds[] = {
.flags = MP_CMD_OPT_ARG},
{"title", OPT_STRING(v.s), .flags = MP_CMD_OPT_ARG},
{"lang", OPT_STRING(v.s), .flags = MP_CMD_OPT_ARG},
{"albumart", OPT_FLAG(v.i), .flags = MP_CMD_OPT_ARG},
{"albumart", OPT_BOOL(v.b), .flags = MP_CMD_OPT_ARG},
},
.priv = &(const int){STREAM_VIDEO},
.spawn_thread = true,
@ -6485,15 +6485,15 @@ const struct mp_cmd_def mp_cmds[] = {
{ "subprocess", cmd_subprocess,
{
{"args", OPT_STRINGLIST(v.str_list)},
{"playback_only", OPT_FLAG(v.i), OPTDEF_INT(1)},
{"playback_only", OPT_BOOL(v.b), OPTDEF_INT(1)},
{"capture_size", OPT_BYTE_SIZE(v.i64), M_RANGE(0, INT_MAX),
OPTDEF_INT64(64 * 1024 * 1024)},
{"capture_stdout", OPT_FLAG(v.i), .flags = MP_CMD_OPT_ARG},
{"capture_stderr", OPT_FLAG(v.i), .flags = MP_CMD_OPT_ARG},
{"detach", OPT_FLAG(v.i), .flags = MP_CMD_OPT_ARG},
{"capture_stdout", OPT_BOOL(v.b), .flags = MP_CMD_OPT_ARG},
{"capture_stderr", OPT_BOOL(v.b), .flags = MP_CMD_OPT_ARG},
{"detach", OPT_BOOL(v.b), .flags = MP_CMD_OPT_ARG},
{"env", OPT_STRINGLIST(v.str_list), .flags = MP_CMD_OPT_ARG},
{"stdin_data", OPT_STRING(v.s), .flags = MP_CMD_OPT_ARG},
{"passthrough_stdin", OPT_FLAG(v.i), .flags = MP_CMD_OPT_ARG},
{"passthrough_stdin", OPT_BOOL(v.b), .flags = MP_CMD_OPT_ARG},
},
.spawn_thread = true,
.can_abort = true,
@ -6596,8 +6596,8 @@ const struct mp_cmd_def mp_cmds[] = {
{"res_x", OPT_INT(v.i), OPTDEF_INT(0)},
{"res_y", OPT_INT(v.i), OPTDEF_INT(720)},
{"z", OPT_INT(v.i), OPTDEF_INT(0)},
{"hidden", OPT_FLAG(v.i), OPTDEF_INT(0)},
{"compute_bounds", OPT_FLAG(v.i), OPTDEF_INT(0)},
{"hidden", OPT_BOOL(v.b), OPTDEF_INT(0)},
{"compute_bounds", OPT_BOOL(v.b), OPTDEF_INT(0)},
},
.is_noisy = true,
},

View File

@ -177,4 +177,5 @@ const stream_info_t stream_info_slice = {
.name = "slice",
.open2 = open2,
.protocols = (const char*const[]){ "slice", NULL },
.can_write = false,
};

View File

@ -429,6 +429,7 @@ static struct mp_filter *vf_d3d11vpp_create(struct mp_filter *parent,
struct hwdec_imgfmt_request params = {
.imgfmt = IMGFMT_D3D11,
.probing = false,
};
hwdec_devices_request_for_img_fmt(info->hwdec_devs, &params);

View File

@ -221,6 +221,7 @@ static bool d3d11_start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo)
*out_fbo = (struct ra_fbo) {
.tex = p->backbuffer,
.flip = false,
.color_space = p->swapchain_csp
};
return true;

View File

@ -37,8 +37,7 @@ const struct m_sub_options d3d11va_conf = {
{"d3d11va-zero-copy", OPT_BOOL(zero_copy)},
{0}
},
.defaults = &(const struct d3d11va_opts) {
},
.defaults = &(const struct d3d11va_opts) {0},
.size = sizeof(struct d3d11va_opts)
};

View File

@ -170,6 +170,7 @@ static bool parse_hook(struct mp_log *log, struct bstr *body,
*out = (struct gl_user_shader_hook){
.pass_desc = bstr0("(unknown)"),
.offset = identity_trans,
.align_offset = false,
.width = {{ SZEXP_VAR_W, { .varname = bstr0("HOOKED") }}},
.height = {{ SZEXP_VAR_H, { .varname = bstr0("HOOKED") }}},
.cond = {{ SZEXP_CONST, { .cval = 1.0 }}},

View File

@ -25,7 +25,6 @@
#include <libavutil/common.h>
#include <libavutil/lfg.h>
#include "options/m_option.h"
#include "video.h"
#include "misc/bstr.h"

View File

@ -153,6 +153,7 @@ bool mppl_wrap_tex(struct ra *ra, pl_tex pltex, struct ra_tex *out_tex)
.downloadable = pltex->params.host_readable,
// These don't exist upstream, so just pick something reasonable
.src_linear = pltex->params.format->caps & PL_FMT_CAP_LINEAR,
.src_repeat = false,
},
.priv = (void *) pltex,
};