aboutsummaryrefslogtreecommitdiffhomepage
path: root/options
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2015-07-07 14:25:37 +0200
committerGravatar wm4 <wm4@nowhere>2015-07-07 15:05:32 +0200
commit1d29177c5c150e700cace0c875185c6fa5e92d3c (patch)
treec1ccbcfbbfb607120bbc14bab3f98768dd3b2f77 /options
parentdc33eb56f4ae28b75ddc4127bd9e766606096c25 (diff)
options: cleanup hwdec name mappings
Now there's a "canonical" table for mapping the names, that other code can use, without having to rely too much on option code magic. Also, use the central HWDEC constants, instead of magic values. (There used to be semi-ok reasons to do this, but now it makes no sense anymore.)
Diffstat (limited to 'options')
-rw-r--r--options/options.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/options/options.c b/options/options.c
index 4ba2db1590..d286e5b63c 100644
--- a/options/options.c
+++ b/options/options.c
@@ -38,6 +38,7 @@
#include "common/common.h"
#include "stream/stream.h"
#include "video/csputils.h"
+#include "video/hwdec.h"
#include "sub/osd.h"
#include "audio/mixer.h"
#include "audio/filter/af.h"
@@ -79,6 +80,18 @@ extern const struct m_obj_list af_obj_list;
extern const struct m_obj_list vo_obj_list;
extern const struct m_obj_list ao_obj_list;
+const struct m_opt_choice_alternatives mp_hwdec_names[] = {
+ {"no", HWDEC_NONE},
+ {"auto", HWDEC_AUTO},
+ {"vdpau", HWDEC_VDPAU},
+ {"vda", HWDEC_VDA},
+ {"vaapi", HWDEC_VAAPI},
+ {"vaapi-copy", HWDEC_VAAPI_COPY},
+ {"dxva2-copy", HWDEC_DXVA2_COPY},
+ {"rpi", HWDEC_RPI},
+ {0}
+};
+
#define OPT_BASE_STRUCT struct MPOpts
const m_option_t mp_opts[] = {
@@ -283,15 +296,7 @@ const m_option_t mp_opts[] = {
OPT_FLAG("ad-spdif-dtshd", dtshd, 0),
- OPT_CHOICE("hwdec", hwdec_api, 0,
- ({"no", 0},
- {"auto", -1},
- {"vdpau", 1},
- {"vda", 2},
- {"vaapi", 4},
- {"vaapi-copy", 5},
- {"dxva2-copy", 6},
- {"rpi", 7})),
+ OPT_CHOICE_C("hwdec", hwdec_api, 0, mp_hwdec_names),
OPT_STRING("hwdec-codecs", hwdec_codecs, 0),
OPT_SUBSTRUCT("sws", vo.sws_opts, sws_conf, 0),