options: transition options from OPT_FLAG to OPT_BOOL

c784820454 introduced a bool option type
as a replacement for the flag type, but didn't actually transition and
remove the flag type because it would have been too much mundane work.
This commit is contained in:
Christoph Heinrich
2023-02-20 04:32:50 +01:00
committed by Dudemanguy
parent b9850a6e8c
commit 91cc0d8cf6
80 changed files with 550 additions and 576 deletions

View File

@@ -91,7 +91,7 @@ typedef struct {
int cfg_devno;
int cfg_timeout;
char *cfg_file;
int cfg_full_transponder;
bool cfg_full_transponder;
int cfg_channel_switch_offset;
} dvb_opts_t;

View File

@@ -103,7 +103,7 @@ static const stream_info_t *const stream_list[] = {
struct stream_opts {
int64_t buffer_size;
int load_unsafe_playlists;
bool load_unsafe_playlists;
};
#define OPT_BASE_STRUCT struct stream_opts
@@ -112,7 +112,7 @@ const struct m_sub_options stream_conf = {
.opts = (const struct m_option[]){
{"stream-buffer-size", OPT_BYTE_SIZE(buffer_size),
M_RANGE(STREAM_MIN_BUFFER_SIZE, STREAM_MAX_BUFFER_SIZE)},
{"load-unsafe-playlists", OPT_FLAG(load_unsafe_playlists)},
{"load-unsafe-playlists", OPT_BOOL(load_unsafe_playlists)},
{0}
},
.size = sizeof(struct stream_opts),
@@ -353,8 +353,8 @@ static int stream_create_instance(const stream_info_t *sinfo,
if (flags & STREAM_LESS_NOISE)
mp_msg_set_max_level(s->log, MSGL_WARN);
int opt;
mp_read_option_raw(s->global, "access-references", &m_option_type_flag, &opt);
bool opt;
mp_read_option_raw(s->global, "access-references", &m_option_type_bool, &opt);
s->access_references = opt;
MP_VERBOSE(s, "Opening %s\n", url);

View File

@@ -67,10 +67,10 @@ typedef struct cdda_params {
int search_overlap;
int toc_bias;
int toc_offset;
int skip;
bool skip;
char *device;
int span[2];
int cdtext;
bool cdtext;
} cdda_priv;
#define OPT_BASE_STRUCT struct cdda_params
@@ -82,17 +82,17 @@ const struct m_sub_options stream_cdda_conf = {
{"overlap", OPT_INT(search_overlap), M_RANGE(0, 75)},
{"toc-bias", OPT_INT(toc_bias)},
{"toc-offset", OPT_INT(toc_offset)},
{"skip", OPT_FLAG(skip)},
{"skip", OPT_BOOL(skip)},
{"span-a", OPT_INT(span[0])},
{"span-b", OPT_INT(span[1])},
{"cdtext", OPT_FLAG(cdtext)},
{"cdtext", OPT_BOOL(cdtext)},
{"span", OPT_REMOVED("use span-a/span-b")},
{0}
},
.size = sizeof(struct cdda_params),
.defaults = &(const struct cdda_params){
.search_overlap = -1,
.skip = 1,
.skip = true,
},
};

View File

@@ -77,7 +77,7 @@ const struct m_sub_options stream_dvb_conf = {
{"card", OPT_INT(cfg_devno), M_RANGE(0, MAX_ADAPTERS-1)},
{"timeout", OPT_INT(cfg_timeout), M_RANGE(1, 30)},
{"file", OPT_STRING(cfg_file), .flags = M_OPT_FILE},
{"full-transponder", OPT_FLAG(cfg_full_transponder)},
{"full-transponder", OPT_BOOL(cfg_full_transponder)},
{"channel-switch-offset", OPT_INT(cfg_channel_switch_offset),
.flags = UPDATE_DVB_PROG},
{0}

View File

@@ -37,12 +37,12 @@
#define OPT_BASE_STRUCT struct stream_lavf_params
struct stream_lavf_params {
char **avopts;
int cookies_enabled;
bool cookies_enabled;
char *cookies_file;
char *useragent;
char *referrer;
char **http_header_fields;
int tls_verify;
bool tls_verify;
char *tls_ca_file;
char *tls_cert_file;
char *tls_key_file;
@@ -56,9 +56,9 @@ const struct m_sub_options stream_lavf_conf = {
{"http-header-fields", OPT_STRINGLIST(http_header_fields)},
{"user-agent", OPT_STRING(useragent)},
{"referrer", OPT_STRING(referrer)},
{"cookies", OPT_FLAG(cookies_enabled)},
{"cookies", OPT_BOOL(cookies_enabled)},
{"cookies-file", OPT_STRING(cookies_file), .flags = M_OPT_FILE},
{"tls-verify", OPT_FLAG(tls_verify)},
{"tls-verify", OPT_BOOL(tls_verify)},
{"tls-ca-file", OPT_STRING(tls_ca_file), .flags = M_OPT_FILE},
{"tls-cert-file", OPT_STRING(tls_cert_file), .flags = M_OPT_FILE},
{"tls-key-file", OPT_STRING(tls_key_file), .flags = M_OPT_FILE},

View File

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