summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-02-21 22:51:34 +0100
committerwm4 <wm4@nowhere>2013-02-23 00:07:11 +0100
commit09fa666bfc0b533f9b2dc59f738c5cbe5c2b72a8 (patch)
tree03ea8160e4bfb3dbc035721630191d3c0a6b8d64
parent67df52ae737c7e6a488b134c566ff137841b5f0b (diff)
downloadmpv-09fa666bfc0b533f9b2dc59f738c5cbe5c2b72a8.tar.bz2
mpv-09fa666bfc0b533f9b2dc59f738c5cbe5c2b72a8.tar.xz
vf_stereo3d: get rid of m_obj_presets_t usage
The code becomes amazingly simpler.
-rw-r--r--video/filter/vf_stereo3d.c52
1 files changed, 3 insertions, 49 deletions
diff --git a/video/filter/vf_stereo3d.c b/video/filter/vf_stereo3d.c
index 3b16cf6d8a..956d6302d0 100644
--- a/video/filter/vf_stereo3d.c
+++ b/video/filter/vf_stereo3d.c
@@ -409,11 +409,7 @@ static int vf_open(vf_instance_t *vf, char *args)
return 1;
}
-///Presets usage
-static const struct format_preset {
- char* name;
- stereo_code scode;
-} vf_format_presets_defs[] = {
+const struct m_opt_choice_alternatives stereo_code_names[] = {
{"arcg", ANAGLYPH_RC_GRAY},
{"anaglyph_red_cyan_gray", ANAGLYPH_RC_GRAY},
{"arch", ANAGLYPH_RC_HALF},
@@ -465,53 +461,11 @@ static const struct format_preset {
{ NULL, 0}
};
-#define ST_OFF(f) M_ST_OFF(struct format_preset,f)
-static const m_option_t vf_format_preset_fields_in[] = {
- {"in", ST_OFF(scode), CONF_TYPE_INT, 0,0,0, NULL},
- { NULL, NULL, 0, 0, 0, 0, NULL }
-};
-static const m_option_t vf_format_preset_fields_out[] = {
- {"out", ST_OFF(scode), CONF_TYPE_INT, 0,0,0, NULL},
- { NULL, NULL, 0, 0, 0, 0, NULL }
-};
-
-static const m_struct_t vf_format_preset_in = {
- "stereo_format_preset_in",
- sizeof(struct format_preset),
- NULL,
- vf_format_preset_fields_in
-};
-static const m_struct_t vf_format_preset_out = {
- "stereo_format_preset_out",
- sizeof(struct format_preset),
- NULL,
- vf_format_preset_fields_out
-};
-
-static const m_struct_t vf_opts;
-static const m_obj_presets_t format_preset_in = {
- (struct m_struct_st*)&vf_format_preset_in,
- (struct m_struct_st*)&vf_opts,
- (struct format_preset*)vf_format_presets_defs,
- ST_OFF(name)
-};
-static const m_obj_presets_t format_preset_out = {
- (struct m_struct_st*)&vf_format_preset_out,
- (struct m_struct_st*)&vf_opts,
- (struct format_preset*)vf_format_presets_defs,
- ST_OFF(name)
-};
-
-/// Now the options
#undef ST_OFF
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
static const m_option_t vf_opts_fields[] = {
- {"stereo_in", 0, CONF_TYPE_OBJ_PRESETS, 0, 0, 0,
- (m_obj_presets_t*)&format_preset_in},
- {"stereo_out", 0, CONF_TYPE_OBJ_PRESETS, 0, 0, 0,
- (m_obj_presets_t*)&format_preset_out},
- {"in", ST_OFF(in.fmt), CONF_TYPE_INT, 0,0,0, NULL},
- {"out", ST_OFF(out.fmt), CONF_TYPE_INT, 0,0,0, NULL},
+ {"in", ST_OFF(in.fmt), CONF_TYPE_CHOICE, .priv = (void *)stereo_code_names},
+ {"out", ST_OFF(out.fmt), CONF_TYPE_CHOICE, .priv = (void *)stereo_code_names},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};