Mercurial > mplayer.hg
annotate libmpcodecs/vf_swapuv.c @ 23523:273aa6124f66
avoid utter breakage on non-x86, patch from Chris Roccati <roccati@at@pobox.dot.com>
author | lu_zero |
---|---|
date | Sun, 10 Jun 2007 21:58:30 +0000 |
parents | f8d4f8eff72b |
children | 00fff9a3b735 |
rev | line source |
---|---|
8002 | 1 /* |
2 Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at> | |
3 | |
4 This program is free software; you can redistribute it and/or modify | |
5 it under the terms of the GNU General Public License as published by | |
6 the Free Software Foundation; either version 2 of the License, or | |
7 (at your option) any later version. | |
8 | |
9 This program is distributed in the hope that it will be useful, | |
10 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 GNU General Public License for more details. | |
13 | |
14 You should have received a copy of the GNU General Public License | |
15 along with this program; if not, write to the Free Software | |
17367
401b440a6d76
Update licensing information: The FSF changed postal address.
diego
parents:
17012
diff
changeset
|
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
8002 | 17 */ |
18 | |
19 #include <stdio.h> | |
20 #include <stdlib.h> | |
21 #include <string.h> | |
22 #include <inttypes.h> | |
23 #include <assert.h> | |
24 | |
17012 | 25 #include "config.h" |
26 #include "mp_msg.h" | |
8002 | 27 |
28 #ifdef HAVE_MALLOC_H | |
29 #include <malloc.h> | |
30 #endif | |
31 | |
32 #include "img_format.h" | |
33 #include "mp_image.h" | |
34 #include "vf.h" | |
35 | |
36 | |
37 //===========================================================================// | |
38 | |
8050 | 39 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){ |
40 mp_image_t *dmpi= vf_get_image(vf->next, mpi->imgfmt, | |
41 mpi->type, mpi->flags, mpi->w, mpi->h); | |
8002 | 42 |
8050 | 43 mpi->planes[0]=dmpi->planes[0]; |
44 mpi->planes[1]=dmpi->planes[2]; | |
45 mpi->planes[2]=dmpi->planes[1]; | |
46 mpi->stride[0]=dmpi->stride[0]; | |
47 mpi->stride[1]=dmpi->stride[2]; | |
48 mpi->stride[2]=dmpi->stride[1]; | |
49 mpi->width=dmpi->width; | |
8002 | 50 |
8050 | 51 mpi->flags|=MP_IMGFLAG_DIRECT; |
52 mpi->priv=(void*)dmpi; | |
8002 | 53 } |
54 | |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17367
diff
changeset
|
55 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ |
8050 | 56 mp_image_t *dmpi; |
57 | |
58 if(mpi->flags&MP_IMGFLAG_DIRECT){ | |
59 dmpi=(mp_image_t*)mpi->priv; | |
60 } else { | |
61 dmpi=vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h); | |
8002 | 62 assert(mpi->flags&MP_IMGFLAG_PLANAR); |
63 dmpi->planes[0]=mpi->planes[0]; | |
64 dmpi->planes[1]=mpi->planes[2]; | |
65 dmpi->planes[2]=mpi->planes[1]; | |
66 dmpi->stride[0]=mpi->stride[0]; | |
67 dmpi->stride[1]=mpi->stride[2]; | |
68 dmpi->stride[2]=mpi->stride[1]; | |
8050 | 69 dmpi->width=mpi->width; |
70 } | |
8002 | 71 |
9934 | 72 vf_clone_mpi_attributes(dmpi, mpi); |
8050 | 73 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17367
diff
changeset
|
74 return vf_next_put_image(vf,dmpi, pts); |
8002 | 75 } |
76 | |
77 //===========================================================================// | |
78 | |
79 static int query_format(struct vf_instance_s* vf, unsigned int fmt){ | |
80 switch(fmt) | |
81 { | |
82 case IMGFMT_YV12: | |
83 case IMGFMT_I420: | |
84 case IMGFMT_IYUV: | |
85 case IMGFMT_YVU9: | |
86 case IMGFMT_444P: | |
87 case IMGFMT_422P: | |
88 case IMGFMT_411P: | |
89 return vf_next_query_format(vf, fmt); | |
90 } | |
91 return 0; | |
92 } | |
93 | |
94 static int open(vf_instance_t *vf, char* args){ | |
95 vf->put_image=put_image; | |
8050 | 96 vf->get_image=get_image; |
8002 | 97 vf->query_format=query_format; |
98 return 1; | |
99 } | |
100 | |
101 vf_info_t vf_info_swapuv = { | |
15030 | 102 "UV swapper", |
8002 | 103 "swapuv", |
104 "Michael Niedermayer", | |
105 "", | |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8050
diff
changeset
|
106 open, |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8050
diff
changeset
|
107 NULL |
8002 | 108 }; |
109 | |
110 //===========================================================================// |