summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-29 15:16:06 +0200
committerwm4 <wm4@nowhere>2014-05-02 01:08:04 +0200
commit1efb5fd465f3e14d1b4b6c4fb065db792811a857 (patch)
tree164695e81e6e0dec1bd1e4366820acf33132f8af /video
parentffbf6037cb4a3e23f467f389186b06ebea9e57da (diff)
downloadmpv-1efb5fd465f3e14d1b4b6c4fb065db792811a857.tar.bz2
mpv-1efb5fd465f3e14d1b4b6c4fb065db792811a857.tar.xz
vf_vdpaupp: allow toggling deinterlace
Basically makes the 'D' key work again. (But only if the filter is already inserted.)
Diffstat (limited to 'video')
-rw-r--r--video/filter/vf_vdpaupp.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/video/filter/vf_vdpaupp.c b/video/filter/vf_vdpaupp.c
index 9fb8a028b8..a2a5ea6b5f 100644
--- a/video/filter/vf_vdpaupp.c
+++ b/video/filter/vf_vdpaupp.c
@@ -48,6 +48,8 @@ struct vf_priv_s {
int prev_pos; // last field that was output
+ int def_deintmode;
+ int deint_enabled;
struct mp_vdpau_mixer_opts opts;
};
@@ -166,7 +168,7 @@ static int filter_ext(struct vf_instance *vf, struct mp_image *mpi)
return -1;
}
- if (p->num_buffered == maxbuffer) {
+ while (p->num_buffered >= maxbuffer) {
talloc_free(p->buffered[p->num_buffered - 1]);
p->num_buffered--;
}
@@ -214,10 +216,19 @@ static int query_format(struct vf_instance *vf, unsigned int fmt)
static int control(vf_instance_t *vf, int request, void *data)
{
+ struct vf_priv_s *p = vf->priv;
+
switch (request) {
case VFCTRL_SEEK_RESET:
forget_frames(vf);
return CONTROL_OK;
+ case VFCTRL_GET_DEINTERLACE:
+ *(int *)data = !!p->deint_enabled;
+ return true;
+ case VFCTRL_SET_DEINTERLACE:
+ p->deint_enabled = !!*(int *)data;
+ p->opts.deint = p->deint_enabled ? p->def_deintmode : 0;
+ return true;
}
return CONTROL_UNKNOWN;
}
@@ -243,18 +254,22 @@ static int vf_open(vf_instance_t *vf)
if (!p->ctx)
return 0;
+ p->def_deintmode = p->opts.deint;
+ if (!p->deint_enabled)
+ p->opts.deint = 0;
+
return 1;
}
#define OPT_BASE_STRUCT struct vf_priv_s
static const m_option_t vf_opts_fields[] = {
- OPT_CHOICE("deint", opts.deint, 0,
- ({"no", 0},
- {"first-field", 1},
+ OPT_CHOICE("deint-mode", opts.deint, 0,
+ ({"first-field", 1},
{"bob", 2},
{"temporal", 3},
{"temporal-spatial", 4}),
OPTDEF_INT(3)),
+ OPT_FLAG("deint", deint_enabled, 0),
OPT_FLAG("chroma-deint", opts.chroma_deint, 0, OPTDEF_INT(1)),
OPT_FLAG("pullup", opts.pullup, 0),
OPT_FLOATRANGE("denoise", opts.denoise, 0, 0, 1),