summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-02-22 23:56:42 +0100
committerwm4 <wm4@nowhere>2013-02-23 00:12:45 +0100
commit2e1063d781732f0c98f31e73ebc4f364d599818e (patch)
treed402c2687895c09dc7cf61c84e600d2be6fb83ab /video
parent5374e26f9e2cfbc3b7323c1b4e16975ad7f2c5e9 (diff)
downloadmpv-2e1063d781732f0c98f31e73ebc4f364d599818e.tar.bz2
mpv-2e1063d781732f0c98f31e73ebc4f364d599818e.tar.xz
vf_yadif: switch to option parser, allow disabling by default
Use the option parser instead of sscanf. Remove the parameter changing the field dominance (it has been marked deprecated for ages). Add a new suboption "enabled", which can be used to disable the filter by default, until it's enabled at runtime: mpv -vf yadif=enabled=no
Diffstat (limited to 'video')
-rw-r--r--video/filter/vf_yadif.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/video/filter/vf_yadif.c b/video/filter/vf_yadif.c
index 93d30b6fbc..d0c3bbe08b 100644
--- a/video/filter/vf_yadif.c
+++ b/video/filter/vf_yadif.c
@@ -27,6 +27,7 @@
#include "config.h"
#include "core/cpudetect.h"
#include "core/options.h"
+#include "core/m_struct.h"
#include "core/mp_msg.h"
#include "video/img_format.h"
@@ -50,6 +51,10 @@ struct vf_priv_s {
int do_deinterlace;
};
+static const struct vf_priv_s vf_priv_default = {
+ .do_deinterlace = 1,
+};
+
static void (*filter_line)(struct vf_priv_s *p, uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int refs, int parity);
static void store_ref(struct vf_priv_s *p, uint8_t *src[3], int src_stride[3], int width, int height){
@@ -470,8 +475,6 @@ static void uninit(struct vf_instance *vf){
if(*p) free(*p - 3*vf->priv->stride[i/3]);
*p= NULL;
}
- free(vf->priv);
- vf->priv=NULL;
}
//===========================================================================//
@@ -501,13 +504,9 @@ static int vf_open(vf_instance_t *vf, char *args){
vf->filter_ext=filter_image;
vf->query_format=query_format;
vf->uninit=uninit;
- vf->priv=malloc(sizeof(struct vf_priv_s));
vf->control=control;
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
- vf->priv->mode=0;
vf->priv->parity= -1;
- vf->priv->do_deinterlace=1;
if (args) sscanf(args, "%d:%d", &vf->priv->mode, &vf->priv->parity);
@@ -519,11 +518,26 @@ static int vf_open(vf_instance_t *vf, char *args){
return 1;
}
+#undef ST_OFF
+#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
+static const m_option_t vf_opts_fields[] = {
+ {"mode", ST_OFF(mode), CONF_TYPE_INT, M_OPT_RANGE, 0, 3},
+ {"enabled", ST_OFF(do_deinterlace), CONF_TYPE_FLAG, 0, 0, 1},
+ {0}
+};
+
+static const m_struct_t vf_opts = {
+ "yadif",
+ sizeof(struct vf_priv_s),
+ &vf_priv_default,
+ vf_opts_fields
+};
+
const vf_info_t vf_info_yadif = {
"Yet Another DeInterlacing Filter",
"yadif",
"Michael Niedermayer",
"",
vf_open,
- NULL
+ &vf_opts
};