Mercurial > mplayer.hg
annotate TOOLS/alaw-gen.c @ 29774:fa6aeebaf41a
add ffmpeg eatgv codec
patch by Jan Engelhardt jengelh ta medozas.de
author | compn |
---|---|
date | Tue, 03 Nov 2009 20:03:37 +0000 |
parents | 044b3c830459 |
children | b573c7c7173b |
rev | line source |
---|---|
879 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 | |
4 // sox -t raw -A -r 8000 -b alaw.alaw -t sw alaw.out | |
5 | |
23662
5c5fb6af79d1
Mark main() function as a function that takes no parameters.
diego
parents:
23659
diff
changeset
|
6 int main(void){ |
879 | 7 int i; |
8 FILE *f; | |
9 | |
10 f=fopen("alaw.dat","wb"); | |
11 for(i=0;i<256;i++) fwrite(&i,1,1,f); | |
12 fclose(f); | |
13 | |
14 system("sox -t raw -A -r 8000 -b alaw.dat -t sw alaw.out"); | |
15 | |
25865
b1316c443f87
Add multiple inclusion guards to generated header file.
diego
parents:
25864
diff
changeset
|
16 printf("// Generated by TOOLS/alaw-gen.c\n\n"); |
b1316c443f87
Add multiple inclusion guards to generated header file.
diego
parents:
25864
diff
changeset
|
17 |
26057
044b3c830459
Add MPLAYER_ prefix to multiple inclusion guard of generated file.
diego
parents:
25865
diff
changeset
|
18 printf("#ifndef MPLAYER_ALAW_H\n"); |
044b3c830459
Add MPLAYER_ prefix to multiple inclusion guard of generated file.
diego
parents:
25865
diff
changeset
|
19 printf("#define MPLAYER_ALAW_H\n"); |
879 | 20 |
25863 | 21 printf("\nconst short alaw2short[]={\n"); |
879 | 22 |
23 f=fopen("alaw.out","rb"); | |
24 for(i=0;i<256;i++){ | |
25 signed short x; | |
26 fread(&x,2,1,f); | |
25864
ae6c30322f95
Change format string so that the table is nicely aligned.
diego
parents:
25863
diff
changeset
|
27 printf("%7d",x); |
879 | 28 if(i!=255) putchar(','); |
29 if((i&7)==7) printf("\n"); | |
30 } | |
31 fclose(f); | |
880 | 32 printf("};\n"); |
879 | 33 |
34 system("sox -t raw -U -r 8000 -b alaw.dat -t sw alaw.out"); | |
35 | |
25863 | 36 printf("\nconst short ulaw2short[]={\n"); |
879 | 37 |
38 f=fopen("alaw.out","rb"); | |
39 for(i=0;i<256;i++){ | |
40 signed short x; | |
41 fread(&x,2,1,f); | |
25864
ae6c30322f95
Change format string so that the table is nicely aligned.
diego
parents:
25863
diff
changeset
|
42 printf("%7d",x); |
879 | 43 if(i!=255) putchar(','); |
44 if((i&7)==7) printf("\n"); | |
45 } | |
46 fclose(f); | |
25865
b1316c443f87
Add multiple inclusion guards to generated header file.
diego
parents:
25864
diff
changeset
|
47 printf("};\n\n"); |
b1316c443f87
Add multiple inclusion guards to generated header file.
diego
parents:
25864
diff
changeset
|
48 |
26057
044b3c830459
Add MPLAYER_ prefix to multiple inclusion guard of generated file.
diego
parents:
25865
diff
changeset
|
49 printf("#endif /* MPLAYER_ALAW_H */\n"); |
879 | 50 |
23659
f15f95c2671a
Fix "control reaches end of non-void function" warnings.
diego
parents:
880
diff
changeset
|
51 return 0; |
879 | 52 } |