summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-03-12 14:10:37 +0100
committerwm4 <wm4@nowhere>2020-03-13 16:50:27 +0100
commitd3ad4e23088da95697ab2ec385267c06293c4515 (patch)
treed7b323780133d01cc93bec60e51700337f8bda67
parent3006c4ba5dd119160bdcf1d650c66197a44de602 (diff)
downloadmpv-d3ad4e23088da95697ab2ec385267c06293c4515.tar.bz2
mpv-d3ad4e23088da95697ab2ec385267c06293c4515.tar.xz
options: remove intpair option type
This was mostly unused, and has certain problems. Just get rid of it. It was still used in CDDA (--cdda-span) and a debug option for OpenGL (--opengl-check-pattern). Replace both of these with 2 options, where each sets the start/end values of the former span. Both were undocumented somehow (normally we require all options to be documented), so I'm not caring about compatibility, and not bothering to add it to the API changelog.
-rw-r--r--options/m_option.c53
-rw-r--r--options/m_option.h6
-rw-r--r--stream/stream_cdda.c4
-rw-r--r--video/out/opengl/context.c3
4 files changed, 5 insertions, 61 deletions
diff --git a/options/m_option.c b/options/m_option.c
index 3f01663fa9..c07601c0bf 100644
--- a/options/m_option.c
+++ b/options/m_option.c
@@ -502,59 +502,6 @@ const m_option_type_t m_option_type_byte_size = {
.equal = int64_equal,
};
-static int parse_intpair(struct mp_log *log, const struct m_option *opt,
- struct bstr name, struct bstr param, void *dst)
-{
- if (param.len == 0)
- return M_OPT_MISSING_PARAM;
-
- struct bstr s = param;
- int end = -1;
- int start = bstrtoll(s, &s, 10);
- if (s.len == param.len)
- goto bad;
- if (s.len > 0) {
- if (!bstr_startswith0(s, "-"))
- goto bad;
- s = bstr_cut(s, 1);
- }
- if (s.len > 0)
- end = bstrtoll(s, &s, 10);
- if (s.len > 0)
- goto bad;
-
- if (dst) {
- int *p = dst;
- p[0] = start;
- p[1] = end;
- }
-
- return 1;
-
-bad:
- mp_err(log, "Invalid integer range "
- "specification for option %.*s: %.*s\n",
- BSTR_P(name), BSTR_P(param));
- return M_OPT_INVALID;
-}
-
-static char *print_intpair(const m_option_t *opt, const void *val)
-{
- const int *p = val;
- char *res = talloc_asprintf(NULL, "%d", p[0]);
- if (p[1] != -1)
- res = talloc_asprintf_append(res, "-%d", p[1]);
- return res;
-}
-
-const struct m_option_type m_option_type_intpair = {
- .name = "Int[-Int]",
- .size = sizeof(int[2]),
- .parse = parse_intpair,
- .print = print_intpair,
- .copy = copy_opt,
-};
-
const char *m_opt_choice_str(const struct m_opt_choice_alternatives *choices,
int value)
{
diff --git a/options/m_option.h b/options/m_option.h
index 9eb994a5cf..9ee103bd94 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -42,7 +42,6 @@ extern const m_option_type_t m_option_type_dummy_flag;
extern const m_option_type_t m_option_type_int;
extern const m_option_type_t m_option_type_int64;
extern const m_option_type_t m_option_type_byte_size;
-extern const m_option_type_t m_option_type_intpair;
extern const m_option_type_t m_option_type_float;
extern const m_option_type_t m_option_type_double;
extern const m_option_type_t m_option_type_string;
@@ -220,7 +219,6 @@ struct m_sub_options {
#define CONF_TYPE_OBJ_SETTINGS_LIST (&m_option_type_obj_settings_list)
#define CONF_TYPE_TIME (&m_option_type_time)
#define CONF_TYPE_CHOICE (&m_option_type_choice)
-#define CONF_TYPE_INT_PAIR (&m_option_type_intpair)
#define CONF_TYPE_NODE (&m_option_type_node)
// Possible option values. Code is allowed to access option data without going
@@ -230,7 +228,6 @@ union m_option_value {
int flag; // not the C type "bool"!
int int_;
int64_t int64;
- int intpair[2];
float float_;
double double_;
char *string;
@@ -636,9 +633,6 @@ extern const char m_option_path_separator;
#define OPT_DOUBLERANGE(...) \
OPT_RANGE_(double, __VA_ARGS__, .type = &m_option_type_double)
-#define OPT_INTPAIR(...) \
- OPT_GENERAL_NOTYPE(__VA_ARGS__, .type = &m_option_type_intpair)
-
#define OPT_FLOAT(...) \
OPT_GENERAL(float, __VA_ARGS__, .type = &m_option_type_float)
diff --git a/stream/stream_cdda.c b/stream/stream_cdda.c
index 090c439987..375f1ebba3 100644
--- a/stream/stream_cdda.c
+++ b/stream/stream_cdda.c
@@ -83,8 +83,10 @@ const struct m_sub_options stream_cdda_conf = {
OPT_INT("toc-bias", toc_bias, 0),
OPT_INT("toc-offset", toc_offset, 0),
OPT_FLAG("skip", skip, 0),
- OPT_INTPAIR("span", span, 0),
+ OPT_INT("span-a", span[0], 0),
+ OPT_INT("span-b", span[1], 0),
OPT_FLAG("cdtext", cdtext, 0),
+ OPT_REMOVED("span", "use span-a/span-b"),
{0}
},
.size = sizeof(struct cdda_params),
diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c
index d9b3925983..07fa183acc 100644
--- a/video/out/opengl/context.c
+++ b/video/out/opengl/context.c
@@ -62,7 +62,8 @@ const struct m_sub_options opengl_conf = {
OPT_FLAG("opengl-glfinish", use_glfinish, 0),
OPT_FLAG("opengl-waitvsync", waitvsync, 0),
OPT_INT("opengl-swapinterval", swapinterval, 0),
- OPT_INTPAIR("opengl-check-pattern", vsync_pattern, 0),
+ OPT_INT("opengl-check-pattern-a", vsync_pattern[0], 0),
+ OPT_INT("opengl-check-pattern-b", vsync_pattern[1], 0),
OPT_INT("opengl-restrict", restrict_version, 0),
OPT_CHOICE("opengl-es", gles_mode, 0,
({"auto", GLES_AUTO}, {"yes", GLES_YES}, {"no", GLES_NO})),