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