mirror of
https://github.com/mpv-player/mpv
synced 2024-12-15 11:25:10 +00:00
6063301513
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26089 b3059339-0415-0410-9bf9-f77b7e298cf2
53 lines
964 B
C
53 lines
964 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
// sox -t raw -A -r 8000 -b alaw.alaw -t sw alaw.out
|
|
|
|
int main(void){
|
|
int i;
|
|
FILE *f;
|
|
|
|
f=fopen("alaw.dat","wb");
|
|
for(i=0;i<256;i++) fwrite(&i,1,1,f);
|
|
fclose(f);
|
|
|
|
system("sox -t raw -A -r 8000 -b alaw.dat -t sw alaw.out");
|
|
|
|
printf("// Generated by TOOLS/alaw-gen.c\n\n");
|
|
|
|
printf("#ifndef MPLAYER_ALAW_H\n");
|
|
printf("#define MPLAYER_ALAW_H\n");
|
|
|
|
printf("\nconst short alaw2short[]={\n");
|
|
|
|
f=fopen("alaw.out","rb");
|
|
for(i=0;i<256;i++){
|
|
signed short x;
|
|
fread(&x,2,1,f);
|
|
printf("%7d",x);
|
|
if(i!=255) putchar(',');
|
|
if((i&7)==7) printf("\n");
|
|
}
|
|
fclose(f);
|
|
printf("};\n");
|
|
|
|
system("sox -t raw -U -r 8000 -b alaw.dat -t sw alaw.out");
|
|
|
|
printf("\nconst short ulaw2short[]={\n");
|
|
|
|
f=fopen("alaw.out","rb");
|
|
for(i=0;i<256;i++){
|
|
signed short x;
|
|
fread(&x,2,1,f);
|
|
printf("%7d",x);
|
|
if(i!=255) putchar(',');
|
|
if((i&7)==7) printf("\n");
|
|
}
|
|
fclose(f);
|
|
printf("};\n\n");
|
|
|
|
printf("#endif /* MPLAYER_ALAW_H */\n");
|
|
|
|
return 0;
|
|
}
|