summaryrefslogtreecommitdiffstats
path: root/player
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 /player
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 'player')
-rw-r--r--player/command.c39
1 files changed, 14 insertions, 25 deletions
diff --git a/player/command.c b/player/command.c
index 9017278286..9c0dd31f28 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2419,24 +2419,22 @@ static int mp_property_hwdec(void *ctx, struct m_property *prop,
struct MPOpts *opts = mpctx->opts;
if (action == M_PROPERTY_SET) {
- int new = *(int *)arg;
+ char *new = *(char **)arg;
- if (opts->hwdec_api == new)
+ if (strcmp(opts->hwdec_api, new) == 0)
return M_PROPERTY_OK;
- opts->hwdec_api = new;
+ talloc_free(opts->hwdec_api);
+ opts->hwdec_api = talloc_strdup(NULL, new);
if (!vd)
return M_PROPERTY_OK;
- int current = -2;
- video_vd_control(vd, VDCTRL_GET_HWDEC, &current);
- if (current != opts->hwdec_api) {
- video_vd_control(vd, VDCTRL_REINIT, NULL);
- double last_pts = mpctx->last_vo_pts;
- if (last_pts != MP_NOPTS_VALUE)
- queue_seek(mpctx, MPSEEK_ABSOLUTE, last_pts, MPSEEK_EXACT, 0);
- }
+ video_vd_control(vd, VDCTRL_REINIT, NULL);
+ double last_pts = mpctx->last_vo_pts;
+ if (last_pts != MP_NOPTS_VALUE)
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, last_pts, MPSEEK_EXACT, 0);
+
return M_PROPERTY_OK;
}
return mp_property_generic_option(mpctx, prop, action, arg);
@@ -2452,20 +2450,11 @@ static int mp_property_hwdec_current(void *ctx, struct m_property *prop,
if (!vd)
return M_PROPERTY_UNAVAILABLE;
- switch (action) {
- case M_PROPERTY_GET_TYPE: {
- // Abuse another hwdec option to resolve the value names
- struct m_property dummy = {.name = "hwdec"};
- return mp_property_generic_option(mpctx, &dummy, action, arg);
- }
- case M_PROPERTY_GET: {
- int current = HWDEC_NONE;
- video_vd_control(vd, VDCTRL_GET_HWDEC, &current);
- *(int *)arg = current;
- return M_PROPERTY_OK;
- }
- }
- return M_PROPERTY_NOT_IMPLEMENTED;
+ char *current = NULL;
+ video_vd_control(vd, VDCTRL_GET_HWDEC, &current);
+ if (!current)
+ current = "no";
+ return m_property_strdup_ro(action, arg, current);
}
static int mp_property_hwdec_interop(void *ctx, struct m_property *prop,