annotate libvo/vo_tga.c @ 28868:a10ddae3de31

whitespace cosmetics: - Remove all tabs and trailing whitespace. - Indent with 4 spaces. - K&R-ify and prettyprint some parts.
author diego
date Mon, 09 Mar 2009 11:28:31 +0000
parents 7681eab10aea
children f01023c524c3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28446
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
1 /*
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
2 * TARGA video output
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
3 *
28446
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
4 * This video output module writes TARGA uncompressed files in 15, 24 and 32
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
5 * bit BGR format.
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
6 *
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
7 * to select the output format use the format filter:
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
8 * mplayer -vo tga -vf format=bgr15 ...
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
9 * mplayer -vo tga -vf format=bgr24 ...
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
10 * mplayer -vo tga -vf format=bgr32 ...
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
11 *
28446
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
12 * The 16 bit files are loaded without problem from Gimp and ImageMagick but
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
13 * give an error with entice (a visualizer from the enlightenment package
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
14 * that uses the imlib2 package).
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
15 *
28446
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
16 * In 32-bit mode the alpha channel is set to 255 (0xff). For big-endian
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
17 * machines, TGA_ALPHA32 changes from 0xff000000 to 0x000000ff, and
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
18 * TGA_SHIFT32 from 0 to 8.
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
19 *
28446
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
20 * I need to fill the alpha channel because entice considers that alpha
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
21 * channel (and displays nothing, only the background!), but ImageMagick
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
22 * (the program display) or gimp doesn't care.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
23 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
24 * Maybe it is possible (with a compilation switch) to avoid the fill of
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
25 * the alpha channel and work outside MPlayer (if needed).
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
26 *
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
27 * Daniele Forghieri ( guru@digitalfantasy.it )
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
28 *
28446
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
29 * This file is part of MPlayer.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
30 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
31 * MPlayer is free software; you can redistribute it and/or modify
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
32 * it under the terms of the GNU General Public License as published by
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
33 * the Free Software Foundation; either version 2 of the License, or
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
34 * (at your option) any later version.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
35 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
36 * MPlayer is distributed in the hope that it will be useful,
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
37 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
38 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
39 * GNU General Public License for more details.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
40 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
41 * You should have received a copy of the GNU General Public License along
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
42 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 26755
diff changeset
43 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
44 */
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
45
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
46 #include <stdio.h>
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
47 #include <stdlib.h>
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
48 #include <string.h>
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
49 #include <errno.h>
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
50 #include <math.h>
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
51
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
52 #include "config.h"
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 16171
diff changeset
53 #include "mp_msg.h"
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 16171
diff changeset
54 #include "help_mp.h"
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
55 #include "video_out.h"
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
56 #include "video_out_internal.h"
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
57
25216
3aee342be929 Make vo info structs const
reimar
parents: 22026
diff changeset
58 static const vo_info_t info =
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
59 {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
60 "Targa output",
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
61 "tga",
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
62 "Daniele Forghieri - guru@digitalfantasy.it",
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
63 ""
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
64 };
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
65
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
66
25220
c9e9ac2008c2 Mark the vo_functions_t definitions as const where possible.
reimar
parents: 25216
diff changeset
67 const LIBVO_EXTERN (tga)
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
68
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
69 /* locals vars */
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
70 static int frame_num = 0;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
71 static void *line_buff;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
72
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
73 static void tga_make_header(uint8_t *h, int dx, int dy, int bpp)
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
74 {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
75
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
76 int i;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
77
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
78 for(i = 0; i < 18; i++) {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
79 switch (i) {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
80 case 2:
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
81 *h = 0x02;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
82 break;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
83
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
84 case 12:
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
85 *h = dx & 0xff;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
86 break;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
87
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
88 case 13:
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
89 *h = (dx >> 8) & 0xff;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
90 break;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
91
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
92 case 14:
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
93 *h = dy & 0xff;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
94 break;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
95
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
96 case 15:
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
97 *h = (dy >> 8) & 0xff;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
98 break;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
99
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
100 case 16:
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
101 *h = bpp;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
102 break;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
103
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
104 case 17:
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
105 *h = 0x20;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
106 break;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
107
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
108 default:
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
109 *h = 0;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
110 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
111 ++h;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
112 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
113
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
114 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
115
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
116 static int write_tga( char *file, int bpp, int dx, int dy, uint8_t *buf, int stride)
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
117 {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
118 int er;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
119 FILE *fo;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
120
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
121 fo = fopen(file, "wb");
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
122 if (fo != NULL) {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
123 uint8_t hdr[18];
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
124
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
125 er = 0;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
126 tga_make_header(hdr, dx, dy, bpp);
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
127 if (fwrite(hdr, sizeof(hdr), 1, fo) == 1) {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
128 int wb;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
129
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
130 wb = ((bpp + 7) / 8) * dx;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
131 if (bpp == 32) {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
132 /* Setup the alpha channel for every pixel */
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
133 while (dy-- > 0) {
22026
cac6e3b0d2e5 fix endianess, see bug #727
lu_zero
parents: 18234
diff changeset
134 uint8_t *d;
cac6e3b0d2e5 fix endianess, see bug #727
lu_zero
parents: 18234
diff changeset
135 uint8_t *s;
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
136 int x;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
137
22026
cac6e3b0d2e5 fix endianess, see bug #727
lu_zero
parents: 18234
diff changeset
138 s = buf;
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
139 d = line_buff;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
140 for(x = 0; x < dx; x++) {
22026
cac6e3b0d2e5 fix endianess, see bug #727
lu_zero
parents: 18234
diff changeset
141 #ifdef WORDS_BIGENDIAN
cac6e3b0d2e5 fix endianess, see bug #727
lu_zero
parents: 18234
diff changeset
142 d[0] = s[3];
cac6e3b0d2e5 fix endianess, see bug #727
lu_zero
parents: 18234
diff changeset
143 d[1] = s[2];
cac6e3b0d2e5 fix endianess, see bug #727
lu_zero
parents: 18234
diff changeset
144 d[2] = s[1];
cac6e3b0d2e5 fix endianess, see bug #727
lu_zero
parents: 18234
diff changeset
145 d[3] = 0xff;
cac6e3b0d2e5 fix endianess, see bug #727
lu_zero
parents: 18234
diff changeset
146 #else
cac6e3b0d2e5 fix endianess, see bug #727
lu_zero
parents: 18234
diff changeset
147 d[0] = 0xff;
cac6e3b0d2e5 fix endianess, see bug #727
lu_zero
parents: 18234
diff changeset
148 d[1] = s[1];
cac6e3b0d2e5 fix endianess, see bug #727
lu_zero
parents: 18234
diff changeset
149 d[2] = s[2];
cac6e3b0d2e5 fix endianess, see bug #727
lu_zero
parents: 18234
diff changeset
150 d[3] = s[3];
cac6e3b0d2e5 fix endianess, see bug #727
lu_zero
parents: 18234
diff changeset
151 #endif
cac6e3b0d2e5 fix endianess, see bug #727
lu_zero
parents: 18234
diff changeset
152 d+=4;
cac6e3b0d2e5 fix endianess, see bug #727
lu_zero
parents: 18234
diff changeset
153 s+=4;
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
154 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
155 if (fwrite(line_buff, wb, 1, fo) != 1) {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
156 er = 4;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
157 break;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
158 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
159 buf += stride;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
160 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
161
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
162 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
163 else {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
164 while (dy-- > 0) {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
165 if (fwrite(buf, wb, 1, fo) != 1) {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
166 er = 4;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
167 break;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
168 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
169 buf += stride;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
170 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
171 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
172 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
173 else {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
174 er = 2;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
175 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
176
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
177 fclose(fo);
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
178 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
179 else {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
180 er = 1;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
181 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
182
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
183 if (er) {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
184 fprintf(stderr, "Error writing file [%s]\n", file);
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
185 }
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 25220
diff changeset
186 return er;
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
187 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
188
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
189 static uint32_t draw_image(mp_image_t* mpi)
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
190 {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
191 char file[20 + 1];
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
192
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
193 snprintf (file, 20, "%08d.tga", ++frame_num);
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
194
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
195 write_tga( file,
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
196 mpi->bpp,
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
197 mpi->w,
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
198 mpi->h,
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
199 mpi->planes[0],
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
200 mpi->stride[0]);
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
201
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
202 return VO_TRUE;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
203 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
204
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
205 static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
206 {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
207 /* buffer for alpha */
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
208 if(line_buff){ free(line_buff); line_buff=NULL; }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
209 if (format == (IMGFMT_BGR | 32)) {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
210 line_buff = malloc(width * 4);
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
211 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
212 return 0;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
213 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
214
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
215 static void draw_osd(void)
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
216 {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
217 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
218
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
219 static void flip_page (void)
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
220 {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
221 return;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
222 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
223
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
224 static int draw_slice(uint8_t *srcimg[], int stride[], int w,int h,int x,int y)
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
225 {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
226 return -1;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
227 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
228
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
229 static int draw_frame(uint8_t * src[])
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
230 {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
231 return -1;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
232 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
233
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
234 static int query_format(uint32_t format)
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
235 {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
236 switch(format){
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
237 case IMGFMT_BGR|15:
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
238 case IMGFMT_BGR|24:
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
239 case IMGFMT_BGR|32:
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
240 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
241 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
242 return 0;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
243 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
244
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
245 static void uninit(void)
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
246 {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
247 if(line_buff){ free(line_buff); line_buff=NULL; }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
248 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
249
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
250 static void check_events(void)
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
251 {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
252 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
253
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
254 static int preinit(const char *arg)
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
255 {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
256 if(arg) {
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 16171
diff changeset
257 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TGA_UnknownSubdevice,arg);
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
258 return ENOSYS;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
259 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
260 return 0;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
261 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
262
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
263 static int control(uint32_t request, void *data, ...)
10689
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
264 {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
265 switch (request) {
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
266 case VOCTRL_DRAW_IMAGE:
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
267 return draw_image(data);
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
268
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
269 case VOCTRL_QUERY_FORMAT:
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
270 return query_format(*((uint32_t*)data));
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
271 }
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
272 return VO_NOTIMPL;
c6c54f467984 TGA image output VO module
arpi
parents:
diff changeset
273 }