comparison libmpcodecs/vf_harddup.c @ 32702:7af3e6f901fd

Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
author cehoyos
date Fri, 14 Jan 2011 22:10:21 +0000
parents a972c1a4a012
children
comparison
equal deleted inserted replaced
32701:02bc7c860503 32702:7af3e6f901fd
26 #include "img_format.h" 26 #include "img_format.h"
27 #include "mp_image.h" 27 #include "mp_image.h"
28 #include "vf.h" 28 #include "vf.h"
29 29
30 struct vf_priv_s { 30 struct vf_priv_s {
31 mp_image_t *last_mpi; 31 mp_image_t *last_mpi;
32 }; 32 };
33 33
34 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) 34 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
35 { 35 {
36 mp_image_t *dmpi; 36 mp_image_t *dmpi;
37 37
38 vf->priv->last_mpi = mpi; 38 vf->priv->last_mpi = mpi;
39 39
40 dmpi = vf_get_image(vf->next, mpi->imgfmt, 40 dmpi = vf_get_image(vf->next, mpi->imgfmt,
41 MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height); 41 MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height);
42 42
43 dmpi->planes[0] = mpi->planes[0]; 43 dmpi->planes[0] = mpi->planes[0];
44 dmpi->stride[0] = mpi->stride[0]; 44 dmpi->stride[0] = mpi->stride[0];
45 if (dmpi->flags&MP_IMGFLAG_PLANAR) { 45 if (dmpi->flags&MP_IMGFLAG_PLANAR) {
46 dmpi->planes[1] = mpi->planes[1]; 46 dmpi->planes[1] = mpi->planes[1];
47 dmpi->stride[1] = mpi->stride[1]; 47 dmpi->stride[1] = mpi->stride[1];
48 dmpi->planes[2] = mpi->planes[2]; 48 dmpi->planes[2] = mpi->planes[2];
49 dmpi->stride[2] = mpi->stride[2]; 49 dmpi->stride[2] = mpi->stride[2];
50 } 50 }
51 51
52 return vf_next_put_image(vf, dmpi, pts); 52 return vf_next_put_image(vf, dmpi, pts);
53 } 53 }
54 54
55 static int control(struct vf_instance *vf, int request, void* data) 55 static int control(struct vf_instance *vf, int request, void* data)
56 { 56 {
57 switch (request) { 57 switch (request) {
58 case VFCTRL_DUPLICATE_FRAME: 58 case VFCTRL_DUPLICATE_FRAME:
59 if (!vf->priv->last_mpi) break; 59 if (!vf->priv->last_mpi) break;
60 // This is a huge hack. We assume nothing 60 // This is a huge hack. We assume nothing
61 // has been called earlier in the filter chain 61 // has been called earlier in the filter chain
62 // since the last put_image. This is reasonable 62 // since the last put_image. This is reasonable
63 // because we're handling a duplicate frame! 63 // because we're handling a duplicate frame!
64 if (put_image(vf, vf->priv->last_mpi, MP_NOPTS_VALUE)) 64 if (put_image(vf, vf->priv->last_mpi, MP_NOPTS_VALUE))
65 return CONTROL_TRUE; 65 return CONTROL_TRUE;
66 break; 66 break;
67 } 67 }
68 return vf_next_control(vf, request, data); 68 return vf_next_control(vf, request, data);
69 } 69 }
70 70
71 static void uninit(struct vf_instance *vf) 71 static void uninit(struct vf_instance *vf)
72 { 72 {
73 free(vf->priv); 73 free(vf->priv);
74 } 74 }
75 75
76 static int vf_open(vf_instance_t *vf, char *args) 76 static int vf_open(vf_instance_t *vf, char *args)
77 { 77 {
78 vf->put_image = put_image; 78 vf->put_image = put_image;
79 vf->control = control; 79 vf->control = control;
80 vf->uninit = uninit; 80 vf->uninit = uninit;
81 vf->priv = calloc(1, sizeof(struct vf_priv_s)); 81 vf->priv = calloc(1, sizeof(struct vf_priv_s));
82 return 1; 82 return 1;
83 } 83 }
84 84
85 const vf_info_t vf_info_harddup = { 85 const vf_info_t vf_info_harddup = {
86 "resubmit duplicate frames for encoding", 86 "resubmit duplicate frames for encoding",
87 "harddup", 87 "harddup",