Mercurial > mplayer.hg
annotate codec-cfg.c @ 34934:364fafc3283f
Fix GRAY16 order.
author | cehoyos |
---|---|
date | Sun, 15 Jul 2012 20:31:42 +0000 |
parents | 19212dea7a97 |
children | 79c374e70653 |
rev | line source |
---|---|
319 | 1 /* |
2 * codec.conf parser | |
4676 | 3 * |
22501 | 4 * to compile test application: |
5 * cc -I. -DTESTING -o codec-cfg-test codec-cfg.c mp_msg.o osdep/getch2.o -ltermcap | |
15303 | 6 * to compile CODECS2HTML: |
33246 | 7 * gcc -DCODECS2HTML -o codecs2html codec-cfg.c |
4676 | 8 * |
9 * TODO: implement informat in CODECS2HTML too | |
30429
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
10 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
11 * Copyright (C) 2001 Szabolcs Berecz <szabi@inf.elte.hu> |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
12 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
13 * This file is part of MPlayer. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
14 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
15 * MPlayer is free software; you can redistribute it and/or modify |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
16 * it under the terms of the GNU General Public License as published by |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
17 * the Free Software Foundation; either version 2 of the License, or |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
18 * (at your option) any later version. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
19 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
20 * MPlayer is distributed in the hope that it will be useful, |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
23 * GNU General Public License for more details. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
24 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
25 * You should have received a copy of the GNU General Public License along |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
26 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30115
diff
changeset
|
27 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
319 | 28 */ |
303 | 29 |
319 | 30 #define DEBUG |
303 | 31 |
3798
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
32 //disable asserts |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
33 #define NDEBUG |
3798
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
34 |
297 | 35 #include <stdio.h> |
36 #include <stdlib.h> | |
37 #include <fcntl.h> | |
38 #include <unistd.h> | |
39 #include <errno.h> | |
40 #include <ctype.h> | |
41 #include <assert.h> | |
42 #include <string.h> | |
43 | |
5284
0a58c2ef1da1
added missing #include config.h, removed LIBVO2 ifdef.
arpi
parents:
5263
diff
changeset
|
44 #include "config.h" |
5937 | 45 #include "mp_msg.h" |
17841
73db10d5f2e3
remove mp_msg.c dependency when compiling codec-cfg binary.
reimar
parents:
17763
diff
changeset
|
46 #ifdef CODECS2HTML |
73db10d5f2e3
remove mp_msg.c dependency when compiling codec-cfg binary.
reimar
parents:
17763
diff
changeset
|
47 #ifdef __GNUC__ |
73db10d5f2e3
remove mp_msg.c dependency when compiling codec-cfg binary.
reimar
parents:
17763
diff
changeset
|
48 #define mp_msg(t, l, m, args...) fprintf(stderr, m, ##args) |
73db10d5f2e3
remove mp_msg.c dependency when compiling codec-cfg binary.
reimar
parents:
17763
diff
changeset
|
49 #else |
23910
8fcfdfcd6c41
C99 varargs in macros can not be empty, adjust definition so it compiles
reimar
parents:
23806
diff
changeset
|
50 #define mp_msg(t, l, ...) fprintf(stderr, __VA_ARGS__) |
17841
73db10d5f2e3
remove mp_msg.c dependency when compiling codec-cfg binary.
reimar
parents:
17763
diff
changeset
|
51 #endif |
73db10d5f2e3
remove mp_msg.c dependency when compiling codec-cfg binary.
reimar
parents:
17763
diff
changeset
|
52 #endif |
5284
0a58c2ef1da1
added missing #include config.h, removed LIBVO2 ifdef.
arpi
parents:
5263
diff
changeset
|
53 |
13619 | 54 #include "help_mp.h" |
55 | |
33561
1ff6737f2177
Avoid including aviheader.h only for mmioFOURCC, it has too many
reimar
parents:
33364
diff
changeset
|
56 #include "libavutil/avutil.h" |
15305 | 57 #include "libmpcodecs/img_format.h" |
297 | 58 #include "codec-cfg.h" |
59 | |
31406
0fd1b3f1fe69
Auto-update CODEC_CFG_MIN value to release value in etc/codecs.conf.
reimar
parents:
31159
diff
changeset
|
60 #ifdef CODECS2HTML |
0fd1b3f1fe69
Auto-update CODEC_CFG_MIN value to release value in etc/codecs.conf.
reimar
parents:
31159
diff
changeset
|
61 #define CODEC_CFG_MIN 20100000 |
0fd1b3f1fe69
Auto-update CODEC_CFG_MIN value to release value in etc/codecs.conf.
reimar
parents:
31159
diff
changeset
|
62 #else |
8467
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
63 #include "codecs.conf.h" |
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
64 #endif |
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
65 |
5937 | 66 #define PRINT_LINENUM mp_msg(MSGT_CODECCFG,MSGL_ERR," at line %d\n", line_num) |
328 | 67 |
31077 | 68 #define MAX_NR_TOKEN 16 |
297 | 69 |
31077 | 70 #define MAX_LINE_LEN 1000 |
297 | 71 |
31077 | 72 #define RET_EOF -1 |
73 #define RET_EOL -2 | |
297 | 74 |
31077 | 75 #define TYPE_VIDEO 0 |
76 #define TYPE_AUDIO 1 | |
297 | 77 |
31406
0fd1b3f1fe69
Auto-update CODEC_CFG_MIN value to release value in etc/codecs.conf.
reimar
parents:
31159
diff
changeset
|
78 static int codecs_conf_release; |
11759
29eea271490e
add -codecs-file for selecting a specific codecs.conf on the comand line
attila
parents:
11388
diff
changeset
|
79 char * codecs_file = NULL; |
29eea271490e
add -codecs-file for selecting a specific codecs.conf on the comand line
attila
parents:
11388
diff
changeset
|
80 |
303 | 81 static int add_to_fourcc(char *s, char *alias, unsigned int *fourcc, |
31077 | 82 unsigned int *map) |
297 | 83 { |
31077 | 84 int i, j, freeslots; |
85 unsigned int tmp; | |
319 | 86 |
31077 | 87 /* find first unused slot */ |
88 for (i = 0; i < CODECS_MAX_FOURCC && fourcc[i] != 0xffffffff; i++) | |
89 /* NOTHING */; | |
90 freeslots = CODECS_MAX_FOURCC - i; | |
91 if (!freeslots) | |
92 goto err_out_too_many; | |
319 | 93 |
31077 | 94 do { |
33561
1ff6737f2177
Avoid including aviheader.h only for mmioFOURCC, it has too many
reimar
parents:
33364
diff
changeset
|
95 tmp = MKTAG(s[0], s[1], s[2], s[3]); |
31077 | 96 for (j = 0; j < i; j++) |
97 if (tmp == fourcc[j]) | |
98 goto err_out_duplicated; | |
99 fourcc[i] = tmp; | |
33561
1ff6737f2177
Avoid including aviheader.h only for mmioFOURCC, it has too many
reimar
parents:
33364
diff
changeset
|
100 map[i] = alias ? MKTAG(alias[0], alias[1], alias[2], alias[3]) : tmp; |
31077 | 101 s += 4; |
102 i++; | |
103 } while ((*(s++) == ',') && --freeslots); | |
319 | 104 |
31077 | 105 if (!freeslots) |
106 goto err_out_too_many; | |
107 if (*(--s) != '\0') | |
108 goto err_out_parse_error; | |
109 return 1; | |
328 | 110 err_out_duplicated: |
31077 | 111 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_DuplicateFourcc); |
112 return 0; | |
328 | 113 err_out_too_many: |
31077 | 114 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_TooManyFourccs); |
115 return 0; | |
361 | 116 err_out_parse_error: |
31077 | 117 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_ParseError); |
118 return 0; | |
319 | 119 } |
120 | |
7770 | 121 static int add_to_format(char *s, char *alias,unsigned int *fourcc, unsigned int *fourccmap) |
319 | 122 { |
31077 | 123 int i, j; |
124 char *endptr; | |
297 | 125 |
31077 | 126 /* find first unused slot */ |
127 for (i = 0; i < CODECS_MAX_FOURCC && fourcc[i] != 0xffffffff; i++) | |
128 /* NOTHING */; | |
129 if (i == CODECS_MAX_FOURCC) { | |
130 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_TooManyFourccs); | |
131 return 0; | |
132 } | |
297 | 133 |
31077 | 134 fourcc[i]=strtoul(s,&endptr,0); |
135 if (*endptr != '\0') { | |
136 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_ParseErrorFIDNotNumber); | |
137 return 0; | |
138 } | |
7770 | 139 |
31077 | 140 if(alias){ |
141 fourccmap[i]=strtoul(alias,&endptr,0); | |
142 if (*endptr != '\0') { | |
143 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_ParseErrorFIDAliasNotNumber); | |
144 return 0; | |
145 } | |
146 } else | |
147 fourccmap[i]=fourcc[i]; | |
7770 | 148 |
31077 | 149 for (j = 0; j < i; j++) |
150 if (fourcc[j] == fourcc[i]) { | |
151 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_DuplicateFID); | |
152 return 0; | |
153 } | |
300 | 154 |
31077 | 155 return 1; |
297 | 156 } |
157 | |
31159 | 158 static const struct { |
159 const char *name; | |
160 const unsigned int num; | |
161 } fmt_table[] = { | |
162 // note: due to parser deficiencies/simplicity, if one format | |
163 // name matches the beginning of another, the longer one _must_ | |
164 // come first in this list. | |
34191 | 165 {"YV12", IMGFMT_YV12}, |
166 {"I420", IMGFMT_I420}, | |
167 {"IYUV", IMGFMT_IYUV}, | |
168 {"NV12", IMGFMT_NV12}, | |
169 {"NV21", IMGFMT_NV21}, | |
170 {"YVU9", IMGFMT_YVU9}, | |
171 {"IF09", IMGFMT_IF09}, | |
172 {"444P16LE", IMGFMT_444P16_LE}, | |
173 {"444P16BE", IMGFMT_444P16_BE}, | |
174 {"444P10LE", IMGFMT_444P10_LE}, | |
175 {"444P10BE", IMGFMT_444P10_BE}, | |
176 {"422P16LE", IMGFMT_422P16_LE}, | |
177 {"422P16BE", IMGFMT_422P16_BE}, | |
178 {"420P16LE", IMGFMT_420P16_LE}, | |
179 {"420P16BE", IMGFMT_420P16_BE}, | |
180 {"444P16", IMGFMT_444P16}, | |
34923
eb76937af57e
Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents:
34805
diff
changeset
|
181 {"444P14", IMGFMT_444P14}, |
eb76937af57e
Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents:
34805
diff
changeset
|
182 {"444P12", IMGFMT_444P12}, |
34191 | 183 {"444P10", IMGFMT_444P10}, |
184 {"444P9", IMGFMT_444P9}, | |
185 {"422P16", IMGFMT_422P16}, | |
34923
eb76937af57e
Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents:
34805
diff
changeset
|
186 {"422P14", IMGFMT_422P14}, |
eb76937af57e
Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents:
34805
diff
changeset
|
187 {"422P12", IMGFMT_422P12}, |
34191 | 188 {"422P10", IMGFMT_422P10}, |
34436 | 189 {"422P9", IMGFMT_422P9}, |
34191 | 190 {"420P16", IMGFMT_420P16}, |
34923
eb76937af57e
Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents:
34805
diff
changeset
|
191 {"420P14", IMGFMT_420P14}, |
eb76937af57e
Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents:
34805
diff
changeset
|
192 {"420P12", IMGFMT_420P12}, |
34191 | 193 {"420P10", IMGFMT_420P10}, |
194 {"420P9", IMGFMT_420P9}, | |
195 {"420A", IMGFMT_420A}, | |
196 {"444P", IMGFMT_444P}, | |
34565 | 197 {"444A", IMGFMT_444A}, |
34191 | 198 {"422P", IMGFMT_422P}, |
34805
0eba64545a27
Improve Avid Meridien (AVUI) decoding with FFmpeg.
cehoyos
parents:
34793
diff
changeset
|
199 {"422A", IMGFMT_422A}, |
34191 | 200 {"411P", IMGFMT_411P}, |
201 {"440P", IMGFMT_440P}, | |
202 {"Y800", IMGFMT_Y800}, | |
34932
19212dea7a97
Add missing aequivalents for PIX_FMT_GRAY8A and PIX_FMT_GRAY16*.
cehoyos
parents:
34923
diff
changeset
|
203 {"Y8A", IMGFMT_Y8A}, |
34191 | 204 {"Y8", IMGFMT_Y8}, |
34932
19212dea7a97
Add missing aequivalents for PIX_FMT_GRAY8A and PIX_FMT_GRAY16*.
cehoyos
parents:
34923
diff
changeset
|
205 {"Y16LE", IMGFMT_Y16_LE}, |
19212dea7a97
Add missing aequivalents for PIX_FMT_GRAY8A and PIX_FMT_GRAY16*.
cehoyos
parents:
34923
diff
changeset
|
206 {"Y16BE", IMGFMT_Y16_BE}, |
34934 | 207 {"Y16", IMGFMT_Y16}, |
408 | 208 |
34191 | 209 {"YUY2", IMGFMT_YUY2}, |
210 {"UYVY", IMGFMT_UYVY}, | |
211 {"YVYU", IMGFMT_YVYU}, | |
408 | 212 |
34572 | 213 {"RGB64LE", IMGFMT_RGB64LE}, |
214 {"RGB64BE", IMGFMT_RGB64BE}, | |
34191 | 215 {"RGB48LE", IMGFMT_RGB48LE}, |
216 {"RGB48BE", IMGFMT_RGB48BE}, | |
217 {"RGB4", IMGFMT_RGB4}, | |
218 {"RGB8", IMGFMT_RGB8}, | |
219 {"RGB15", IMGFMT_RGB15}, | |
220 {"RGB16", IMGFMT_RGB16}, | |
221 {"RGB24", IMGFMT_RGB24}, | |
222 {"RGB32", IMGFMT_RGB32}, | |
34501 | 223 {"RGBA", IMGFMT_RGBA}, |
34191 | 224 {"BGR4", IMGFMT_BGR4}, |
225 {"BGR8", IMGFMT_BGR8}, | |
34793
1ce075a9932b
Support new colour spaces for FFmpeg camstudio decoding on big-endian.
cehoyos
parents:
34572
diff
changeset
|
226 {"BGR15LE", IMGFMT_BGR15LE}, |
34191 | 227 {"BGR15", IMGFMT_BGR15}, |
228 {"BGR16", IMGFMT_BGR16}, | |
229 {"BGR24", IMGFMT_BGR24}, | |
230 {"BGR32", IMGFMT_BGR32}, | |
34509
bdca973d87a5
Fix 32-bit targa playback with current FFmpeg on big-endian.
cehoyos
parents:
34501
diff
changeset
|
231 {"BGRA", IMGFMT_BGRA}, |
34191 | 232 {"RGB1", IMGFMT_RGB1}, |
233 {"BGR1", IMGFMT_BGR1}, | |
234 {"GBR24P", IMGFMT_GBR24P}, | |
34923
eb76937af57e
Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents:
34805
diff
changeset
|
235 {"GBR12P", IMGFMT_GBR12P}, |
eb76937af57e
Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
cehoyos
parents:
34805
diff
changeset
|
236 {"GBR14P", IMGFMT_GBR14P}, |
1871 | 237 |
34191 | 238 {"MPES", IMGFMT_MPEGPES}, |
239 {"ZRMJPEGNI", IMGFMT_ZRMJPEGNI}, | |
240 {"ZRMJPEGIT", IMGFMT_ZRMJPEGIT}, | |
241 {"ZRMJPEGIB", IMGFMT_ZRMJPEGIB}, | |
10316 | 242 |
34191 | 243 {"IDCT_MPEG2", IMGFMT_XVMC_IDCT_MPEG2}, |
244 {"MOCO_MPEG2", IMGFMT_XVMC_MOCO_MPEG2}, | |
10316 | 245 |
34191 | 246 {"VDPAU_MPEG1", IMGFMT_VDPAU_MPEG1}, |
247 {"VDPAU_MPEG2", IMGFMT_VDPAU_MPEG2}, | |
248 {"VDPAU_H264", IMGFMT_VDPAU_H264}, | |
249 {"VDPAU_WMV3", IMGFMT_VDPAU_WMV3}, | |
250 {"VDPAU_VC1", IMGFMT_VDPAU_VC1}, | |
251 {"VDPAU_MPEG4", IMGFMT_VDPAU_MPEG4}, | |
28516
79b0bd20433e
Add support for image formats and codecs used by VDPAU
reimar
parents:
27343
diff
changeset
|
252 |
31159 | 253 {NULL, 0} |
254 }; | |
408 | 255 |
607 | 256 |
4675 | 257 static int add_to_inout(char *sfmt, char *sflags, unsigned int *outfmt, |
31077 | 258 unsigned char *outflags) |
607 | 259 { |
260 | |
31077 | 261 static char *flagstr[] = { |
262 "flip", | |
263 "noflip", | |
264 "yuvhack", | |
265 "query", | |
266 "static", | |
267 NULL | |
268 }; | |
299 | 269 |
31077 | 270 int i, j, freeslots; |
271 unsigned char flags; | |
297 | 272 |
31077 | 273 for (i = 0; i < CODECS_MAX_OUTFMT && outfmt[i] != 0xffffffff; i++) |
274 /* NOTHING */; | |
275 freeslots = CODECS_MAX_OUTFMT - i; | |
276 if (!freeslots) | |
277 goto err_out_too_many; | |
297 | 278 |
31077 | 279 flags = 0; |
280 if(sflags) { | |
281 do { | |
282 for (j = 0; flagstr[j] != NULL; j++) | |
283 if (!strncmp(sflags, flagstr[j], | |
284 strlen(flagstr[j]))) | |
285 break; | |
286 if (flagstr[j] == NULL) | |
287 goto err_out_parse_error; | |
288 flags|=(1<<j); | |
289 sflags+=strlen(flagstr[j]); | |
290 } while (*(sflags++) == ','); | |
361 | 291 |
31077 | 292 if (*(--sflags) != '\0') |
293 goto err_out_parse_error; | |
294 } | |
297 | 295 |
31077 | 296 do { |
297 for (j = 0; fmt_table[j].name != NULL; j++) | |
298 if (!strncmp(sfmt, fmt_table[j].name, strlen(fmt_table[j].name))) | |
299 break; | |
300 if (fmt_table[j].name == NULL) | |
301 goto err_out_parse_error; | |
302 outfmt[i] = fmt_table[j].num; | |
303 outflags[i] = flags; | |
304 ++i; | |
305 sfmt+=strlen(fmt_table[j].name); | |
306 } while ((*(sfmt++) == ',') && --freeslots); | |
319 | 307 |
31077 | 308 if (!freeslots) |
309 goto err_out_too_many; | |
319 | 310 |
31077 | 311 if (*(--sfmt) != '\0') |
312 goto err_out_parse_error; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
313 |
31077 | 314 return 1; |
328 | 315 err_out_too_many: |
31077 | 316 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_TooManyOut); |
317 return 0; | |
361 | 318 err_out_parse_error: |
31077 | 319 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_ParseError); |
320 return 0; | |
297 | 321 } |
322 | |
7180
28677d779205
-afm/-vfm migration from ID (int) to NAME (string) - simplifies code and makes dlopen()'ing possible
arpi
parents:
6927
diff
changeset
|
323 #if 0 |
303 | 324 static short get_driver(char *s,int audioflag) |
297 | 325 { |
31077 | 326 static char *audiodrv[] = { |
327 "null", | |
328 "mp3lib", | |
329 "pcm", | |
330 "libac3", | |
331 "acm", | |
332 "alaw", | |
333 "msgsm", | |
334 "dshow", | |
335 "dvdpcm", | |
336 "hwac3", | |
337 "libvorbis", | |
338 "ffmpeg", | |
339 "libmad", | |
340 "msadpcm", | |
341 "liba52", | |
342 "g72x", | |
343 "imaadpcm", | |
344 "dk4adpcm", | |
345 "dk3adpcm", | |
346 "roqaudio", | |
347 "faad", | |
348 "realaud", | |
349 "libdv", | |
350 NULL | |
351 }; | |
352 static char *videodrv[] = { | |
353 "null", | |
354 "libmpeg2", | |
355 "vfw", | |
356 "dshow", | |
357 "ffmpeg", | |
358 "vfwex", | |
359 "raw", | |
360 "msrle", | |
361 "xanim", | |
362 "msvidc", | |
363 "fli", | |
364 "cinepak", | |
365 "qtrle", | |
366 "nuv", | |
367 "cyuv", | |
368 "qtsmc", | |
369 "ducktm1", | |
370 "roqvideo", | |
371 "qtrpza", | |
372 "mpng", | |
373 "ijpg", | |
374 "zlib", | |
375 "mpegpes", | |
376 "zrmjpeg", | |
377 "realvid", | |
378 "xvid", | |
379 "libdv", | |
380 NULL | |
381 }; | |
382 char **drv=audioflag?audiodrv:videodrv; | |
383 int i; | |
6863 | 384 |
31077 | 385 for(i=0;drv[i];i++) if(!strcmp(s,drv[i])) return i; |
301 | 386 |
31077 | 387 return -1; |
297 | 388 } |
7180
28677d779205
-afm/-vfm migration from ID (int) to NAME (string) - simplifies code and makes dlopen()'ing possible
arpi
parents:
6927
diff
changeset
|
389 #endif |
297 | 390 |
328 | 391 static int validate_codec(codecs_t *c, int type) |
319 | 392 { |
31077 | 393 unsigned int i; |
394 char *tmp_name = c->name; | |
328 | 395 |
31077 | 396 for (i = 0; i < strlen(tmp_name) && isalnum(tmp_name[i]); i++) |
397 /* NOTHING */; | |
3408 | 398 |
31077 | 399 if (i < strlen(tmp_name)) { |
400 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_InvalidCodecName, c->name); | |
401 return 0; | |
402 } | |
3408 | 403 |
31077 | 404 if (!c->info) |
405 c->info = strdup(c->name); | |
3408 | 406 |
407 #if 0 | |
31077 | 408 if (c->fourcc[0] == 0xffffffff) { |
409 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecLacksFourcc, c->name); | |
410 return 0; | |
411 } | |
13936
589b227e3367
fix crash when a "driver" line is missing in codecs.conf.
reimar
parents:
13807
diff
changeset
|
412 #endif |
3408 | 413 |
31077 | 414 if (!c->drv) { |
415 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecLacksDriver, c->name); | |
416 return 0; | |
417 } | |
3408 | 418 |
419 #if 0 | |
32394
914208d188b9
Remove #warning preprocessor directives or replace them by suitable comments.
diego
parents:
31409
diff
changeset
|
420 //FIXME: codec->driver == 4;... <- this should not be put in here... |
914208d188b9
Remove #warning preprocessor directives or replace them by suitable comments.
diego
parents:
31409
diff
changeset
|
421 //FIXME: Where are they defined ???????????? |
31077 | 422 if (!c->dll && (c->driver == 4 || |
423 (c->driver == 2 && type == TYPE_VIDEO))) { | |
424 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecNeedsDLL, c->name); | |
425 return 0; | |
426 } | |
32394
914208d188b9
Remove #warning preprocessor directives or replace them by suitable comments.
diego
parents:
31409
diff
changeset
|
427 // FIXME: Can guid.f1 be 0? How does one know that it was not given? |
31077 | 428 // if (!(codec->flags & CODECS_FLAG_AUDIO) && codec->driver == 4) |
328 | 429 |
31077 | 430 if (type == TYPE_VIDEO) |
431 if (c->outfmt[0] == 0xffffffff) { | |
432 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecNeedsOutfmt, c->name); | |
433 return 0; | |
434 } | |
329 | 435 #endif |
31077 | 436 return 1; |
319 | 437 } |
438 | |
439 static int add_comment(char *s, char **d) | |
440 { | |
31077 | 441 int pos; |
319 | 442 |
31077 | 443 if (!*d) |
444 pos = 0; | |
445 else { | |
446 pos = strlen(*d); | |
447 (*d)[pos++] = '\n'; | |
448 } | |
449 if (!(*d = realloc(*d, pos + strlen(s) + 1))) { | |
450 mp_msg(MSGT_CODECCFG,MSGL_FATAL,MSGTR_CantAllocateComment); | |
451 return 0; | |
452 } | |
453 strcpy(*d + pos, s); | |
454 return 1; | |
319 | 455 } |
297 | 456 |
361 | 457 static short get_cpuflags(char *s) |
458 { | |
31077 | 459 static char *flagstr[] = { |
460 "mmx", | |
461 "sse", | |
462 "3dnow", | |
463 NULL | |
464 }; | |
465 int i; | |
466 short flags = 0; | |
361 | 467 |
31077 | 468 do { |
469 for (i = 0; flagstr[i]; i++) | |
470 if (!strncmp(s, flagstr[i], strlen(flagstr[i]))) | |
471 break; | |
472 if (!flagstr[i]) | |
473 goto err_out_parse_error; | |
474 flags |= 1<<i; | |
475 s += strlen(flagstr[i]); | |
476 } while (*(s++) == ','); | |
361 | 477 |
31077 | 478 if (*(--s) != '\0') |
479 goto err_out_parse_error; | |
361 | 480 |
31077 | 481 return flags; |
361 | 482 err_out_parse_error: |
31077 | 483 return 0; |
361 | 484 } |
485 | |
328 | 486 static FILE *fp; |
487 static int line_num = 0; | |
488 static char *line; | |
489 static char *token[MAX_NR_TOKEN]; | |
6200
e604be87613d
codecs.conf versioning - patch by Joey Parrish <joey@yunamusic.com>
arpi
parents:
6103
diff
changeset
|
490 static int read_nextline = 1; |
328 | 491 |
492 static int get_token(int min, int max) | |
297 | 493 { |
31077 | 494 static int line_pos; |
495 int i; | |
496 char c; | |
328 | 497 |
31077 | 498 if (max >= MAX_NR_TOKEN) { |
499 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_GetTokenMaxNotLessThanMAX_NR_TOKEN); | |
500 goto out_eof; | |
501 } | |
328 | 502 |
31077 | 503 memset(token, 0x00, sizeof(*token) * max); |
328 | 504 |
31077 | 505 if (read_nextline) { |
506 if (!fgets(line, MAX_LINE_LEN, fp)) | |
507 goto out_eof; | |
508 line_pos = 0; | |
509 ++line_num; | |
510 read_nextline = 0; | |
511 } | |
512 for (i = 0; i < max; i++) { | |
513 while (isspace(line[line_pos])) | |
514 ++line_pos; | |
515 if (line[line_pos] == '\0' || line[line_pos] == '#' || | |
516 line[line_pos] == ';') { | |
517 read_nextline = 1; | |
518 if (i >= min) | |
519 goto out_ok; | |
520 goto out_eol; | |
521 } | |
522 token[i] = line + line_pos; | |
523 c = line[line_pos]; | |
524 if (c == '"' || c == '\'') { | |
525 token[i]++; | |
526 while (line[++line_pos] != c && line[line_pos]) | |
527 /* NOTHING */; | |
528 } else { | |
529 for (/* NOTHING */; !isspace(line[line_pos]) && | |
530 line[line_pos]; line_pos++) | |
531 /* NOTHING */; | |
532 } | |
533 if (!line[line_pos]) { | |
534 read_nextline = 1; | |
535 if (i >= min - 1) | |
536 goto out_ok; | |
537 goto out_eol; | |
538 } | |
539 line[line_pos] = '\0'; | |
540 line_pos++; | |
541 } | |
328 | 542 out_ok: |
31077 | 543 return i; |
328 | 544 out_eof: |
31077 | 545 read_nextline = 1; |
546 return RET_EOF; | |
328 | 547 out_eol: |
31077 | 548 return RET_EOL; |
328 | 549 } |
550 | |
551 static codecs_t *video_codecs=NULL; | |
552 static codecs_t *audio_codecs=NULL; | |
553 static int nr_vcodecs = 0; | |
554 static int nr_acodecs = 0; | |
555 | |
18980
ed69754aa58d
Marks several string parameters as const when they are not modified in the function, Patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents:
18034
diff
changeset
|
556 int parse_codec_cfg(const char *cfgfile) |
328 | 557 { |
31077 | 558 codecs_t *codec = NULL; // current codec |
559 codecs_t **codecsp = NULL;// points to audio_codecs or to video_codecs | |
560 char *endptr; // strtoul()... | |
561 int *nr_codecsp; | |
562 int codec_type; /* TYPE_VIDEO/TYPE_AUDIO */ | |
563 int tmp, i; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
564 |
31077 | 565 // in case we call it a second time |
566 codecs_uninit_free(); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
567 |
31077 | 568 nr_vcodecs = 0; |
569 nr_acodecs = 0; | |
297 | 570 |
31077 | 571 if(cfgfile==NULL) { |
8467
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
572 #ifdef CODECS2HTML |
31077 | 573 return 0; |
8467
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
574 #else |
31077 | 575 video_codecs = builtin_video_codecs; |
576 audio_codecs = builtin_audio_codecs; | |
577 nr_vcodecs = sizeof(builtin_video_codecs)/sizeof(codecs_t); | |
578 nr_acodecs = sizeof(builtin_audio_codecs)/sizeof(codecs_t); | |
579 return 1; | |
8467
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
580 #endif |
31077 | 581 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
582 |
33844
77bf38091051
Clarify console output when reading optional configuration files.
diego
parents:
33843
diff
changeset
|
583 mp_msg(MSGT_CODECCFG, MSGL_V, "Reading optional codecs config file %s: ", cfgfile); |
297 | 584 |
31077 | 585 if ((fp = fopen(cfgfile, "r")) == NULL) { |
33844
77bf38091051
Clarify console output when reading optional configuration files.
diego
parents:
33843
diff
changeset
|
586 mp_msg(MSGT_CODECCFG, MSGL_V, "%s\n", strerror(errno)); |
31077 | 587 return 0; |
588 } | |
297 | 589 |
31077 | 590 if ((line = malloc(MAX_LINE_LEN + 1)) == NULL) { |
591 mp_msg(MSGT_CODECCFG,MSGL_FATAL,MSGTR_CantGetMemoryForLine, strerror(errno)); | |
592 return 0; | |
593 } | |
594 read_nextline = 1; | |
297 | 595 |
31077 | 596 /* |
597 * this only catches release lines at the start of | |
598 * codecs.conf, before audiocodecs and videocodecs. | |
599 */ | |
600 while ((tmp = get_token(1, 1)) == RET_EOL) | |
601 /* NOTHING */; | |
602 if (tmp == RET_EOF) | |
603 goto out; | |
604 if (!strcmp(token[0], "release")) { | |
605 if (get_token(1, 2) < 0) | |
606 goto err_out_parse_error; | |
607 tmp = atoi(token[0]); | |
608 if (tmp < CODEC_CFG_MIN) | |
609 goto err_out_release_num; | |
31406
0fd1b3f1fe69
Auto-update CODEC_CFG_MIN value to release value in etc/codecs.conf.
reimar
parents:
31159
diff
changeset
|
610 codecs_conf_release = tmp; |
31077 | 611 while ((tmp = get_token(1, 1)) == RET_EOL) |
612 /* NOTHING */; | |
613 if (tmp == RET_EOF) | |
614 goto out; | |
615 } else | |
616 goto err_out_release_num; | |
6200
e604be87613d
codecs.conf versioning - patch by Joey Parrish <joey@yunamusic.com>
arpi
parents:
6103
diff
changeset
|
617 |
31077 | 618 /* |
619 * check if the next block starts with 'audiocodec' or | |
620 * with 'videocodec' | |
621 */ | |
622 if (!strcmp(token[0], "audiocodec") || !strcmp(token[0], "videocodec")) | |
623 goto loop_enter; | |
624 goto err_out_parse_error; | |
328 | 625 |
31077 | 626 while ((tmp = get_token(1, 1)) != RET_EOF) { |
627 if (tmp == RET_EOL) | |
628 continue; | |
629 if (!strcmp(token[0], "audiocodec") || | |
630 !strcmp(token[0], "videocodec")) { | |
631 if (!validate_codec(codec, codec_type)) | |
632 goto err_out_not_valid; | |
633 loop_enter: | |
634 if (*token[0] == 'v') { | |
635 codec_type = TYPE_VIDEO; | |
636 nr_codecsp = &nr_vcodecs; | |
637 codecsp = &video_codecs; | |
638 } else if (*token[0] == 'a') { | |
639 codec_type = TYPE_AUDIO; | |
640 nr_codecsp = &nr_acodecs; | |
641 codecsp = &audio_codecs; | |
361 | 642 #ifdef DEBUG |
31077 | 643 } else { |
644 mp_msg(MSGT_CODECCFG,MSGL_ERR,"picsba\n"); | |
645 goto err_out; | |
361 | 646 #endif |
31077 | 647 } |
648 if (!(*codecsp = realloc(*codecsp, | |
649 sizeof(codecs_t) * (*nr_codecsp + 2)))) { | |
650 mp_msg(MSGT_CODECCFG,MSGL_FATAL,MSGTR_CantReallocCodecsp, strerror(errno)); | |
651 goto err_out; | |
652 } | |
653 codec=*codecsp + *nr_codecsp; | |
654 ++*nr_codecsp; | |
655 memset(codec,0,sizeof(codecs_t)); | |
656 memset(codec->fourcc, 0xff, sizeof(codec->fourcc)); | |
657 memset(codec->outfmt, 0xff, sizeof(codec->outfmt)); | |
658 memset(codec->infmt, 0xff, sizeof(codec->infmt)); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
659 |
31077 | 660 if (get_token(1, 1) < 0) |
661 goto err_out_parse_error; | |
662 for (i = 0; i < *nr_codecsp - 1; i++) { | |
663 if(( (*codecsp)[i].name!=NULL) && | |
664 (!strcmp(token[0], (*codecsp)[i].name)) ) { | |
665 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecNameNotUnique, token[0]); | |
666 goto err_out_print_linenum; | |
667 } | |
668 } | |
669 if (!(codec->name = strdup(token[0]))) { | |
670 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantStrdupName, strerror(errno)); | |
671 goto err_out; | |
672 } | |
673 } else if (!strcmp(token[0], "info")) { | |
674 if (codec->info || get_token(1, 1) < 0) | |
675 goto err_out_parse_error; | |
676 if (!(codec->info = strdup(token[0]))) { | |
677 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantStrdupInfo, strerror(errno)); | |
678 goto err_out; | |
679 } | |
680 } else if (!strcmp(token[0], "comment")) { | |
681 if (get_token(1, 1) < 0) | |
682 goto err_out_parse_error; | |
683 add_comment(token[0], &codec->comment); | |
684 } else if (!strcmp(token[0], "fourcc")) { | |
685 if (get_token(1, 2) < 0) | |
686 goto err_out_parse_error; | |
687 if (!add_to_fourcc(token[0], token[1], | |
688 codec->fourcc, | |
689 codec->fourccmap)) | |
690 goto err_out_print_linenum; | |
691 } else if (!strcmp(token[0], "format")) { | |
692 if (get_token(1, 2) < 0) | |
693 goto err_out_parse_error; | |
694 if (!add_to_format(token[0], token[1], | |
695 codec->fourcc,codec->fourccmap)) | |
696 goto err_out_print_linenum; | |
697 } else if (!strcmp(token[0], "driver")) { | |
698 if (get_token(1, 1) < 0) | |
699 goto err_out_parse_error; | |
700 if (!(codec->drv = strdup(token[0]))) { | |
701 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantStrdupDriver, strerror(errno)); | |
702 goto err_out; | |
703 } | |
704 } else if (!strcmp(token[0], "dll")) { | |
705 if (get_token(1, 1) < 0) | |
706 goto err_out_parse_error; | |
707 if (!(codec->dll = strdup(token[0]))) { | |
708 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantStrdupDLL, strerror(errno)); | |
709 goto err_out; | |
710 } | |
711 } else if (!strcmp(token[0], "guid")) { | |
712 if (get_token(11, 11) < 0) | |
713 goto err_out_parse_error; | |
714 codec->guid.f1=strtoul(token[0],&endptr,0); | |
715 if ((*endptr != ',' || *(endptr + 1) != '\0') && | |
716 *endptr != '\0') | |
717 goto err_out_parse_error; | |
718 codec->guid.f2=strtoul(token[1],&endptr,0); | |
719 if ((*endptr != ',' || *(endptr + 1) != '\0') && | |
720 *endptr != '\0') | |
721 goto err_out_parse_error; | |
722 codec->guid.f3=strtoul(token[2],&endptr,0); | |
723 if ((*endptr != ',' || *(endptr + 1) != '\0') && | |
724 *endptr != '\0') | |
725 goto err_out_parse_error; | |
726 for (i = 0; i < 8; i++) { | |
727 codec->guid.f4[i]=strtoul(token[i + 3],&endptr,0); | |
728 if ((*endptr != ',' || *(endptr + 1) != '\0') && | |
729 *endptr != '\0') | |
730 goto err_out_parse_error; | |
731 } | |
732 } else if (!strcmp(token[0], "out")) { | |
733 if (get_token(1, 2) < 0) | |
734 goto err_out_parse_error; | |
735 if (!add_to_inout(token[0], token[1], codec->outfmt, | |
736 codec->outflags)) | |
737 goto err_out_print_linenum; | |
738 } else if (!strcmp(token[0], "in")) { | |
739 if (get_token(1, 2) < 0) | |
740 goto err_out_parse_error; | |
741 if (!add_to_inout(token[0], token[1], codec->infmt, | |
742 codec->inflags)) | |
743 goto err_out_print_linenum; | |
744 } else if (!strcmp(token[0], "flags")) { | |
745 if (get_token(1, 1) < 0) | |
746 goto err_out_parse_error; | |
747 if (!strcmp(token[0], "seekable")) | |
748 codec->flags |= CODECS_FLAG_SEEKABLE; | |
749 else | |
750 if (!strcmp(token[0], "align16")) | |
751 codec->flags |= CODECS_FLAG_ALIGN16; | |
752 else | |
753 goto err_out_parse_error; | |
754 } else if (!strcmp(token[0], "status")) { | |
755 if (get_token(1, 1) < 0) | |
756 goto err_out_parse_error; | |
757 if (!strcasecmp(token[0], "working")) | |
758 codec->status = CODECS_STATUS_WORKING; | |
759 else if (!strcasecmp(token[0], "crashing")) | |
760 codec->status = CODECS_STATUS_NOT_WORKING; | |
761 else if (!strcasecmp(token[0], "untested")) | |
762 codec->status = CODECS_STATUS_UNTESTED; | |
763 else if (!strcasecmp(token[0], "buggy")) | |
764 codec->status = CODECS_STATUS_PROBLEMS; | |
765 else | |
766 goto err_out_parse_error; | |
767 } else if (!strcmp(token[0], "cpuflags")) { | |
768 if (get_token(1, 1) < 0) | |
769 goto err_out_parse_error; | |
770 if (!(codec->cpuflags = get_cpuflags(token[0]))) | |
771 goto err_out_parse_error; | |
772 } else | |
773 goto err_out_parse_error; | |
774 } | |
775 if (!validate_codec(codec, codec_type)) | |
776 goto err_out_not_valid; | |
777 mp_msg(MSGT_CODECCFG,MSGL_INFO,MSGTR_AudioVideoCodecTotals, nr_acodecs, nr_vcodecs); | |
778 if(video_codecs) video_codecs[nr_vcodecs].name = NULL; | |
779 if(audio_codecs) audio_codecs[nr_acodecs].name = NULL; | |
297 | 780 out: |
31077 | 781 free(line); |
782 line=NULL; | |
783 fclose(fp); | |
784 return 1; | |
3798
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
785 |
328 | 786 err_out_parse_error: |
31077 | 787 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_ParseError); |
361 | 788 err_out_print_linenum: |
31077 | 789 PRINT_LINENUM; |
297 | 790 err_out: |
31077 | 791 codecs_uninit_free(); |
3798
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
792 |
31077 | 793 free(line); |
794 line=NULL; | |
795 line_num = 0; | |
796 fclose(fp); | |
797 return 0; | |
328 | 798 err_out_not_valid: |
31077 | 799 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecDefinitionIncorrect); |
800 goto err_out_print_linenum; | |
6200
e604be87613d
codecs.conf versioning - patch by Joey Parrish <joey@yunamusic.com>
arpi
parents:
6103
diff
changeset
|
801 err_out_release_num: |
31077 | 802 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_OutdatedCodecsConf); |
803 goto err_out_print_linenum; | |
297 | 804 } |
805 | |
13807
b014091b4417
Memory Free function Fix, based on patch by Wei Jiang <jiangw98@yahoo.com>
faust3
parents:
13619
diff
changeset
|
806 static void codecs_free(codecs_t* codecs,int count) { |
31077 | 807 int i; |
808 for ( i = 0; i < count; i++) | |
809 if ( codecs[i].name ) { | |
32511
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
32394
diff
changeset
|
810 free(codecs[i].name); |
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
32394
diff
changeset
|
811 free(codecs[i].info); |
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
32394
diff
changeset
|
812 free(codecs[i].comment); |
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
32394
diff
changeset
|
813 free(codecs[i].dll); |
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
32394
diff
changeset
|
814 free(codecs[i].drv); |
31077 | 815 } |
32511
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
32394
diff
changeset
|
816 free(codecs); |
13807
b014091b4417
Memory Free function Fix, based on patch by Wei Jiang <jiangw98@yahoo.com>
faust3
parents:
13619
diff
changeset
|
817 } |
b014091b4417
Memory Free function Fix, based on patch by Wei Jiang <jiangw98@yahoo.com>
faust3
parents:
13619
diff
changeset
|
818 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17120
diff
changeset
|
819 void codecs_uninit_free(void) { |
31077 | 820 if (video_codecs) |
821 codecs_free(video_codecs,nr_vcodecs); | |
822 video_codecs=NULL; | |
823 if (audio_codecs) | |
824 codecs_free(audio_codecs,nr_acodecs); | |
825 audio_codecs=NULL; | |
13807
b014091b4417
Memory Free function Fix, based on patch by Wei Jiang <jiangw98@yahoo.com>
faust3
parents:
13619
diff
changeset
|
826 } |
b014091b4417
Memory Free function Fix, based on patch by Wei Jiang <jiangw98@yahoo.com>
faust3
parents:
13619
diff
changeset
|
827 |
332 | 828 codecs_t *find_audio_codec(unsigned int fourcc, unsigned int *fourccmap, |
31077 | 829 codecs_t *start, int force) |
328 | 830 { |
31077 | 831 return find_codec(fourcc, fourccmap, start, 1, force); |
328 | 832 } |
833 | |
332 | 834 codecs_t *find_video_codec(unsigned int fourcc, unsigned int *fourccmap, |
31077 | 835 codecs_t *start, int force) |
328 | 836 { |
31077 | 837 return find_codec(fourcc, fourccmap, start, 0, force); |
328 | 838 } |
839 | |
332 | 840 codecs_t* find_codec(unsigned int fourcc,unsigned int *fourccmap, |
31077 | 841 codecs_t *start, int audioflag, int force) |
328 | 842 { |
31077 | 843 int i, j; |
844 codecs_t *c; | |
328 | 845 |
628 | 846 #if 0 |
31077 | 847 if (start) { |
848 for (/* NOTHING */; start->name; start++) { | |
849 for (j = 0; j < CODECS_MAX_FOURCC; j++) { | |
850 if (start->fourcc[j] == fourcc) { | |
851 if (fourccmap) | |
852 *fourccmap = start->fourccmap[j]; | |
853 return start; | |
854 } | |
855 } | |
856 } | |
857 } else | |
628 | 858 #endif |
31077 | 859 { |
860 if (audioflag) { | |
861 i = nr_acodecs; | |
862 c = audio_codecs; | |
863 } else { | |
864 i = nr_vcodecs; | |
865 c = video_codecs; | |
866 } | |
867 if(!i) return NULL; | |
868 for (/* NOTHING */; i--; c++) { | |
869 if(start && c<=start) continue; | |
870 for (j = 0; j < CODECS_MAX_FOURCC; j++) { | |
871 // FIXME: do NOT hardwire 'null' name here: | |
872 if (c->fourcc[j]==fourcc || !strcmp(c->drv,"null")) { | |
873 if (fourccmap) | |
874 *fourccmap = c->fourccmap[j]; | |
875 return c; | |
876 } | |
877 } | |
878 if (force) return c; | |
879 } | |
880 } | |
881 return NULL; | |
303 | 882 } |
883 | |
25661
293aeec83153
Replace the persistent CODECS_FLAG_SELECTED by a local "stringset" with
reimar
parents:
25247
diff
changeset
|
884 void stringset_init(stringset_t *set) { |
31077 | 885 *set = calloc(1, sizeof(char *)); |
25661
293aeec83153
Replace the persistent CODECS_FLAG_SELECTED by a local "stringset" with
reimar
parents:
25247
diff
changeset
|
886 } |
293aeec83153
Replace the persistent CODECS_FLAG_SELECTED by a local "stringset" with
reimar
parents:
25247
diff
changeset
|
887 |
293aeec83153
Replace the persistent CODECS_FLAG_SELECTED by a local "stringset" with
reimar
parents:
25247
diff
changeset
|
888 void stringset_free(stringset_t *set) { |
31077 | 889 int count = 0; |
890 while ((*set)[count]) free((*set)[count++]); | |
891 free(*set); | |
892 *set = NULL; | |
7505 | 893 } |
894 | |
25661
293aeec83153
Replace the persistent CODECS_FLAG_SELECTED by a local "stringset" with
reimar
parents:
25247
diff
changeset
|
895 void stringset_add(stringset_t *set, const char *str) { |
31077 | 896 int count = 0; |
897 while ((*set)[count]) count++; | |
898 count++; | |
899 *set = realloc(*set, sizeof(char *) * (count + 1)); | |
900 (*set)[count - 1] = strdup(str); | |
901 (*set)[count] = NULL; | |
25661
293aeec83153
Replace the persistent CODECS_FLAG_SELECTED by a local "stringset" with
reimar
parents:
25247
diff
changeset
|
902 } |
293aeec83153
Replace the persistent CODECS_FLAG_SELECTED by a local "stringset" with
reimar
parents:
25247
diff
changeset
|
903 |
293aeec83153
Replace the persistent CODECS_FLAG_SELECTED by a local "stringset" with
reimar
parents:
25247
diff
changeset
|
904 int stringset_test(stringset_t *set, const char *str) { |
31077 | 905 stringset_t s; |
906 for (s = *set; *s; s++) | |
907 if (strcmp(*s, str) == 0) | |
908 return 1; | |
909 return 0; | |
5325
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
910 } |
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
911 |
1983 | 912 void list_codecs(int audioflag){ |
31077 | 913 int i; |
914 codecs_t *c; | |
1983 | 915 |
31077 | 916 if (audioflag) { |
917 i = nr_acodecs; | |
918 c = audio_codecs; | |
919 mp_msg(MSGT_CODECCFG,MSGL_INFO,"ac: afm: status: info: [lib/dll]\n"); | |
920 } else { | |
921 i = nr_vcodecs; | |
922 c = video_codecs; | |
923 mp_msg(MSGT_CODECCFG,MSGL_INFO,"vc: vfm: status: info: [lib/dll]\n"); | |
924 } | |
925 if(!i) return; | |
926 for (/* NOTHING */; i--; c++) { | |
927 char* s="unknown "; | |
928 switch(c->status){ | |
929 case CODECS_STATUS_WORKING: s="working ";break; | |
930 case CODECS_STATUS_PROBLEMS: s="problems";break; | |
931 case CODECS_STATUS_NOT_WORKING: s="crashing";break; | |
932 case CODECS_STATUS_UNTESTED: s="untested";break; | |
933 } | |
934 if(c->dll) | |
935 mp_msg(MSGT_CODECCFG,MSGL_INFO,"%-11s %-9s %s %s [%s]\n",c->name,c->drv,s,c->info,c->dll); | |
936 else | |
937 mp_msg(MSGT_CODECCFG,MSGL_INFO,"%-11s %-9s %s %s\n",c->name,c->drv,s,c->info); | |
938 } | |
1983 | 939 } |
940 | |
941 | |
607 | 942 #ifdef CODECS2HTML |
31408 | 943 static void wrapline(FILE *f2,char *s){ |
607 | 944 int c; |
945 if(!s){ | |
946 fprintf(f2,"-"); | |
947 return; | |
948 } | |
949 while((c=*s++)){ | |
950 if(c==',') fprintf(f2,"<br>"); else fputc(c,f2); | |
951 } | |
952 } | |
953 | |
31409 | 954 static void parsehtml(FILE *f1,FILE *f2,codecs_t *codec){ |
31077 | 955 int c,d; |
956 while((c=fgetc(f1))>=0){ | |
957 if(c!='%'){ | |
958 fputc(c,f2); | |
959 continue; | |
960 } | |
961 d=fgetc(f1); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
962 |
31077 | 963 switch(d){ |
964 case '.': | |
965 return; // end of section | |
966 case 'n': | |
967 wrapline(f2,codec->name); break; | |
968 case 'i': | |
969 wrapline(f2,codec->info); break; | |
970 case 'c': | |
971 wrapline(f2,codec->comment); break; | |
972 case 'd': | |
973 wrapline(f2,codec->dll); break; | |
974 case 'D': | |
975 fprintf(f2,"%c",!strcmp(codec->drv,"dshow")?'+':'-'); break; | |
976 case 'F': | |
977 for(d=0;d<CODECS_MAX_FOURCC;d++) | |
978 if(!d || codec->fourcc[d]!=0xFFFFFFFF) | |
979 fprintf(f2,"%s%.4s",d?"<br>":"",(codec->fourcc[d]==0xFFFFFFFF || codec->fourcc[d]<0x20202020)?!d?"-":"":(char*) &codec->fourcc[d]); | |
980 break; | |
981 case 'f': | |
982 for(d=0;d<CODECS_MAX_FOURCC;d++) | |
983 if(codec->fourcc[d]!=0xFFFFFFFF) | |
984 fprintf(f2,"%s0x%X",d?"<br>":"",codec->fourcc[d]); | |
985 break; | |
986 case 'Y': | |
987 for(d=0;d<CODECS_MAX_OUTFMT;d++) | |
988 if(codec->outfmt[d]!=0xFFFFFFFF){ | |
989 for (c=0; fmt_table[c].name; c++) | |
990 if(fmt_table[c].num==codec->outfmt[d]) break; | |
991 if(fmt_table[c].name) | |
992 fprintf(f2,"%s%s",d?"<br>":"",fmt_table[c].name); | |
993 } | |
994 break; | |
995 default: | |
996 fputc(c,f2); | |
997 fputc(d,f2); | |
607 | 998 } |
31077 | 999 } |
607 | 1000 } |
1001 | |
1002 void skiphtml(FILE *f1){ | |
31077 | 1003 int c,d; |
1004 while((c=fgetc(f1))>=0){ | |
1005 if(c!='%'){ | |
1006 continue; | |
607 | 1007 } |
31077 | 1008 d=fgetc(f1); |
1009 if(d=='.') return; // end of section | |
1010 } | |
607 | 1011 } |
1012 | |
29115
1e78a310487e
Change type of first argument of the print_int_array function from int to
diego
parents:
28747
diff
changeset
|
1013 static void print_int_array(const unsigned int* a, int size) |
8467
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
1014 { |
31077 | 1015 printf("{ "); |
1016 while (size--) | |
1017 if(abs(*a)<256) | |
1018 printf("%d%s", *a++, size?", ":""); | |
1019 else | |
1020 printf("0x%X%s", *a++, size?", ":""); | |
1021 printf(" }"); | |
8467
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
1022 } |
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
1023 |
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
1024 static void print_char_array(const unsigned char* a, int size) |
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
1025 { |
31077 | 1026 printf("{ "); |
1027 while (size--) | |
1028 if((*a)<10) | |
1029 printf("%d%s", *a++, size?", ":""); | |
1030 else | |
1031 printf("0x%02x%s", *a++, size?", ":""); | |
1032 printf(" }"); | |
8467
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
1033 } |
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
1034 |
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
1035 static void print_string(const char* s) |
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
1036 { |
31077 | 1037 if (!s) printf("NULL"); |
1038 else printf("\"%s\"", s); | |
8467
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
1039 } |
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
1040 |
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
1041 int main(int argc, char* argv[]) |
607 | 1042 { |
31077 | 1043 codecs_t *cl; |
1044 FILE *f1; | |
1045 FILE *f2; | |
1046 int c,d,i; | |
1047 int pos; | |
1048 int section=-1; | |
1049 int nr_codecs; | |
1050 int win32=-1; | |
1051 int dshow=-1; | |
1052 int win32ex=-1; | |
607 | 1053 |
31077 | 1054 /* |
1055 * Take path to codecs.conf from command line, or fall back on | |
1056 * etc/codecs.conf | |
1057 */ | |
1058 if (!(nr_codecs = parse_codec_cfg((argc>1)?argv[1]:"etc/codecs.conf"))) | |
1059 exit(1); | |
31406
0fd1b3f1fe69
Auto-update CODEC_CFG_MIN value to release value in etc/codecs.conf.
reimar
parents:
31159
diff
changeset
|
1060 if (codecs_conf_release < CODEC_CFG_MIN) |
0fd1b3f1fe69
Auto-update CODEC_CFG_MIN value to release value in etc/codecs.conf.
reimar
parents:
31159
diff
changeset
|
1061 exit(1); |
8467
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
1062 |
31077 | 1063 if (argc > 1) { |
1064 int i, j; | |
1065 const char* nm[2]; | |
1066 codecs_t* cod[2]; | |
1067 int nr[2]; | |
8467
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
1068 |
31077 | 1069 nm[0] = "builtin_video_codecs"; |
1070 cod[0] = video_codecs; | |
1071 nr[0] = nr_vcodecs; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
1072 |
31077 | 1073 nm[1] = "builtin_audio_codecs"; |
1074 cod[1] = audio_codecs; | |
1075 nr[1] = nr_acodecs; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
1076 |
31077 | 1077 printf("/* GENERATED FROM %s, DO NOT EDIT! */\n\n",argv[1]); |
31407 | 1078 printf("#include <stddef.h>\n"); |
1079 printf("#include \"codec-cfg.h\"\n\n"); | |
31406
0fd1b3f1fe69
Auto-update CODEC_CFG_MIN value to release value in etc/codecs.conf.
reimar
parents:
31159
diff
changeset
|
1080 printf("#define CODEC_CFG_MIN %i\n\n", codecs_conf_release); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
1081 |
31077 | 1082 for (i=0; i<2; i++) { |
1083 printf("const codecs_t %s[] = {\n", nm[i]); | |
1084 for (j = 0; j < nr[i]; j++) { | |
1085 printf("{"); | |
8467
3ca9cc46df5c
Fallback to builtin (generated from etc/codecs.conf at compile time)
arpi
parents:
8211
diff
changeset
|
1086 |
31077 | 1087 print_int_array(cod[i][j].fourcc, CODECS_MAX_FOURCC); |
1088 printf(", /* fourcc */\n"); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
1089 |
31077 | 1090 print_int_array(cod[i][j].fourccmap, CODECS_MAX_FOURCC); |
1091 printf(", /* fourccmap */\n"); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
1092 |
31077 | 1093 print_int_array(cod[i][j].outfmt, CODECS_MAX_OUTFMT); |
1094 printf(", /* outfmt */\n"); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
1095 |
31077 | 1096 print_char_array(cod[i][j].outflags, CODECS_MAX_OUTFMT); |
1097 printf(", /* outflags */\n"); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
1098 |
31077 | 1099 print_int_array(cod[i][j].infmt, CODECS_MAX_INFMT); |
1100 printf(", /* infmt */\n"); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
1101 |
31077 | 1102 print_char_array(cod[i][j].inflags, CODECS_MAX_INFMT); |
1103 printf(", /* inflags */\n"); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
1104 |
31077 | 1105 print_string(cod[i][j].name); printf(", /* name */\n"); |
1106 print_string(cod[i][j].info); printf(", /* info */\n"); | |
1107 print_string(cod[i][j].comment); printf(", /* comment */\n"); | |
1108 print_string(cod[i][j].dll); printf(", /* dll */\n"); | |
1109 print_string(cod[i][j].drv); printf(", /* drv */\n"); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
1110 |
31077 | 1111 printf("{ 0x%08lx, %hu, %hu,", |
1112 cod[i][j].guid.f1, | |
1113 cod[i][j].guid.f2, | |
1114 cod[i][j].guid.f3); | |
1115 print_char_array(cod[i][j].guid.f4, sizeof(cod[i][j].guid.f4)); | |
1116 printf(" }, /* GUID */\n"); | |
1117 printf("%hd /* flags */, %hd /* status */, %hd /* cpuflags */ }\n", | |
1118 cod[i][j].flags, | |
1119 cod[i][j].status, | |
1120 cod[i][j].cpuflags); | |
1121 if (j < nr[i]) printf(",\n"); | |
607 | 1122 } |
31077 | 1123 printf("};\n\n"); |
1124 } | |
1125 exit(0); | |
1126 } | |
1127 | |
1128 f1=fopen("DOCS/tech/codecs-in.html","rb"); if(!f1) exit(1); | |
1129 f2=fopen("DOCS/codecs-status.html","wb"); if(!f2) exit(1); | |
1130 | |
1131 while((c=fgetc(f1))>=0){ | |
1132 if(c!='%'){ | |
1133 fputc(c,f2); | |
1134 continue; | |
1135 } | |
1136 d=fgetc(f1); | |
1137 if(d>='0' && d<='9'){ | |
1138 // begin section | |
1139 section=d-'0'; | |
1140 //printf("BEGIN %d\n",section); | |
1141 if(section>=5){ | |
1142 // audio | |
1143 cl = audio_codecs; | |
1144 nr_codecs = nr_acodecs; | |
1145 dshow=7;win32=4; | |
1146 } else { | |
1147 // video | |
1148 cl = video_codecs; | |
1149 nr_codecs = nr_vcodecs; | |
1150 dshow=4;win32=2;win32ex=6; | |
1151 } | |
1152 pos=ftell(f1); | |
1153 for(i=0;i<nr_codecs;i++){ | |
1154 fseek(f1,pos,SEEK_SET); | |
1155 switch(section){ | |
1156 case 0: | |
1157 case 5: | |
1158 if(cl[i].status==CODECS_STATUS_WORKING) | |
1159 // if(!(!strcmp(cl[i].drv,"vfw") || !strcmp(cl[i].drv,"dshow") || !strcmp(cl[i].drv,"vfwex") || !strcmp(cl[i].drv,"acm"))) | |
31409 | 1160 parsehtml(f1,f2,&cl[i]); |
31077 | 1161 break; |
8211 | 1162 #if 0 |
31077 | 1163 case 1: |
1164 case 6: | |
1165 if(cl[i].status==CODECS_STATUS_WORKING) | |
1166 if((!strcmp(cl[i].drv,"vfw") || !strcmp(cl[i].drv,"dshow") || !strcmp(cl[i].drv,"vfwex") || !strcmp(cl[i].drv,"acm"))) | |
31409 | 1167 parsehtml(f1,f2,&cl[i]); |
31077 | 1168 break; |
1169 #endif | |
1170 case 2: | |
1171 case 7: | |
1172 if(cl[i].status==CODECS_STATUS_PROBLEMS) | |
31409 | 1173 parsehtml(f1,f2,&cl[i]); |
31077 | 1174 break; |
1175 case 3: | |
1176 case 8: | |
1177 if(cl[i].status==CODECS_STATUS_NOT_WORKING) | |
31409 | 1178 parsehtml(f1,f2,&cl[i]); |
31077 | 1179 break; |
1180 case 4: | |
1181 case 9: | |
1182 if(cl[i].status==CODECS_STATUS_UNTESTED) | |
31409 | 1183 parsehtml(f1,f2,&cl[i]); |
31077 | 1184 break; |
1185 default: | |
1186 printf("Warning! unimplemented section: %d\n",section); | |
607 | 1187 } |
31077 | 1188 } |
1189 fseek(f1,pos,SEEK_SET); | |
1190 skiphtml(f1); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
1191 |
31077 | 1192 continue; |
607 | 1193 } |
31077 | 1194 fputc(c,f2); |
1195 fputc(d,f2); | |
1196 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
1197 |
31077 | 1198 fclose(f2); |
1199 fclose(f1); | |
1200 return 0; | |
607 | 1201 } |
1202 | |
1203 #endif | |
1204 | |
297 | 1205 #ifdef TESTING |
1206 int main(void) | |
1207 { | |
31077 | 1208 codecs_t *c; |
1209 int i,j, nr_codecs, state; | |
297 | 1210 |
31077 | 1211 if (!(parse_codec_cfg("etc/codecs.conf"))) |
1212 return 0; | |
1213 if (!video_codecs) | |
1214 printf("no videoconfig.\n"); | |
1215 if (!audio_codecs) | |
1216 printf("no audioconfig.\n"); | |
328 | 1217 |
31077 | 1218 printf("videocodecs:\n"); |
1219 c = video_codecs; | |
1220 nr_codecs = nr_vcodecs; | |
1221 state = 0; | |
328 | 1222 next: |
31077 | 1223 if (c) { |
1224 printf("number of %scodecs: %d\n", state==0?"video":"audio", | |
1225 nr_codecs); | |
1226 for(i=0;i<nr_codecs;i++, c++){ | |
1227 printf("\n============== %scodec %02d ===============\n", | |
1228 state==0?"video":"audio",i); | |
1229 printf("name='%s'\n",c->name); | |
1230 printf("info='%s'\n",c->info); | |
1231 printf("comment='%s'\n",c->comment); | |
1232 printf("dll='%s'\n",c->dll); | |
1233 /* printf("flags=%X driver=%d status=%d cpuflags=%d\n", | |
1234 c->flags, c->driver, c->status, c->cpuflags); */ | |
1235 printf("flags=%X status=%d cpuflags=%d\n", | |
1236 c->flags, c->status, c->cpuflags); | |
300 | 1237 |
31077 | 1238 for(j=0;j<CODECS_MAX_FOURCC;j++){ |
1239 if(c->fourcc[j]!=0xFFFFFFFF){ | |
1240 printf("fourcc %02d: %08X (%.4s) ===> %08X (%.4s)\n",j,c->fourcc[j],(char *) &c->fourcc[j],c->fourccmap[j],(char *) &c->fourccmap[j]); | |
1241 } | |
1242 } | |
328 | 1243 |
31077 | 1244 for(j=0;j<CODECS_MAX_OUTFMT;j++){ |
1245 if(c->outfmt[j]!=0xFFFFFFFF){ | |
1246 printf("outfmt %02d: %08X (%.4s) flags: %d\n",j,c->outfmt[j],(char *) &c->outfmt[j],c->outflags[j]); | |
1247 } | |
1248 } | |
300 | 1249 |
31077 | 1250 for(j=0;j<CODECS_MAX_INFMT;j++){ |
1251 if(c->infmt[j]!=0xFFFFFFFF){ | |
1252 printf("infmt %02d: %08X (%.4s) flags: %d\n",j,c->infmt[j],(char *) &c->infmt[j],c->inflags[j]); | |
1253 } | |
1254 } | |
4676 | 1255 |
31077 | 1256 printf("GUID: %08lX %04X %04X",c->guid.f1,c->guid.f2,c->guid.f3); |
1257 for(j=0;j<8;j++) printf(" %02X",c->guid.f4[j]); | |
1258 printf("\n"); | |
300 | 1259 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29115
diff
changeset
|
1260 |
31077 | 1261 } |
1262 } | |
1263 if (!state) { | |
1264 printf("audiocodecs:\n"); | |
1265 c = audio_codecs; | |
1266 nr_codecs = nr_acodecs; | |
1267 state = 1; | |
1268 goto next; | |
1269 } | |
1270 return 0; | |
297 | 1271 } |
1272 | |
1273 #endif |