annotate TOOLS/alaw-gen.c @ 4218:3931c41f740a

Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend) Added lots of comments, should be pretty easy to understand most of the internals now Added lots of brackets to if's for's while's etc, this is not a cosmetical thing but rather due to the fact I got some very odd bugs with else's since I didn't properly use brackets (and it's the K&R standard to have brackets everywhere) Fixed some bugs that would occur when disabling libmp1e Switched to default to the new naming scheme of device nodes, the driver will slowly switch over to this state, if it can't find devices under the new name it will try the old naming scheme I stopped opening devices in non-blocking mode, it would break the new syncengine which tries to burst data to the device (alot of times meaning it will fill the fifo pretty fast which would previously result in jerkyness on fast machines) The device now sets the initial state of the pts and speed (probably not needed, but assumption is the mother of all fuckups =) Keep the control interface open during the entire duration of the libvo device, we might need this to flush video buffers on seeking (currently not implemented, therefore seeking is broken) This is beta stuff to the driver, I will get some users to test it for me and do my best to fix seeking as soon as possible...
author mswitch
date Thu, 17 Jan 2002 10:33:47 +0000
parents 714bc8aadb68
children f15f95c2671a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
1 #include <stdio.h>
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
2 #include <stdlib.h>
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
3
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
4 // sox -t raw -A -r 8000 -b alaw.alaw -t sw alaw.out
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
5
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
6 int main(){
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
7 int i;
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
8 FILE *f;
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
9
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
10 f=fopen("alaw.dat","wb");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
11 for(i=0;i<256;i++) fwrite(&i,1,1,f);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
12 fclose(f);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
13
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
14 system("sox -t raw -A -r 8000 -b alaw.dat -t sw alaw.out");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
15
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
16 printf("// Generated by TOOLS/alaw-gen.c\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
17
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
18 printf("\nshort alaw2short[]={\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
19
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
20 f=fopen("alaw.out","rb");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
21 for(i=0;i<256;i++){
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
22 signed short x;
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
23 fread(&x,2,1,f);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
24 printf("%6d",x);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
25 if(i!=255) putchar(',');
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
26 if((i&7)==7) printf("\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
27 }
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
28 fclose(f);
880
714bc8aadb68 missing semicolon fixed
arpi_esp
parents: 879
diff changeset
29 printf("};\n");
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
30
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
31 system("sox -t raw -U -r 8000 -b alaw.dat -t sw alaw.out");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
32
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
33 printf("\nshort ulaw2short[]={\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
34
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
35 f=fopen("alaw.out","rb");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
36 for(i=0;i<256;i++){
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
37 signed short x;
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
38 fread(&x,2,1,f);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
39 printf("%6d",x);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
40 if(i!=255) putchar(',');
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
41 if((i&7)==7) printf("\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
42 }
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
43 fclose(f);
880
714bc8aadb68 missing semicolon fixed
arpi_esp
parents: 879
diff changeset
44 printf("};\n");
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
45
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
46
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
47 }