changeset 21060:b37a53da3b8a

allows to de- and reactivate yadif on the fly Patch by Carl Eugen Hoyos % cehoyos A rainbow P studorg P tuwien P ac P at % Original thread: date: Nov 17, 2006 7:38 PM subject: [MPlayer-dev-eng] De- and reactivate yadif
author gpoirier
date Sun, 19 Nov 2006 19:17:51 +0000
parents ac2556247c7a
children 442dc1e34b38
files libmpcodecs/vf_yadif.c
diffstat 1 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf_yadif.c	Sun Nov 19 19:12:29 2006 +0000
+++ b/libmpcodecs/vf_yadif.c	Sun Nov 19 19:17:51 2006 +0000
@@ -54,6 +54,7 @@
     mp_image_t *buffered_mpi;
     int stride[3];
     uint8_t *ref[4][3];
+    int do_deinterlace;
 };
 
 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);
@@ -410,7 +411,9 @@
     vf->priv->buffered_i = 0;
     vf->priv->buffered_pts = pts;
 
-    return continue_buffered_image(vf);
+    return vf->priv->do_deinterlace?
+           continue_buffered_image(vf):
+           vf_next_put_image(vf, mpi, pts);
 }
 
 static int continue_buffered_image(struct vf_instance_s *vf)
@@ -469,6 +472,18 @@
     return 0;
 }
 
+static int control(struct vf_instance_s* vf, int request, void* data){
+    switch (request){
+      case VFCTRL_GET_DEINTERLACE:
+        *(int*)data = vf->priv->do_deinterlace;
+        return CONTROL_OK;
+      case VFCTRL_SET_DEINTERLACE:
+        vf->priv->do_deinterlace = *(int*)data;
+        return CONTROL_OK;
+    }
+    return vf_next_control (vf, request, data);
+}
+
 static int open(vf_instance_t *vf, char* args){
 
     vf->config=config;
@@ -476,10 +491,12 @@
     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);