typo fixes
[mplayer/greg.git] / libmpcodecs / vf_field.c
blobd6bd66478ea64c11ceda8aa5a0ab2cee9e733ae7
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
5 #include "config.h"
6 #include "mp_msg.h"
8 #include "mp_image.h"
9 #include "vf.h"
11 #include "libvo/fastmemcpy.h"
13 struct vf_priv_s {
14 int field;
17 //===========================================================================//
19 static int config(struct vf_instance_s* vf,
20 int width, int height, int d_width, int d_height,
21 unsigned int flags, unsigned int outfmt){
22 return vf_next_config(vf,width,height/2,d_width,d_height,flags,outfmt);
25 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
26 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
27 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
28 mpi->width, mpi->height/2);
30 // set up mpi as a double-stride image of dmpi:
31 vf->dmpi->planes[0]=mpi->planes[0]+mpi->stride[0]*vf->priv->field;
32 vf->dmpi->stride[0]=2*mpi->stride[0];
33 if(vf->dmpi->flags&MP_IMGFLAG_PLANAR){
34 vf->dmpi->planes[1]=mpi->planes[1]+
35 mpi->stride[1]*vf->priv->field;
36 vf->dmpi->stride[1]=2*mpi->stride[1];
37 vf->dmpi->planes[2]=mpi->planes[2]+
38 mpi->stride[2]*vf->priv->field;
39 vf->dmpi->stride[2]=2*mpi->stride[2];
40 } else
41 vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!!
43 return vf_next_put_image(vf,vf->dmpi, pts);
46 //===========================================================================//
48 static void uninit(struct vf_instance_s* vf)
50 free(vf->priv);
53 static int open(vf_instance_t *vf, char* args){
54 vf->config=config;
55 vf->put_image=put_image;
56 vf->uninit=uninit;
57 vf->default_reqs=VFCAP_ACCEPT_STRIDE;
58 vf->priv=calloc(1, sizeof(struct vf_priv_s));
59 if (args) sscanf(args, "%d", &vf->priv->field);
60 vf->priv->field &= 1;
61 return 1;
64 vf_info_t vf_info_field = {
65 "extract single field",
66 "field",
67 "Rich Felker",
68 "",
69 open,
70 NULL
73 //===========================================================================//