Mercurial > mplayer.hg
annotate TOOLS/alaw-gen.c @ 25765:304fc0bbefe1
audio_out / video_out structs should be treated as const
author | reimar |
---|---|
date | Sat, 19 Jan 2008 11:33:36 +0000 |
parents | 5c5fb6af79d1 |
children | 3bb953467710 |
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 | |
16 printf("// Generated by TOOLS/alaw-gen.c\n"); | |
17 | |
18 printf("\nshort alaw2short[]={\n"); | |
19 | |
20 f=fopen("alaw.out","rb"); | |
21 for(i=0;i<256;i++){ | |
22 signed short x; | |
23 fread(&x,2,1,f); | |
24 printf("%6d",x); | |
25 if(i!=255) putchar(','); | |
26 if((i&7)==7) printf("\n"); | |
27 } | |
28 fclose(f); | |
880 | 29 printf("};\n"); |
879 | 30 |
31 system("sox -t raw -U -r 8000 -b alaw.dat -t sw alaw.out"); | |
32 | |
33 printf("\nshort ulaw2short[]={\n"); | |
34 | |
35 f=fopen("alaw.out","rb"); | |
36 for(i=0;i<256;i++){ | |
37 signed short x; | |
38 fread(&x,2,1,f); | |
39 printf("%6d",x); | |
40 if(i!=255) putchar(','); | |
41 if((i&7)==7) printf("\n"); | |
42 } | |
43 fclose(f); | |
880 | 44 printf("};\n"); |
879 | 45 |
23659
f15f95c2671a
Fix "control reaches end of non-void function" warnings.
diego
parents:
880
diff
changeset
|
46 return 0; |
879 | 47 } |