comparison libao2/ao_mpegpes.c @ 4331:ce1e3668fa2b

freq fix, removed muxer delay
author arpi
date Thu, 24 Jan 2002 00:53:22 +0000
parents 624c73ec1c54
children d678ce495a75
comparison
equal deleted inserted replaced
4330:41dbef7900d0 4331:ce1e3668fa2b
20 // to set/get/query special features/parameters 20 // to set/get/query special features/parameters
21 static int control(int cmd,int arg){ 21 static int control(int cmd,int arg){
22 return -1; 22 return -1;
23 } 23 }
24 24
25 25 static int freq=0;
26 static int freq_id=0; 26 static int freq_id=0;
27 27
28 // open & setup audio device 28 // open & setup audio device
29 // return: 1=success 0=fail 29 // return: 1=success 0=fail
30 static int init(int rate,int channels,int format,int flags){ 30 static int init(int rate,int channels,int format,int flags){
31 31
32 ao_data.outburst=2000; 32 ao_data.outburst=2000;
33 ao_data.format=format; 33 ao_data.format=format;
34 freq=rate;
34 35
35 switch(rate){ 36 switch(rate){
36 case 48000: freq_id=0;break; 37 case 48000: freq_id=0;break;
37 case 96000: freq_id=1;break; 38 case 96000: freq_id=1;break;
38 case 44100: freq_id=2;break; 39 case 44100: freq_id=2;break;
71 void send_lpcm_packet(unsigned char* data,int len,int id,int timestamp,int freq_id); 72 void send_lpcm_packet(unsigned char* data,int len,int id,int timestamp,int freq_id);
72 extern int vo_pts; 73 extern int vo_pts;
73 74
74 // return: how many bytes can be played without blocking 75 // return: how many bytes can be played without blocking
75 static int get_space(){ 76 static int get_space(){
76 float x=(float)(vo_pts-ao_data.pts)/90000.0-0.5; 77 float x=(float)(vo_pts-ao_data.pts)/90000.0;
77 int y; 78 int y;
78 if(x<=0) return 0; 79 if(x<=0) return 0;
79 y=48000*4*x;y/=ao_data.outburst;y*=ao_data.outburst; 80 y=freq*4*x;y/=ao_data.outburst;y*=ao_data.outburst;
80 // if(y>2000) y=2000; 81 if(y>32000) y=32000;
81 // printf("diff: %5.3f -> %d \n",x,y); 82 // printf("diff: %5.3f -> %d \n",x,y);
82 return y; 83 return y;
83 } 84 }
84 85
85 // plays 'len' bytes of 'data' 86 // plays 'len' bytes of 'data'