summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-04-02 23:54:08 +0200
committerwm4 <wm4@nowhere>2015-04-02 23:54:08 +0200
commit5a2825ec35446ae2127c0fb204203cd09738c4ed (patch)
tree90e24f12b16912e1ce2894f28839e716653066d2 /video
parent19f56e20979d1dbbb4b9956c955d4d0fa27516aa (diff)
downloadmpv-5a2825ec35446ae2127c0fb204203cd09738c4ed.tar.bz2
mpv-5a2825ec35446ae2127c0fb204203cd09738c4ed.tar.xz
video: cleanup stereo mode parsing
Use OPT_CHOICE_C() instead of the custom parser. The functionality is pretty much equivalent. (On a side note, it seems --video-stereo-mode can't be removed, because it controls whether to "reduce" stereo video to mono, which is also the default. In fact I'm not sure how this should be handled at all.)
Diffstat (limited to 'video')
-rw-r--r--video/csputils.c33
-rw-r--r--video/csputils.h6
-rw-r--r--video/filter/vf_stereo3d.c2
3 files changed, 20 insertions, 21 deletions
diff --git a/video/csputils.c b/video/csputils.c
index f8613399c8..3282e3b8ed 100644
--- a/video/csputils.c
+++ b/video/csputils.c
@@ -93,25 +93,24 @@ const struct m_opt_choice_alternatives mp_chroma_names[] = {
};
// The short name _must_ match with what vf_stereo3d accepts (if supported).
-// The long name is closer to the Matroska spec (StereoMode element).
+// The long name in comments is closer to the Matroska spec (StereoMode element).
// The numeric index matches the Matroska StereoMode value. If you add entries
// that don't match Matroska, make sure demux_mkv.c rejects them properly.
-// The long name is unused.
-#define E(index, short, long) [index] = short
-const char *const mp_stereo3d_names[MP_STEREO3D_COUNT] = {
- E(0, "mono", "mono"), // unsupported by vf_stereo3d
- E(1, "sbs2l", "side_by_side_left"),
- E(2, "ab2r", "top_bottom_right"),
- E(3, "ab2l", "top_bottom_left"),
- E(4, "checkr", "checkboard_right"), // unsupported by vf_stereo3d
- E(5, "checkl", "checkboard_left"), // unsupported by vf_stereo3d
- E(6, "irr", "row_interleaved_right"),
- E(7, "irl", "row_interleaved_left"),
- E(8, "icr", "column_interleaved_right"),// unsupported by vf_stereo3d
- E(9, "icl", "column_interleaved_left"), // unsupported by vf_stereo3d
- E(10, "arcc", "anaglyph_cyan_red"), // Matroska: unclear which mode
- E(11, "sbs2r", "side_by_side_right"),
- E(12, "agmc", "anaglyph_green_magenta"), // Matroska: unclear which mode
+const struct m_opt_choice_alternatives mp_stereo3d_names[] = {
+ {"mono", 0},
+ {"sbs2l", 1}, // "side_by_side_left"
+ {"ab2r", 2}, // "top_bottom_right"
+ {"ab2l", 3}, // "top_bottom_left"
+ {"checkr", 4}, // "checkboard_right" (unsupported by vf_stereo3d)
+ {"checkl", 5}, // "checkboard_left" (unsupported by vf_stereo3d)
+ {"irr", 6}, // "row_interleaved_right"
+ {"irl", 7}, // "row_interleaved_left"
+ {"icr", 8}, // "column_interleaved_right" (unsupported by vf_stereo3d)
+ {"icl", 9}, // "column_interleaved_left" (unsupported by vf_stereo3d)
+ {"arcc", 10}, // "anaglyph_cyan_red" (Matroska: unclear which mode)
+ {"sbs2r", 11}, // "side_by_side_right"
+ {"agmc", 12}, // "anaglyph_green_magenta" (Matroska: unclear which mode)
+ {0}
};
enum mp_csp avcol_spc_to_mp_csp(int avcolorspace)
diff --git a/video/csputils.h b/video/csputils.h
index 14acf03be5..449d883ecb 100644
--- a/video/csputils.h
+++ b/video/csputils.h
@@ -104,10 +104,10 @@ enum mp_stereo3d_mode {
MP_STEREO3D_COUNT = 13, // 12 is last valid mode
};
-extern const char *const mp_stereo3d_names[MP_STEREO3D_COUNT];
+extern const struct m_opt_choice_alternatives mp_stereo3d_names[];
+
+#define MP_STEREO3D_NAME(x) m_opt_choice_str(mp_stereo3d_names, x)
-#define MP_STEREO3D_NAME(x) \
- ((x) >= 0 && (x) < MP_STEREO3D_COUNT ? (char *)mp_stereo3d_names[(x)] : NULL)
#define MP_STEREO3D_NAME_DEF(x, def) \
(MP_STEREO3D_NAME(x) ? MP_STEREO3D_NAME(x) : (def))
diff --git a/video/filter/vf_stereo3d.c b/video/filter/vf_stereo3d.c
index 21a171aeda..761e3b684d 100644
--- a/video/filter/vf_stereo3d.c
+++ b/video/filter/vf_stereo3d.c
@@ -468,7 +468,7 @@ static const char *rev_map_name(int val)
}
// Extremely stupid; can be dropped when the internal filter is dropped,
-// and OPT_VID_STEREO_MODE() can be used instead.
+// and OPT_CHOICE_C() can be used instead.
static int opt_to_stereo3dmode(int val)
{
// Find x for rev_map_name(val) == MP_STEREO3D_NAME(x)