summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-10-24 22:20:16 +0200
committerwm4 <wm4@nowhere>2013-10-24 22:50:13 +0200
commit60aea74f4483661e34b12571add07f8e5e136660 (patch)
treec1b0c94cbb926785cec0e56d7bd50fa18e9f4457 /video
parentf6bceacaff0d2e1a1265d29372fcf7b34c57446c (diff)
downloadmpv-60aea74f4483661e34b12571add07f8e5e136660.tar.bz2
mpv-60aea74f4483661e34b12571add07f8e5e136660.tar.xz
m_config: refactor option defaults handling
Keep track of the default values directly, instead of creating a new instance of the option struct just to get the defaults. Also get rid of the special handling of m_obj_desc.init_options. Instead, handle it purely by the option parser. Originally, I wanted to handle --vo=opengl-hq and --vo=direct3d_shaders with this (by making them aliases to the real VOs with a different preset), but since --vo =opengl-hq=help prints the wrong values (as consequence of the simplification), I'm not doing that, and instead use something different.
Diffstat (limited to 'video')
-rw-r--r--video/out/gl_video.c10
-rw-r--r--video/out/gl_video.h1
-rw-r--r--video/out/vo.c1
-rw-r--r--video/out/vo.h3
-rw-r--r--video/out/vo_direct3d.c10
-rw-r--r--video/out/vo_opengl.c11
6 files changed, 26 insertions, 10 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index 8bab6a5c4c..603f334c9b 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -275,6 +275,16 @@ static const struct gl_video_opts gl_video_opts_def = {
.alpha_mode = 2,
};
+const struct gl_video_opts gl_video_opts_hq_def = {
+ .npot = 1,
+ .dither_depth = 0,
+ .dither_size = 6,
+ .fbo_format = GL_RGB16,
+ .scale_sep = 1,
+ .scalers = { "lanczos2", "bilinear" },
+ .scaler_params = {NAN, NAN},
+ .alpha_mode = 2,
+};
static int validate_scaler_opt(const m_option_t *opt, struct bstr name,
struct bstr param);
diff --git a/video/out/gl_video.h b/video/out/gl_video.h
index 3b21edc223..dcec9f3888 100644
--- a/video/out/gl_video.h
+++ b/video/out/gl_video.h
@@ -49,6 +49,7 @@ struct gl_video_opts {
};
extern const struct m_sub_options gl_video_conf;
+extern const struct gl_video_opts gl_video_opts_hq_def;
struct gl_video;
diff --git a/video/out/vo.c b/video/out/vo.c
index b29e3f7c95..061fc9caf3 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -123,7 +123,6 @@ static bool get_desc(struct m_obj_desc *dst, int index)
.priv_size = vo->priv_size,
.priv_defaults = vo->priv_defaults,
.options = vo->options,
- .init_options = vo->init_option_string,
.hidden = vo->encode,
.p = vo,
};
diff --git a/video/out/vo.h b/video/out/vo.h
index 57d5cfb6d0..1777245c96 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -216,9 +216,6 @@ struct vo_driver {
// List of options to parse into priv struct (requires privsize to be set)
const struct m_option *options;
-
- // Parse these options before parsing user options
- const char *init_option_string;
};
struct vo {
diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c
index 9ad2322499..cd440f89f6 100644
--- a/video/out/vo_direct3d.c
+++ b/video/out/vo_direct3d.c
@@ -1720,6 +1720,13 @@ static const struct m_option opts[] = {
{0}
};
+static const d3d_priv defaults_noshaders = {
+ .colorspace = MP_CSP_DETAILS_DEFAULTS,
+ .video_eq = { MP_CSP_EQ_CAPS_COLORMATRIX },
+ .opt_disable_shaders = 1,
+ .opt_disable_textures = 1,
+};
+
static const d3d_priv defaults = {
.colorspace = MP_CSP_DETAILS_DEFAULTS,
.video_eq = { MP_CSP_EQ_CAPS_COLORMATRIX },
@@ -1737,9 +1744,8 @@ const struct vo_driver video_out_direct3d = {
.flip_page = flip_page,
.uninit = uninit,
.priv_size = sizeof(d3d_priv),
- .priv_defaults = &defaults,
+ .priv_defaults = &defaults_noshaders,
.options = opts,
- .init_option_string = "disable-shaders:disable-textures",
};
const struct vo_driver video_out_direct3d_shaders = {
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c
index e1c07d8621..cf1b3b3400 100644
--- a/video/out/vo_opengl.c
+++ b/video/out/vo_opengl.c
@@ -200,9 +200,10 @@ static bool reparse_cmdline(struct gl_priv *p, char *args)
if (strcmp(args, "-") == 0) {
opts = p->renderer_opts;
} else {
- cfg = m_config_new(NULL, sizeof(*opts), gl_video_conf.defaults,
- gl_video_conf.opts,
- p->vo->driver->init_option_string);
+ const struct gl_priv *vodef = p->vo->driver->priv_defaults;
+ const struct gl_video_opts *def =
+ vodef ? vodef->renderer_opts : gl_video_conf.defaults;
+ cfg = m_config_new(NULL, sizeof(*opts), def, gl_video_conf.opts);
opts = cfg->optstruct;
r = m_config_parse_suboptions(cfg, "opengl", args);
}
@@ -376,6 +377,8 @@ const struct vo_driver video_out_opengl_hq = {
.flip_page = flip_page,
.uninit = uninit,
.priv_size = sizeof(struct gl_priv),
+ .priv_defaults = &(const struct gl_priv){
+ .renderer_opts = (struct gl_video_opts *)&gl_video_opts_hq_def,
+ },
.options = options,
- .init_option_string = "lscale=lanczos2:dither-depth=auto:fbo-format=rgb16",
};