Mercurial > mplayer.hg
annotate codec-cfg.c @ 5436:6f6082d9c8ba
-alang/-slang support in mencoder too
author | arpi |
---|---|
date | Sun, 31 Mar 2002 22:01:54 +0000 |
parents | 674793ca4225 |
children | 1212d2f92a42 |
rev | line source |
---|---|
319 | 1 /* |
2 * codec.conf parser | |
3 * by Szabolcs Berecz <szabi@inf.elte.hu> | |
4 * (C) 2001 | |
4676 | 5 * |
6 * to compile tester app: gcc -Iloader/ -DTESTING -o codec-cfg codec-cfg.c | |
7 * to compile CODECS2HTML: gcc -Iloader/ -DCODECS2HTML -o codecs2html codecs-cfg.c | |
8 * | |
9 * TODO: implement informat in CODECS2HTML too | |
319 | 10 */ |
303 | 11 |
319 | 12 #define DEBUG |
303 | 13 |
3798
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
14 //disable asserts |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
15 #define NDEBUG |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
16 |
297 | 17 #include <stdio.h> |
18 #include <stdlib.h> | |
19 #include <fcntl.h> | |
20 #include <unistd.h> | |
21 #include <errno.h> | |
22 #include <ctype.h> | |
23 #include <assert.h> | |
24 #include <string.h> | |
25 | |
5284
0a58c2ef1da1
added missing #include config.h, removed LIBVO2 ifdef.
arpi
parents:
5263
diff
changeset
|
26 #include "config.h" |
0a58c2ef1da1
added missing #include config.h, removed LIBVO2 ifdef.
arpi
parents:
5263
diff
changeset
|
27 |
2052 | 28 // for mmioFOURCC: |
1305
0a8237e28ce0
Use FOURCC macro to encode fcc values. Avoids accessing 32-bit data from
jkeil
parents:
1297
diff
changeset
|
29 #include "wine/avifmt.h" |
0a8237e28ce0
Use FOURCC macro to encode fcc values. Avoids accessing 32-bit data from
jkeil
parents:
1297
diff
changeset
|
30 |
408 | 31 #include "libvo/img_format.h" |
297 | 32 #include "codec-cfg.h" |
33 | |
361 | 34 #define PRINT_LINENUM printf(" at line %d\n", line_num) |
328 | 35 |
319 | 36 #define MAX_NR_TOKEN 16 |
297 | 37 |
38 #define MAX_LINE_LEN 1000 | |
39 | |
40 #define RET_EOF -1 | |
41 #define RET_EOL -2 | |
42 | |
328 | 43 #define TYPE_VIDEO 0 |
44 #define TYPE_AUDIO 1 | |
297 | 45 |
303 | 46 static int add_to_fourcc(char *s, char *alias, unsigned int *fourcc, |
297 | 47 unsigned int *map) |
48 { | |
319 | 49 int i, j, freeslots; |
50 unsigned int tmp; | |
51 | |
52 /* find first unused slot */ | |
53 for (i = 0; i < CODECS_MAX_FOURCC && fourcc[i] != 0xffffffff; i++) | |
54 /* NOTHING */; | |
55 freeslots = CODECS_MAX_FOURCC - i; | |
56 if (!freeslots) | |
328 | 57 goto err_out_too_many; |
319 | 58 |
59 do { | |
1305
0a8237e28ce0
Use FOURCC macro to encode fcc values. Avoids accessing 32-bit data from
jkeil
parents:
1297
diff
changeset
|
60 tmp = mmioFOURCC(s[0], s[1], s[2], s[3]); |
319 | 61 for (j = 0; j < i; j++) |
62 if (tmp == fourcc[j]) | |
328 | 63 goto err_out_duplicated; |
319 | 64 fourcc[i] = tmp; |
2681 | 65 map[i] = alias ? mmioFOURCC(alias[0], alias[1], alias[2], alias[3]) : tmp; |
319 | 66 s += 4; |
67 i++; | |
68 } while ((*(s++) == ',') && --freeslots); | |
69 | |
70 if (!freeslots) | |
328 | 71 goto err_out_too_many; |
319 | 72 if (*(--s) != '\0') |
361 | 73 goto err_out_parse_error; |
319 | 74 return 1; |
328 | 75 err_out_duplicated: |
361 | 76 printf("duplicated fourcc/format"); |
319 | 77 return 0; |
328 | 78 err_out_too_many: |
361 | 79 printf("too many fourcc/format..."); |
80 return 0; | |
81 err_out_parse_error: | |
82 printf("parse error"); | |
319 | 83 return 0; |
84 } | |
85 | |
86 static int add_to_format(char *s, unsigned int *fourcc, unsigned int *fourccmap) | |
87 { | |
88 int i, j; | |
361 | 89 char *endptr; |
297 | 90 |
91 /* find first unused slot */ | |
92 for (i = 0; i < CODECS_MAX_FOURCC && fourcc[i] != 0xffffffff; i++) | |
93 /* NOTHING */; | |
94 if (i == CODECS_MAX_FOURCC) { | |
361 | 95 printf("too many fourcc/format..."); |
297 | 96 return 0; |
97 } | |
98 | |
361 | 99 fourcc[i]=fourccmap[i]=strtoul(s,&endptr,0); |
100 if (*endptr != '\0') { | |
101 printf("parse error"); | |
102 return 0; | |
103 } | |
319 | 104 for (j = 0; j < i; j++) |
105 if (fourcc[j] == fourcc[i]) { | |
361 | 106 printf("duplicated fourcc/format"); |
319 | 107 return 0; |
108 } | |
300 | 109 |
297 | 110 return 1; |
111 } | |
112 | |
408 | 113 static struct { |
114 const char *name; | |
115 const unsigned int num; | |
116 } fmt_table[] = { | |
415 | 117 {"YV12", IMGFMT_YV12}, |
118 {"I420", IMGFMT_I420}, | |
119 {"IYUV", IMGFMT_IYUV}, | |
408 | 120 |
415 | 121 {"YUY2", IMGFMT_YUY2}, |
122 {"UYVY", IMGFMT_UYVY}, | |
123 {"YVYU", IMGFMT_YVYU}, | |
408 | 124 |
415 | 125 {"RGB8", IMGFMT_RGB|8}, |
126 {"RGB15", IMGFMT_RGB|15}, | |
127 {"RGB16", IMGFMT_RGB|16}, | |
128 {"RGB24", IMGFMT_RGB|24}, | |
129 {"RGB32", IMGFMT_RGB|32}, | |
130 {"BGR8", IMGFMT_BGR|8}, | |
131 {"BGR15", IMGFMT_BGR|15}, | |
132 {"BGR16", IMGFMT_BGR|16}, | |
133 {"BGR24", IMGFMT_BGR|24}, | |
134 {"BGR32", IMGFMT_BGR|32}, | |
1871 | 135 |
136 {"MPES", IMGFMT_MPEGPES}, | |
415 | 137 {NULL, 0} |
297 | 138 }; |
408 | 139 |
607 | 140 |
4675 | 141 static int add_to_inout(char *sfmt, char *sflags, unsigned int *outfmt, |
607 | 142 unsigned char *outflags) |
143 { | |
144 | |
299 | 145 static char *flagstr[] = { |
146 "flip", | |
147 "noflip", | |
148 "yuvhack", | |
5249 | 149 "query", |
299 | 150 NULL |
151 }; | |
152 | |
319 | 153 int i, j, freeslots; |
297 | 154 unsigned char flags; |
155 | |
156 for (i = 0; i < CODECS_MAX_OUTFMT && outfmt[i] != 0xffffffff; i++) | |
157 /* NOTHING */; | |
319 | 158 freeslots = CODECS_MAX_OUTFMT - i; |
159 if (!freeslots) | |
328 | 160 goto err_out_too_many; |
297 | 161 |
319 | 162 flags = 0; |
361 | 163 if(sflags) { |
164 do { | |
165 for (j = 0; flagstr[j] != NULL; j++) | |
166 if (!strncmp(sflags, flagstr[j], | |
167 strlen(flagstr[j]))) | |
168 break; | |
169 if (flagstr[j] == NULL) | |
170 goto err_out_parse_error; | |
171 flags|=(1<<j); | |
172 sflags+=strlen(flagstr[j]); | |
173 } while (*(sflags++) == ','); | |
174 | |
175 if (*(--sflags) != '\0') | |
176 goto err_out_parse_error; | |
177 } | |
297 | 178 |
179 do { | |
408 | 180 for (j = 0; fmt_table[j].name != NULL; j++) |
181 if (!strncmp(sfmt, fmt_table[j].name, strlen(fmt_table[j].name))) | |
297 | 182 break; |
408 | 183 if (fmt_table[j].name == NULL) |
361 | 184 goto err_out_parse_error; |
408 | 185 outfmt[i] = fmt_table[j].num; |
297 | 186 outflags[i] = flags; |
299 | 187 ++i; |
408 | 188 sfmt+=strlen(fmt_table[j].name); |
319 | 189 } while ((*(sfmt++) == ',') && --freeslots); |
190 | |
191 if (!freeslots) | |
328 | 192 goto err_out_too_many; |
319 | 193 |
361 | 194 if (*(--sfmt) != '\0') |
195 goto err_out_parse_error; | |
299 | 196 |
297 | 197 return 1; |
328 | 198 err_out_too_many: |
361 | 199 printf("too many out..."); |
200 return 0; | |
201 err_out_parse_error: | |
202 printf("parse error"); | |
319 | 203 return 0; |
297 | 204 } |
205 | |
303 | 206 static short get_driver(char *s,int audioflag) |
297 | 207 { |
301 | 208 static char *audiodrv[] = { |
1293 | 209 "null", |
301 | 210 "mp3lib", |
211 "pcm", | |
212 "libac3", | |
213 "acm", | |
214 "alaw", | |
215 "msgsm", | |
216 "dshow", | |
401 | 217 "dvdpcm", |
1528
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1488
diff
changeset
|
218 "hwac3", |
1828 | 219 "libvorbis", |
1929 | 220 "ffmpeg", |
2415 | 221 "libmad", |
3787 | 222 "msadpcm", |
3400 | 223 "liba52", |
224 "g72x", | |
3787 | 225 "imaadpcm", |
4854
4a6dde59834c
fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents:
4676
diff
changeset
|
226 "dk4adpcm", |
4a6dde59834c
fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents:
4676
diff
changeset
|
227 "dk3adpcm", |
4450
3da8c5706371
added skeleton decoders for RoQ audio and video format decoders
melanson
parents:
4301
diff
changeset
|
228 "roqaudio", |
5190
59df6b778d78
Beta AAC decoding support, seeking totally broken yet, add philipps mpeg4 video in qt to ffmpeg4 although it's still buggy in decoding
atmos4
parents:
5029
diff
changeset
|
229 "faad", |
301 | 230 NULL |
231 }; | |
232 static char *videodrv[] = { | |
1293 | 233 "null", |
301 | 234 "libmpeg2", |
235 "vfw", | |
236 "odivx", | |
237 "dshow", | |
1248 | 238 "ffmpeg", |
1297 | 239 "vfwex", |
1349 | 240 "divx4", |
1488 | 241 "raw", |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
5190
diff
changeset
|
242 "msrle", |
2379 | 243 "xanim", |
2827
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2681
diff
changeset
|
244 "msvidc", |
3172 | 245 "fli", |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3408
diff
changeset
|
246 "cinepak", |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3667
diff
changeset
|
247 "qtrle", |
3804
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3798
diff
changeset
|
248 "nuv", |
3969 | 249 "cyuv", |
4227 | 250 "qtsmc", |
4301
8f43b10f387f
added skeleton for Duck Truemotion v1 decoder (doesn't do anything yet)
melanson
parents:
4227
diff
changeset
|
251 "ducktm1", |
4450
3da8c5706371
added skeleton decoders for RoQ audio and video format decoders
melanson
parents:
4301
diff
changeset
|
252 "roqvideo", |
4615
b1fe5f58cd82
Added native codec support for QT RPZA data, courtesy of Roberto Togni
melanson
parents:
4450
diff
changeset
|
253 "qtrpza", |
4656 | 254 "mpng", |
5029 | 255 "ijpg", |
5235
3e04fd1074d3
added HuffYUV support, courtesy of Roberto Togni <rtogni@bresciaonline.it>
melanson
parents:
5193
diff
changeset
|
256 "huffyuv", |
5263 | 257 "zlib", |
301 | 258 NULL |
259 }; | |
260 char **drv=audioflag?audiodrv:videodrv; | |
261 int i; | |
262 | |
1293 | 263 for(i=0;drv[i];i++) if(!strcmp(s,drv[i])) return i; |
301 | 264 |
1293 | 265 return -1; |
297 | 266 } |
267 | |
328 | 268 static int validate_codec(codecs_t *c, int type) |
319 | 269 { |
328 | 270 int i; |
3408 | 271 char *tmp_name = strdup(c->name); |
328 | 272 |
3408 | 273 for (i = 0; i < strlen(tmp_name) && isalnum(tmp_name[i]); i++) |
328 | 274 /* NOTHING */; |
3408 | 275 |
276 if (i < strlen(tmp_name)) { | |
277 printf("\ncodec(%s) name is not valid!\n", c->name); | |
328 | 278 return 0; |
279 } | |
3408 | 280 |
328 | 281 if (!c->info) |
3408 | 282 c->info = strdup(c->name); |
283 | |
284 #if 0 | |
328 | 285 if (c->fourcc[0] == 0xffffffff) { |
286 printf("\ncodec(%s) does not have fourcc/format!\n", c->name); | |
287 return 0; | |
288 } | |
3408 | 289 |
290 /* XXX fix this: shitty with 'null' codec */ | |
328 | 291 if (!c->driver) { |
292 printf("\ncodec(%s) does not have a driver!\n", c->name); | |
293 return 0; | |
294 } | |
3408 | 295 #endif |
296 | |
297 #if 0 | |
328 | 298 #warning codec->driver == 4;... <- ezt nem kellene belehegeszteni... |
299 #warning HOL VANNAK DEFINIALVA???????????? | |
300 if (!c->dll && (c->driver == 4 || | |
301 (c->driver == 2 && type == TYPE_VIDEO))) { | |
302 printf("\ncodec(%s) needs a 'dll'!\n", c->name); | |
303 return 0; | |
304 } | |
305 #warning guid.f1 lehet 0? honnan lehet tudni, hogy nem adtak meg? | |
306 // if (!(codec->flags & CODECS_FLAG_AUDIO) && codec->driver == 4) | |
307 | |
308 if (type == TYPE_VIDEO) | |
309 if (c->outfmt[0] == 0xffffffff) { | |
310 printf("\ncodec(%s) needs an 'outfmt'!\n", c->name); | |
311 return 0; | |
312 } | |
329 | 313 #endif |
319 | 314 return 1; |
315 } | |
316 | |
317 static int add_comment(char *s, char **d) | |
318 { | |
319 int pos; | |
320 | |
321 if (!*d) | |
322 pos = 0; | |
323 else { | |
324 pos = strlen(*d); | |
325 (*d)[pos++] = '\n'; | |
326 } | |
327 if (!(*d = (char *) realloc(*d, pos + strlen(s) + 1))) { | |
361 | 328 printf("can't allocate mem for comment. "); |
319 | 329 return 0; |
330 } | |
331 strcpy(*d + pos, s); | |
332 return 1; | |
333 } | |
297 | 334 |
361 | 335 static short get_cpuflags(char *s) |
336 { | |
337 static char *flagstr[] = { | |
338 "mmx", | |
339 "sse", | |
340 "3dnow", | |
341 NULL | |
342 }; | |
343 int i; | |
344 short flags = 0; | |
345 | |
346 do { | |
347 for (i = 0; flagstr[i]; i++) | |
348 if (!strncmp(s, flagstr[i], strlen(flagstr[i]))) | |
349 break; | |
350 if (!flagstr[i]) | |
351 goto err_out_parse_error; | |
352 flags |= 1<<i; | |
353 s += strlen(flagstr[i]); | |
354 } while (*(s++) == ','); | |
355 | |
356 if (*(--s) != '\0') | |
357 goto err_out_parse_error; | |
358 | |
359 return flags; | |
360 err_out_parse_error: | |
361 return 0; | |
362 } | |
363 | |
328 | 364 static FILE *fp; |
365 static int line_num = 0; | |
366 static char *line; | |
367 static char *token[MAX_NR_TOKEN]; | |
368 | |
369 static int get_token(int min, int max) | |
297 | 370 { |
328 | 371 static int read_nextline = 1; |
372 static int line_pos; | |
373 int i; | |
374 char c; | |
375 | |
376 if (max >= MAX_NR_TOKEN) { | |
361 | 377 printf("get_token(): max >= MAX_NR_TOKEN!"); |
328 | 378 goto out_eof; |
379 } | |
380 | |
381 memset(token, 0x00, sizeof(*token) * max); | |
382 | |
383 if (read_nextline) { | |
384 if (!fgets(line, MAX_LINE_LEN, fp)) | |
385 goto out_eof; | |
386 line_pos = 0; | |
387 ++line_num; | |
388 read_nextline = 0; | |
389 } | |
390 for (i = 0; i < max; i++) { | |
391 while (isspace(line[line_pos])) | |
392 ++line_pos; | |
393 if (line[line_pos] == '\0' || line[line_pos] == '#' || | |
394 line[line_pos] == ';') { | |
395 read_nextline = 1; | |
396 if (i >= min) | |
397 goto out_ok; | |
398 goto out_eol; | |
399 } | |
400 token[i] = line + line_pos; | |
401 c = line[line_pos]; | |
402 if (c == '"' || c == '\'') { | |
403 token[i]++; | |
404 while (line[++line_pos] != c && line[line_pos]) | |
405 /* NOTHING */; | |
406 } else { | |
407 for (/* NOTHING */; !isspace(line[line_pos]) && | |
408 line[line_pos]; line_pos++) | |
409 /* NOTHING */; | |
410 } | |
411 if (!line[line_pos]) { | |
412 read_nextline = 1; | |
413 if (i >= min - 1) | |
414 goto out_ok; | |
415 goto out_eol; | |
416 } | |
417 line[line_pos] = '\0'; | |
418 line_pos++; | |
419 } | |
420 out_ok: | |
421 return i; | |
422 out_eof: | |
3798
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
423 read_nextline = 1; |
328 | 424 return RET_EOF; |
425 out_eol: | |
426 return RET_EOL; | |
427 } | |
428 | |
429 static codecs_t *video_codecs=NULL; | |
430 static codecs_t *audio_codecs=NULL; | |
431 static int nr_vcodecs = 0; | |
432 static int nr_acodecs = 0; | |
433 | |
3798
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
434 int parse_codec_cfg(char *cfgfile) |
328 | 435 { |
436 codecs_t *codec = NULL; // current codec | |
437 codecs_t **codecsp = NULL;// points to audio_codecs or to video_codecs | |
335 | 438 char *endptr; // strtoul()... |
328 | 439 int *nr_codecsp; |
440 int codec_type; /* TYPE_VIDEO/TYPE_AUDIO */ | |
297 | 441 int tmp, i; |
3798
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
442 |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
443 // in case we call it secont time |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
444 if(video_codecs!=NULL)free(video_codecs); |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
445 else video_codecs=NULL; |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
446 |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
447 if(audio_codecs!=NULL)free(audio_codecs); |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
448 else audio_codecs=NULL; |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
449 |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
450 nr_vcodecs = 0; |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
451 nr_acodecs = 0; |
297 | 452 |
3798
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
453 if(cfgfile==NULL)return 0; |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
454 |
361 | 455 printf("Reading %s: ", cfgfile); |
297 | 456 |
301 | 457 if ((fp = fopen(cfgfile, "r")) == NULL) { |
328 | 458 printf("can't open '%s': %s\n", cfgfile, strerror(errno)); |
3798
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
459 return 0; |
297 | 460 } |
461 | |
301 | 462 if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) { |
361 | 463 printf("can't get memory for 'line': %s\n", strerror(errno)); |
3798
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
464 return 0; |
297 | 465 } |
466 | |
328 | 467 /* |
468 * check if the cfgfile starts with 'audiocodec' or | |
469 * with 'videocodec' | |
470 */ | |
471 while ((tmp = get_token(1, 1)) == RET_EOL) | |
472 /* NOTHING */; | |
361 | 473 if (tmp == RET_EOF) |
474 goto out; | |
475 if (!strcmp(token[0], "audiocodec") || !strcmp(token[0], "videocodec")) | |
328 | 476 goto loop_enter; |
361 | 477 goto err_out_parse_error; |
328 | 478 |
319 | 479 while ((tmp = get_token(1, 1)) != RET_EOF) { |
297 | 480 if (tmp == RET_EOL) |
481 continue; | |
328 | 482 if (!strcmp(token[0], "audiocodec") || |
483 !strcmp(token[0], "videocodec")) { | |
484 if (!validate_codec(codec, codec_type)) | |
485 goto err_out_not_valid; | |
486 loop_enter: | |
487 if (*token[0] == 'v') { | |
488 codec_type = TYPE_VIDEO; | |
489 nr_codecsp = &nr_vcodecs; | |
490 codecsp = &video_codecs; | |
491 } else if (*token[0] == 'a') { | |
492 codec_type = TYPE_AUDIO; | |
493 nr_codecsp = &nr_acodecs; | |
494 codecsp = &audio_codecs; | |
361 | 495 #ifdef DEBUG |
328 | 496 } else { |
361 | 497 printf("picsba\n"); |
328 | 498 goto err_out; |
361 | 499 #endif |
328 | 500 } |
501 if (!(*codecsp = (codecs_t *) realloc(*codecsp, | |
332 | 502 sizeof(codecs_t) * (*nr_codecsp + 2)))) { |
361 | 503 printf("can't realloc '*codecsp': %s\n", strerror(errno)); |
300 | 504 goto err_out; |
505 } | |
328 | 506 codec=*codecsp + *nr_codecsp; |
507 ++*nr_codecsp; | |
300 | 508 memset(codec,0,sizeof(codecs_t)); |
509 memset(codec->fourcc, 0xff, sizeof(codec->fourcc)); | |
510 memset(codec->outfmt, 0xff, sizeof(codec->outfmt)); | |
4675 | 511 memset(codec->infmt, 0xff, sizeof(codec->infmt)); |
300 | 512 |
319 | 513 if (get_token(1, 1) < 0) |
328 | 514 goto err_out_parse_error; |
515 for (i = 0; i < *nr_codecsp - 1; i++) { | |
3798
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
516 if(( (*codecsp)[i].name!=NULL) && |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
517 (!strcmp(token[0], (*codecsp)[i].name)) ) { |
361 | 518 printf("codec name '%s' isn't unique", token[0]); |
519 goto err_out_print_linenum; | |
319 | 520 } |
521 } | |
328 | 522 if (!(codec->name = strdup(token[0]))) { |
361 | 523 printf("can't strdup -> 'name': %s\n", strerror(errno)); |
328 | 524 goto err_out; |
525 } | |
319 | 526 } else if (!strcmp(token[0], "info")) { |
328 | 527 if (codec->info || get_token(1, 1) < 0) |
528 goto err_out_parse_error; | |
529 if (!(codec->info = strdup(token[0]))) { | |
361 | 530 printf("can't strdup -> 'info': %s\n", strerror(errno)); |
328 | 531 goto err_out; |
532 } | |
319 | 533 } else if (!strcmp(token[0], "comment")) { |
534 if (get_token(1, 1) < 0) | |
328 | 535 goto err_out_parse_error; |
361 | 536 add_comment(token[0], &codec->comment); |
319 | 537 } else if (!strcmp(token[0], "fourcc")) { |
538 if (get_token(1, 2) < 0) | |
328 | 539 goto err_out_parse_error; |
319 | 540 if (!add_to_fourcc(token[0], token[1], |
300 | 541 codec->fourcc, |
542 codec->fourccmap)) | |
361 | 543 goto err_out_print_linenum; |
319 | 544 } else if (!strcmp(token[0], "format")) { |
545 if (get_token(1, 1) < 0) | |
328 | 546 goto err_out_parse_error; |
319 | 547 if (!add_to_format(token[0], codec->fourcc,codec->fourccmap)) |
361 | 548 goto err_out_print_linenum; |
319 | 549 } else if (!strcmp(token[0], "driver")) { |
550 if (get_token(1, 1) < 0) | |
328 | 551 goto err_out_parse_error; |
1293 | 552 if ((codec->driver = get_driver(token[0],codec_type))<0) |
361 | 553 goto err_out_parse_error; |
319 | 554 } else if (!strcmp(token[0], "dll")) { |
555 if (get_token(1, 1) < 0) | |
328 | 556 goto err_out_parse_error; |
557 if (!(codec->dll = strdup(token[0]))) { | |
361 | 558 printf("can't strdup -> 'dll': %s\n", strerror(errno)); |
328 | 559 goto err_out; |
560 } | |
319 | 561 } else if (!strcmp(token[0], "guid")) { |
328 | 562 if (get_token(11, 11) < 0) |
563 goto err_out_parse_error; | |
335 | 564 codec->guid.f1=strtoul(token[0],&endptr,0); |
361 | 565 if ((*endptr != ',' || *(endptr + 1) != '\0') && |
566 *endptr != '\0') | |
335 | 567 goto err_out_parse_error; |
568 codec->guid.f2=strtoul(token[1],&endptr,0); | |
361 | 569 if ((*endptr != ',' || *(endptr + 1) != '\0') && |
570 *endptr != '\0') | |
335 | 571 goto err_out_parse_error; |
572 codec->guid.f3=strtoul(token[2],&endptr,0); | |
361 | 573 if ((*endptr != ',' || *(endptr + 1) != '\0') && |
574 *endptr != '\0') | |
335 | 575 goto err_out_parse_error; |
576 for (i = 0; i < 8; i++) { | |
577 codec->guid.f4[i]=strtoul(token[i + 3],&endptr,0); | |
361 | 578 if ((*endptr != ',' || *(endptr + 1) != '\0') && |
579 *endptr != '\0') | |
328 | 580 goto err_out_parse_error; |
297 | 581 } |
319 | 582 } else if (!strcmp(token[0], "out")) { |
583 if (get_token(1, 2) < 0) | |
328 | 584 goto err_out_parse_error; |
4675 | 585 if (!add_to_inout(token[0], token[1], codec->outfmt, |
300 | 586 codec->outflags)) |
361 | 587 goto err_out_print_linenum; |
4675 | 588 } else if (!strcmp(token[0], "in")) { |
589 if (get_token(1, 2) < 0) | |
590 goto err_out_parse_error; | |
591 if (!add_to_inout(token[0], token[1], codec->infmt, | |
592 codec->inflags)) | |
593 goto err_out_print_linenum; | |
319 | 594 } else if (!strcmp(token[0], "flags")) { |
595 if (get_token(1, 1) < 0) | |
328 | 596 goto err_out_parse_error; |
321 | 597 if (!strcmp(token[0], "seekable")) |
598 codec->flags |= CODECS_FLAG_SEEKABLE; | |
599 else | |
328 | 600 goto err_out_parse_error; |
319 | 601 } else if (!strcmp(token[0], "status")) { |
602 if (get_token(1, 1) < 0) | |
328 | 603 goto err_out_parse_error; |
332 | 604 if (!strcasecmp(token[0], "working")) |
316 | 605 codec->status = CODECS_STATUS_WORKING; |
332 | 606 else if (!strcasecmp(token[0], "crashing")) |
316 | 607 codec->status = CODECS_STATUS_NOT_WORKING; |
332 | 608 else if (!strcasecmp(token[0], "untested")) |
316 | 609 codec->status = CODECS_STATUS_UNTESTED; |
332 | 610 else if (!strcasecmp(token[0], "buggy")) |
316 | 611 codec->status = CODECS_STATUS_PROBLEMS; |
612 else | |
328 | 613 goto err_out_parse_error; |
361 | 614 } else if (!strcmp(token[0], "cpuflags")) { |
615 if (get_token(1, 1) < 0) | |
616 goto err_out_parse_error; | |
617 if (!(codec->cpuflags = get_cpuflags(token[0]))) | |
618 goto err_out_parse_error; | |
3667
ec943f8ec439
add support for priotity <int> in codecs.conf, higher numbers are better
atmos4
parents:
3643
diff
changeset
|
619 } else if (!strcasecmp(token[0], "priority")) { |
ec943f8ec439
add support for priotity <int> in codecs.conf, higher numbers are better
atmos4
parents:
3643
diff
changeset
|
620 if (get_token(1, 1) < 0) |
ec943f8ec439
add support for priotity <int> in codecs.conf, higher numbers are better
atmos4
parents:
3643
diff
changeset
|
621 goto err_out_parse_error; |
ec943f8ec439
add support for priotity <int> in codecs.conf, higher numbers are better
atmos4
parents:
3643
diff
changeset
|
622 //printf("\n\n!!!cfg-parse: priority %s (%d) found!!!\n\n", token[0], atoi(token[0])); // ::atmos |
ec943f8ec439
add support for priotity <int> in codecs.conf, higher numbers are better
atmos4
parents:
3643
diff
changeset
|
623 codec->priority = atoi(token[0]); |
297 | 624 } else |
328 | 625 goto err_out_parse_error; |
297 | 626 } |
328 | 627 if (!validate_codec(codec, codec_type)) |
628 goto err_out_not_valid; | |
361 | 629 printf("%d audio & %d video codecs\n", nr_acodecs, nr_vcodecs); |
895 | 630 if(video_codecs) video_codecs[nr_vcodecs].name = NULL; |
631 if(audio_codecs) audio_codecs[nr_acodecs].name = NULL; | |
297 | 632 out: |
633 free(line); | |
3798
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
634 line=NULL; |
297 | 635 fclose(fp); |
3798
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
636 return 1; |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
637 |
328 | 638 err_out_parse_error: |
361 | 639 printf("parse error"); |
640 err_out_print_linenum: | |
297 | 641 PRINT_LINENUM; |
642 err_out: | |
328 | 643 if (audio_codecs) |
644 free(audio_codecs); | |
645 if (video_codecs) | |
646 free(video_codecs); | |
3798
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
647 video_codecs=NULL; |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
648 audio_codecs=NULL; |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
649 |
328 | 650 free(line); |
3798
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
651 line=NULL; |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
652 fclose(fp); |
d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
iive
parents:
3787
diff
changeset
|
653 return 0; |
328 | 654 err_out_not_valid: |
3408 | 655 printf("codec is not defined correctly"); |
361 | 656 goto err_out_print_linenum; |
297 | 657 } |
658 | |
332 | 659 codecs_t *find_audio_codec(unsigned int fourcc, unsigned int *fourccmap, |
660 codecs_t *start) | |
328 | 661 { |
332 | 662 return find_codec(fourcc, fourccmap, start, 1); |
328 | 663 } |
664 | |
332 | 665 codecs_t *find_video_codec(unsigned int fourcc, unsigned int *fourccmap, |
666 codecs_t *start) | |
328 | 667 { |
332 | 668 return find_codec(fourcc, fourccmap, start, 0); |
328 | 669 } |
670 | |
332 | 671 codecs_t* find_codec(unsigned int fourcc,unsigned int *fourccmap, |
672 codecs_t *start, int audioflag) | |
328 | 673 { |
674 int i, j; | |
675 codecs_t *c; | |
676 | |
628 | 677 #if 0 |
332 | 678 if (start) { |
679 for (/* NOTHING */; start->name; start++) { | |
680 for (j = 0; j < CODECS_MAX_FOURCC; j++) { | |
681 if (start->fourcc[j] == fourcc) { | |
682 if (fourccmap) | |
683 *fourccmap = start->fourccmap[j]; | |
684 return start; | |
685 } | |
686 } | |
687 } | |
628 | 688 } else |
689 #endif | |
690 { | |
332 | 691 if (audioflag) { |
692 i = nr_acodecs; | |
693 c = audio_codecs; | |
694 } else { | |
695 i = nr_vcodecs; | |
696 c = video_codecs; | |
697 } | |
895 | 698 if(!i) return NULL; |
332 | 699 for (/* NOTHING */; i--; c++) { |
628 | 700 if(start && c<=start) continue; |
332 | 701 for (j = 0; j < CODECS_MAX_FOURCC; j++) { |
1391 | 702 if (c->fourcc[j]==fourcc || c->driver==0) { |
332 | 703 if (fourccmap) |
704 *fourccmap = c->fourccmap[j]; | |
705 return c; | |
706 } | |
328 | 707 } |
708 } | |
709 } | |
710 return NULL; | |
303 | 711 } |
712 | |
5325
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
713 void codecs_reset_selection(int audioflag){ |
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
714 int i; |
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
715 codecs_t *c; |
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
716 if (audioflag) { |
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
717 i = nr_acodecs; |
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
718 c = audio_codecs; |
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
719 } else { |
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
720 i = nr_vcodecs; |
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
721 c = video_codecs; |
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
722 } |
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
723 if(i) |
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
724 for (/* NOTHING */; i--; c++) |
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
725 c->flags&=(~CODECS_FLAG_SELECTED); |
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
726 } |
9c326f199060
tagging selected codec to avoid trying the same codec several times
arpi
parents:
5284
diff
changeset
|
727 |
1983 | 728 void list_codecs(int audioflag){ |
2050 | 729 int i; |
1983 | 730 codecs_t *c; |
731 | |
732 if (audioflag) { | |
733 i = nr_acodecs; | |
734 c = audio_codecs; | |
1984 | 735 printf("ac: afm: status: info: [lib/dll]\n"); |
1983 | 736 } else { |
737 i = nr_vcodecs; | |
738 c = video_codecs; | |
1984 | 739 printf("vc: vfm: status: info: [lib/dll]\n"); |
1983 | 740 } |
2050 | 741 if(!i) return; |
1983 | 742 for (/* NOTHING */; i--; c++) { |
1984 | 743 char* s="unknown "; |
744 switch(c->status){ | |
745 case CODECS_STATUS_WORKING: s="working ";break; | |
746 case CODECS_STATUS_PROBLEMS: s="problems";break; | |
747 case CODECS_STATUS_NOT_WORKING: s="crashing";break; | |
748 case CODECS_STATUS_UNTESTED: s="untested";break; | |
749 } | |
1983 | 750 if(c->dll) |
3918 | 751 printf("%-11s%2d %s %s [%s]\n",c->name,c->driver,s,c->info,c->dll); |
1983 | 752 else |
3918 | 753 printf("%-11s%2d %s %s\n",c->name,c->driver,s,c->info); |
1983 | 754 |
755 } | |
756 | |
757 } | |
758 | |
759 | |
760 | |
607 | 761 #ifdef CODECS2HTML |
762 | |
763 void wrapline(FILE *f2,char *s){ | |
764 int c; | |
765 if(!s){ | |
766 fprintf(f2,"-"); | |
767 return; | |
768 } | |
769 while((c=*s++)){ | |
770 if(c==',') fprintf(f2,"<br>"); else fputc(c,f2); | |
771 } | |
772 } | |
773 | |
774 void parsehtml(FILE *f1,FILE *f2,codecs_t *codec,int section,int dshow){ | |
775 int c,d; | |
776 while((c=fgetc(f1))>=0){ | |
777 if(c!='%'){ | |
778 fputc(c,f2); | |
779 continue; | |
780 } | |
781 d=fgetc(f1); | |
782 | |
783 switch(d){ | |
784 case '.': | |
613 | 785 return; // end of section |
607 | 786 case 'n': |
787 wrapline(f2,codec->name); break; | |
788 case 'i': | |
789 wrapline(f2,codec->info); break; | |
790 case 'c': | |
791 wrapline(f2,codec->comment); break; | |
792 case 'd': | |
793 wrapline(f2,codec->dll); break; | |
794 case 'D': | |
795 fprintf(f2,"%c",codec->driver==dshow?'+':'-'); break; | |
796 case 'F': | |
797 for(d=0;d<CODECS_MAX_FOURCC;d++) | |
1944
4d8123ae7b4b
Fixed vfwex section, null codec and other fourcc issues and improved codecs-in.html usability.
atmos4
parents:
1929
diff
changeset
|
798 if(!d || codec->fourcc[d]!=0xFFFFFFFF) |
4d8123ae7b4b
Fixed vfwex section, null codec and other fourcc issues and improved codecs-in.html usability.
atmos4
parents:
1929
diff
changeset
|
799 fprintf(f2,"%s%.4s",d?"<br>":"",(codec->fourcc[d]==0xFFFFFFFF || codec->fourcc[d]<0x20202020)?!d?"-":"":(char*) &codec->fourcc[d]); |
607 | 800 break; |
801 case 'f': | |
802 for(d=0;d<CODECS_MAX_FOURCC;d++) | |
803 if(codec->fourcc[d]!=0xFFFFFFFF) | |
804 fprintf(f2,"%s0x%X",d?"<br>":"",codec->fourcc[d]); | |
805 break; | |
806 case 'Y': | |
807 for(d=0;d<CODECS_MAX_OUTFMT;d++) | |
808 if(codec->outfmt[d]!=0xFFFFFFFF){ | |
809 for (c=0; fmt_table[c].name; c++) | |
810 if(fmt_table[c].num==codec->outfmt[d]) break; | |
811 if(fmt_table[c].name) | |
812 fprintf(f2,"%s%s",d?"<br>":"",fmt_table[c].name); | |
813 } | |
814 break; | |
815 default: | |
816 fputc(c,f2); | |
817 fputc(d,f2); | |
818 } | |
819 } | |
820 | |
821 } | |
822 | |
823 void skiphtml(FILE *f1){ | |
824 int c,d; | |
825 while((c=fgetc(f1))>=0){ | |
826 if(c!='%'){ | |
827 continue; | |
828 } | |
829 d=fgetc(f1); | |
830 if(d=='.') return; // end of section | |
831 } | |
832 } | |
833 | |
834 int main(void) | |
835 { | |
4027 | 836 codecs_t *cl; |
607 | 837 FILE *f1; |
838 FILE *f2; | |
839 int c,d,i; | |
840 int pos; | |
841 int section=-1; | |
842 int nr_codecs; | |
843 int win32=-1; | |
844 int dshow=-1; | |
1944
4d8123ae7b4b
Fixed vfwex section, null codec and other fourcc issues and improved codecs-in.html usability.
atmos4
parents:
1929
diff
changeset
|
845 int win32ex=-1; |
607 | 846 |
4027 | 847 if (!(nr_codecs = parse_codec_cfg("etc/codecs.conf"))) |
607 | 848 return 0; |
849 | |
850 f1=fopen("DOCS/codecs-in.html","rb"); if(!f1) exit(1); | |
1689 | 851 f2=fopen("DOCS/codecs-status.html","wb"); if(!f2) exit(1); |
607 | 852 |
853 while((c=fgetc(f1))>=0){ | |
854 if(c!='%'){ | |
855 fputc(c,f2); | |
856 continue; | |
857 } | |
858 d=fgetc(f1); | |
859 if(d>='0' && d<='9'){ | |
860 // begin section | |
861 section=d-'0'; | |
862 printf("BEGIN %d\n",section); | |
863 if(section>=5){ | |
864 // audio | |
4027 | 865 cl = audio_codecs; |
607 | 866 nr_codecs = nr_acodecs; |
867 dshow=7;win32=4; | |
868 } else { | |
869 // video | |
4027 | 870 cl = video_codecs; |
607 | 871 nr_codecs = nr_vcodecs; |
1944
4d8123ae7b4b
Fixed vfwex section, null codec and other fourcc issues and improved codecs-in.html usability.
atmos4
parents:
1929
diff
changeset
|
872 dshow=4;win32=2;win32ex=6; |
607 | 873 } |
874 pos=ftell(f1); | |
875 for(i=0;i<nr_codecs;i++){ | |
876 fseek(f1,pos,SEEK_SET); | |
877 switch(section){ | |
878 case 0: | |
879 case 5: | |
880 if(cl[i].status==CODECS_STATUS_WORKING) | |
1944
4d8123ae7b4b
Fixed vfwex section, null codec and other fourcc issues and improved codecs-in.html usability.
atmos4
parents:
1929
diff
changeset
|
881 if(!(cl[i].driver==win32 || cl[i].driver==dshow || cl[i].driver==win32ex)) |
607 | 882 parsehtml(f1,f2,&cl[i],section,dshow); |
883 break; | |
884 case 1: | |
885 case 6: | |
886 if(cl[i].status==CODECS_STATUS_WORKING) | |
1944
4d8123ae7b4b
Fixed vfwex section, null codec and other fourcc issues and improved codecs-in.html usability.
atmos4
parents:
1929
diff
changeset
|
887 if(cl[i].driver==win32 || cl[i].driver==dshow || cl[i].driver==win32ex) |
607 | 888 parsehtml(f1,f2,&cl[i],section,dshow); |
889 break; | |
890 case 2: | |
891 case 7: | |
892 if(cl[i].status==CODECS_STATUS_PROBLEMS) | |
893 parsehtml(f1,f2,&cl[i],section,dshow); | |
894 break; | |
895 case 3: | |
896 case 8: | |
897 if(cl[i].status==CODECS_STATUS_NOT_WORKING) | |
898 parsehtml(f1,f2,&cl[i],section,dshow); | |
899 break; | |
900 case 4: | |
901 case 9: | |
902 if(cl[i].status==CODECS_STATUS_UNTESTED) | |
903 parsehtml(f1,f2,&cl[i],section,dshow); | |
904 break; | |
905 default: | |
906 printf("Warning! unimplemented section: %d\n",section); | |
907 } | |
908 } | |
909 fseek(f1,pos,SEEK_SET); | |
910 skiphtml(f1); | |
911 //void parsehtml(FILE *f1,FILE *f2,codecs_t *codec,int section,int dshow){ | |
912 | |
913 continue; | |
914 } | |
915 fputc(c,f2); | |
916 fputc(d,f2); | |
917 } | |
918 | |
919 fclose(f2); | |
920 fclose(f1); | |
921 return 0; | |
922 } | |
923 | |
924 #endif | |
925 | |
297 | 926 #ifdef TESTING |
927 int main(void) | |
928 { | |
4676 | 929 codecs_t *c; |
328 | 930 int i,j, nr_codecs, state; |
297 | 931 |
4676 | 932 if (!(parse_codec_cfg("etc/codecs.conf"))) |
319 | 933 return 0; |
4676 | 934 if (!video_codecs) |
328 | 935 printf("no videoconfig.\n"); |
4676 | 936 if (!audio_codecs) |
328 | 937 printf("no audioconfig.\n"); |
938 | |
939 printf("videocodecs:\n"); | |
4676 | 940 c = video_codecs; |
328 | 941 nr_codecs = nr_vcodecs; |
942 state = 0; | |
943 next: | |
944 if (c) { | |
4676 | 945 printf("number of %scodecs: %d\n", state==0?"video":"audio", |
946 nr_codecs); | |
328 | 947 for(i=0;i<nr_codecs;i++, c++){ |
4676 | 948 printf("\n============== %scodec %02d ===============\n", |
949 state==0?"video":"audio",i); | |
328 | 950 printf("name='%s'\n",c->name); |
951 printf("info='%s'\n",c->info); | |
952 printf("comment='%s'\n",c->comment); | |
953 printf("dll='%s'\n",c->dll); | |
361 | 954 printf("flags=%X driver=%d status=%d cpuflags=%d\n", |
955 c->flags, c->driver, c->status, c->cpuflags); | |
300 | 956 |
328 | 957 for(j=0;j<CODECS_MAX_FOURCC;j++){ |
958 if(c->fourcc[j]!=0xFFFFFFFF){ | |
361 | 959 printf("fourcc %02d: %08X (%.4s) ===> %08X (%.4s)\n",j,c->fourcc[j],(char *) &c->fourcc[j],c->fourccmap[j],(char *) &c->fourccmap[j]); |
328 | 960 } |
961 } | |
962 | |
963 for(j=0;j<CODECS_MAX_OUTFMT;j++){ | |
964 if(c->outfmt[j]!=0xFFFFFFFF){ | |
361 | 965 printf("outfmt %02d: %08X (%.4s) flags: %d\n",j,c->outfmt[j],(char *) &c->outfmt[j],c->outflags[j]); |
328 | 966 } |
967 } | |
300 | 968 |
4676 | 969 for(j=0;j<CODECS_MAX_INFMT;j++){ |
970 if(c->infmt[j]!=0xFFFFFFFF){ | |
971 printf("infmt %02d: %08X (%.4s) flags: %d\n",j,c->infmt[j],(char *) &c->infmt[j],c->inflags[j]); | |
972 } | |
973 } | |
974 | |
328 | 975 printf("GUID: %08lX %04X %04X",c->guid.f1,c->guid.f2,c->guid.f3); |
976 for(j=0;j<8;j++) printf(" %02X",c->guid.f4[j]); | |
977 printf("\n"); | |
300 | 978 |
328 | 979 |
980 } | |
981 } | |
982 if (!state) { | |
983 printf("audiocodecs:\n"); | |
4676 | 984 c = audio_codecs; |
328 | 985 nr_codecs = nr_acodecs; |
986 state = 1; | |
987 goto next; | |
988 } | |
297 | 989 return 0; |
990 } | |
991 | |
992 #endif |