Mercurial > mplayer.hg
annotate libmpcodecs/vf_field.c @ 30603:c5d8b7640b7d
Call mpcodecs_config_vo with the proper image format for dmo and dshow codecs.
author | reimar |
---|---|
date | Thu, 18 Feb 2010 22:28:55 +0000 |
parents | bbb6ebec87a0 |
children | a7b908875c14 |
rev | line source |
---|---|
30421
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
1 /* |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
2 * This file is part of MPlayer. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
3 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
7 * (at your option) any later version. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
8 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
12 * GNU General Public License for more details. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
13 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
17 */ |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
18 |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
19 #include <stdio.h> |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
20 #include <stdlib.h> |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
21 #include <string.h> |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
22 |
17012 | 23 #include "config.h" |
24 #include "mp_msg.h" | |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
25 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
26 #include "mp_image.h" |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
27 #include "vf.h" |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
28 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
29 struct vf_priv_s { |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
30 int field; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
31 }; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
32 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
33 //===========================================================================// |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
34 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
35 static int config(struct vf_instance_s* vf, |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
36 int width, int height, int d_width, int d_height, |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
37 unsigned int flags, unsigned int outfmt){ |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
38 return vf_next_config(vf,width,height/2,d_width,d_height,flags,outfmt); |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
39 } |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
40 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
41 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
42 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
43 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
44 mpi->width, mpi->height/2); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25221
diff
changeset
|
45 |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
46 // set up mpi as a double-stride image of dmpi: |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
47 vf->dmpi->planes[0]=mpi->planes[0]+mpi->stride[0]*vf->priv->field; |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
48 vf->dmpi->stride[0]=2*mpi->stride[0]; |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
49 if(vf->dmpi->flags&MP_IMGFLAG_PLANAR){ |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
50 vf->dmpi->planes[1]=mpi->planes[1]+ |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
51 mpi->stride[1]*vf->priv->field; |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
52 vf->dmpi->stride[1]=2*mpi->stride[1]; |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
53 vf->dmpi->planes[2]=mpi->planes[2]+ |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
54 mpi->stride[2]*vf->priv->field; |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
55 vf->dmpi->stride[2]=2*mpi->stride[2]; |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
56 } else |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
57 vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!! |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25221
diff
changeset
|
58 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
59 return vf_next_put_image(vf,vf->dmpi, pts); |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
60 } |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
61 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
62 //===========================================================================// |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
63 |
9443 | 64 static void uninit(struct vf_instance_s* vf) |
65 { | |
66 free(vf->priv); | |
67 } | |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
68 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
69 static int open(vf_instance_t *vf, char* args){ |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
70 vf->config=config; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
71 vf->put_image=put_image; |
9443 | 72 vf->uninit=uninit; |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
73 vf->default_reqs=VFCAP_ACCEPT_STRIDE; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
74 vf->priv=calloc(1, sizeof(struct vf_priv_s)); |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
75 if (args) sscanf(args, "%d", &vf->priv->field); |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
76 vf->priv->field &= 1; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
77 return 1; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
78 } |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
79 |
25221 | 80 const vf_info_t vf_info_field = { |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
81 "extract single field", |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
82 "field", |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
83 "Rich Felker", |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
84 "", |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9443
diff
changeset
|
85 open, |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9443
diff
changeset
|
86 NULL |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
87 }; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
88 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
89 //===========================================================================// |