8 #include "img_format.h"
16 static int put_image(struct vf_instance_s
* vf
, mp_image_t
*mpi
, double pts
)
20 vf
->priv
->last_mpi
= mpi
;
22 dmpi
= vf_get_image(vf
->next
, mpi
->imgfmt
,
23 MP_IMGTYPE_EXPORT
, 0, mpi
->width
, mpi
->height
);
25 dmpi
->planes
[0] = mpi
->planes
[0];
26 dmpi
->stride
[0] = mpi
->stride
[0];
27 if (dmpi
->flags
&MP_IMGFLAG_PLANAR
) {
28 dmpi
->planes
[1] = mpi
->planes
[1];
29 dmpi
->stride
[1] = mpi
->stride
[1];
30 dmpi
->planes
[2] = mpi
->planes
[2];
31 dmpi
->stride
[2] = mpi
->stride
[2];
34 return vf_next_put_image(vf
, dmpi
, pts
);
37 static int control(struct vf_instance_s
* vf
, int request
, void* data
)
40 case VFCTRL_DUPLICATE_FRAME
:
41 if (!vf
->priv
->last_mpi
) break;
42 // This is a huge hack. We assume nothing
43 // has been called earlier in the filter chain
44 // since the last put_image. This is reasonable
45 // because we're handling a duplicate frame!
46 if (put_image(vf
, vf
->priv
->last_mpi
, MP_NOPTS_VALUE
))
50 return vf_next_control(vf
, request
, data
);
53 static void uninit(struct vf_instance_s
* vf
)
58 static int open(vf_instance_t
*vf
, char* args
)
60 vf
->put_image
= put_image
;
61 vf
->control
= control
;
63 vf
->priv
= calloc(1, sizeof(struct vf_priv_s
));
67 const vf_info_t vf_info_harddup
= {
68 "resubmit duplicate frames for encoding",