summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-12-01 21:05:54 +0100
committerwm4 <wm4@nowhere>2017-12-01 21:11:43 +0100
commiteb8957cea110a9aa652894d8bb897a9b1ff91e0b (patch)
treea418036f0b8da42fac96921e3075c4dc92462ef6 /options
parent43af055a70a7b604e1e936575213aa561ac915d1 (diff)
downloadmpv-eb8957cea110a9aa652894d8bb897a9b1ff91e0b.tar.bz2
mpv-eb8957cea110a9aa652894d8bb897a9b1ff91e0b.tar.xz
vd_lavc: rewrite how --hwdec is handled
Change it from explicit metadata about every hwaccel method to trying to get it from libavcodec. As shown by add_all_hwdec_methods(), this is a quite bumpy road, and a bit worse than expected. This will probably cause a bunch of regressions. In particular I didn't check all the strange decoder wrappers, which all cause some sort of special cases each. You're volunteering for beta testing by using this commit. One interesting thing is that we completely get rid of mp_hwdec_ctx in vd_lavc.c, and that HWDEC_* mostly goes away (some filters still use it, and the VO hwdec interops still have a lot of code to set it up, so it's not going away completely for now).
Diffstat (limited to 'options')
-rw-r--r--options/options.c33
-rw-r--r--options/options.h5
2 files changed, 7 insertions, 31 deletions
diff --git a/options/options.c b/options/options.c
index c6837a03e8..63cd93c53f 100644
--- a/options/options.c
+++ b/options/options.c
@@ -93,34 +93,6 @@ extern const struct m_sub_options d3d11va_conf;
extern const struct m_sub_options angle_conf;
extern const struct m_sub_options cocoa_conf;
-const struct m_opt_choice_alternatives mp_hwdec_names[] = {
- {"no", HWDEC_NONE},
- {"auto", HWDEC_AUTO},
- {"yes" , HWDEC_AUTO},
- {"auto-copy", HWDEC_AUTO_COPY},
- {"vdpau", HWDEC_VDPAU},
- {"vdpau-copy", HWDEC_VDPAU_COPY},
- {"videotoolbox",HWDEC_VIDEOTOOLBOX},
- {"videotoolbox-copy",HWDEC_VIDEOTOOLBOX_COPY},
- {"vaapi", HWDEC_VAAPI},
- {"vaapi-copy", HWDEC_VAAPI_COPY},
- {"dxva2", HWDEC_DXVA2},
- {"dxva2-copy", HWDEC_DXVA2_COPY},
- {"d3d11va", HWDEC_D3D11VA},
- {"d3d11va-copy",HWDEC_D3D11VA_COPY},
- {"rpi", HWDEC_RPI},
- {"rpi-copy", HWDEC_RPI_COPY},
- {"rkmpp", HWDEC_RKMPP},
- {"mediacodec", HWDEC_MEDIACODEC},
- {"mediacodec-copy",HWDEC_MEDIACODEC_COPY},
- {"cuda", HWDEC_CUDA},
- {"cuda-copy", HWDEC_CUDA_COPY},
- {"nvdec", HWDEC_NVDEC},
- {"nvdec-copy", HWDEC_NVDEC_COPY},
- {"crystalhd", HWDEC_CRYSTALHD},
- {0}
-};
-
static const struct m_sub_options screenshot_conf = {
.opts = image_writer_opts,
.size = sizeof(struct image_writer_opts),
@@ -434,7 +406,8 @@ const m_option_t mp_opts[] = {
OPT_FLAG("ad-spdif-dtshd", dtshd, 0,
.deprecation_message = "use --audio-spdif instead"),
- OPT_CHOICE_C("hwdec", hwdec_api, 0, mp_hwdec_names),
+ OPT_STRING_VALIDATE("hwdec", hwdec_api, M_OPT_OPTIONAL_PARAM,
+ hwdec_validate_opt),
OPT_STRING("hwdec-codecs", hwdec_codecs, 0),
#if HAVE_VIDEOTOOLBOX_HWACCEL
OPT_IMAGEFORMAT("videotoolbox-format", videotoolbox_format, 0, .min = -1,
@@ -943,7 +916,7 @@ const struct MPOpts mp_default_opts = {
.use_embedded_fonts = 1,
.screenshot_template = "mpv-shot%n",
- .hwdec_api = HAVE_RPI ? HWDEC_RPI : 0,
+ .hwdec_api = HAVE_RPI ? "mmal" : "no",
.hwdec_codecs = "h264,vc1,wmv3,hevc,mpeg2video,vp9",
.videotoolbox_format = IMGFMT_NV12,
diff --git a/options/options.h b/options/options.h
index 8bf8f1ec6a..9c9dd64233 100644
--- a/options/options.h
+++ b/options/options.h
@@ -285,7 +285,7 @@ typedef struct MPOpts {
int sub_clear_on_seek;
int teletext_page;
- int hwdec_api;
+ char *hwdec_api;
char *hwdec_codecs;
int videotoolbox_format;
int hwdec_image_format;
@@ -349,4 +349,7 @@ extern const struct m_sub_options vo_sub_opts;
extern const struct m_sub_options stream_cache_conf;
extern const struct m_sub_options dvd_conf;
+int hwdec_validate_opt(struct mp_log *log, const m_option_t *opt,
+ struct bstr name, struct bstr param);
+
#endif