Mercurial > mplayer.hg
annotate libmpcodecs/vf_flip.c @ 35334:3397976a029b
stream ftp: readline: Always initialize output parameter buf
Only exception if passed parameter max is less than or equal
to zero. That cannot happen with the current code.
Additionally change readresp function to always copy the first
response line if the parameter rsp is non-NULL. This fixes some
error reporting that used uninitialized stack arrays.
author | al |
---|---|
date | Tue, 20 Nov 2012 22:16:29 +0000 |
parents | a972c1a4a012 |
children |
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 |
5557 | 19 #include <stdio.h> |
20 #include <stdlib.h> | |
21 #include <string.h> | |
22 | |
17012 | 23 #include "config.h" |
24 #include "mp_msg.h" | |
5557 | 25 |
5607 | 26 #include "mp_image.h" |
5557 | 27 #include "vf.h" |
28 | |
17012 | 29 #include "libvo/video_out.h" |
5557 | 30 |
31 //===========================================================================// | |
32 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
33 static int config(struct vf_instance *vf, |
6137
6253fc19afb1
do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents:
5691
diff
changeset
|
34 int width, int height, int d_width, int d_height, |
6253fc19afb1
do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents:
5691
diff
changeset
|
35 unsigned int flags, unsigned int outfmt){ |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
10141
diff
changeset
|
36 flags&=~VOFLAG_FLIPPING; // remove the FLIP flag |
6137
6253fc19afb1
do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents:
5691
diff
changeset
|
37 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); |
6253fc19afb1
do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents:
5691
diff
changeset
|
38 } |
6253fc19afb1
do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents:
5691
diff
changeset
|
39 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
40 static void get_image(struct vf_instance *vf, mp_image_t *mpi){ |
5557 | 41 if(mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE){ |
42 // try full DR ! | |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
43 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, |
5557 | 44 mpi->type, mpi->flags, mpi->width, mpi->height); |
45 // set up mpi as a upside-down image of dmpi: | |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
46 mpi->planes[0]=vf->dmpi->planes[0]+ |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
47 vf->dmpi->stride[0]*(vf->dmpi->height-1); |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
48 mpi->stride[0]=-vf->dmpi->stride[0]; |
5557 | 49 if(mpi->flags&MP_IMGFLAG_PLANAR){ |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
50 mpi->planes[1]=vf->dmpi->planes[1]+ |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
51 vf->dmpi->stride[1]*((vf->dmpi->height>>mpi->chroma_y_shift)-1); |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
52 mpi->stride[1]=-vf->dmpi->stride[1]; |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
53 mpi->planes[2]=vf->dmpi->planes[2]+ |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
54 vf->dmpi->stride[2]*((vf->dmpi->height>>mpi->chroma_y_shift)-1); |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
55 mpi->stride[2]=-vf->dmpi->stride[2]; |
5557 | 56 } |
57 mpi->flags|=MP_IMGFLAG_DIRECT; | |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
58 mpi->priv=(void*)vf->dmpi; |
5557 | 59 } |
60 } | |
61 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
62 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ |
5557 | 63 if(mpi->flags&MP_IMGFLAG_DIRECT){ |
7368 | 64 // we've used DR, so we're ready... |
9279 | 65 if(!(mpi->flags&MP_IMGFLAG_PLANAR)) |
66 ((mp_image_t*)mpi->priv)->planes[1] = mpi->planes[1]; // passthrough rgb8 palette | |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
67 return vf_next_put_image(vf,(mp_image_t*)mpi->priv, pts); |
5557 | 68 } |
69 | |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
70 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, |
5691 | 71 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, |
5557 | 72 mpi->width, mpi->height); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25221
diff
changeset
|
73 |
5557 | 74 // set up mpi as a upside-down image of dmpi: |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
75 vf->dmpi->planes[0]=mpi->planes[0]+ |
5557 | 76 mpi->stride[0]*(mpi->height-1); |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
77 vf->dmpi->stride[0]=-mpi->stride[0]; |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
78 if(vf->dmpi->flags&MP_IMGFLAG_PLANAR){ |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
79 vf->dmpi->planes[1]=mpi->planes[1]+ |
6539
79b536a37e40
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6137
diff
changeset
|
80 mpi->stride[1]*((mpi->height>>mpi->chroma_y_shift)-1); |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
81 vf->dmpi->stride[1]=-mpi->stride[1]; |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
82 vf->dmpi->planes[2]=mpi->planes[2]+ |
6539
79b536a37e40
better planar support, chroma subsampling support and Y8/Y800 support
alex
parents:
6137
diff
changeset
|
83 mpi->stride[2]*((mpi->height>>mpi->chroma_y_shift)-1); |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
84 vf->dmpi->stride[2]=-mpi->stride[2]; |
7258 | 85 } else |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
86 vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!! |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25221
diff
changeset
|
87 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
88 return vf_next_put_image(vf,vf->dmpi, pts); |
5557 | 89 } |
90 | |
91 //===========================================================================// | |
92 | |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30421
diff
changeset
|
93 static int vf_open(vf_instance_t *vf, char *args){ |
6137
6253fc19afb1
do not pass the flip flag to vo - maybe it support flipping just report no support
arpi
parents:
5691
diff
changeset
|
94 vf->config=config; |
5557 | 95 vf->get_image=get_image; |
96 vf->put_image=put_image; | |
5565
0b301fec999a
capabilities support -> automatic insertion of scale, expand, pp
arpi
parents:
5557
diff
changeset
|
97 vf->default_reqs=VFCAP_ACCEPT_STRIDE; |
5557 | 98 return 1; |
99 } | |
100 | |
25221 | 101 const vf_info_t vf_info_flip = { |
5557 | 102 "flip image upside-down", |
103 "flip", | |
104 "A'rpi", | |
105 "", | |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30421
diff
changeset
|
106 vf_open, |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9279
diff
changeset
|
107 NULL |
5557 | 108 }; |
109 | |
110 //===========================================================================// |