diff libao2/ao_mpegpes.c @ 3095:981a9e5118ce

interface to libao2 changed ao_plugin added
author anders
date Sat, 24 Nov 2001 05:21:22 +0000
parents b24661a9924e
children 4ebab79785b7
line wrap: on
line diff
--- a/libao2/ao_mpegpes.c	Sat Nov 24 02:05:06 2001 +0000
+++ b/libao2/ao_mpegpes.c	Sat Nov 24 05:21:22 2001 +0000
@@ -16,13 +16,6 @@
 
 LIBAO_EXTERN(mpegpes)
 
-// there are some globals:
-// ao_samplerate
-// ao_channels
-// ao_format
-// ao_bps
-// ao_outburst
-// ao_buffersize
 
 // to set/get/query special features/parameters
 static int control(int cmd,int arg){
@@ -33,8 +26,8 @@
 // return: 1=success 0=fail
 static int init(int rate,int channels,int format,int flags){
 
-    ao_outburst=2000;
-    ao_format=format;
+    ao_data.outburst=2000;
+    ao_data.format=format;
 
     return 1;
 }
@@ -67,10 +60,10 @@
 
 // return: how many bytes can be played without blocking
 static int get_space(){
-    float x=(float)(vo_pts-ao_pts)/90000.0-0.5;
+    float x=(float)(vo_pts-ao_data.pts)/90000.0-0.5;
     int y;
     if(x<=0) return 0;
-    y=48000*4*x;y/=ao_outburst;y*=ao_outburst;
+    y=48000*4*x;y/=ao_data.outburst;y*=ao_data.outburst;
 //    printf("diff: %5.3f -> %d  \n",x,y);
     return y;
 }
@@ -79,20 +72,20 @@
 // it should round it down to outburst*n
 // return: number of bytes played
 static int play(void* data,int len,int flags){
-    if(ao_format==AFMT_MPEG)
-	send_pes_packet(data,len,0x1C0,ao_pts);
+    if(ao_data.format==AFMT_MPEG)
+	send_pes_packet(data,len,0x1C0,ao_data.pts);
     else {
 	int i;
 	unsigned short *s=data;
 	for(i=0;i<len/2;i++) s[i]=(s[i]>>8)|(s[i]<<8); // le<->be
-	send_lpcm_packet(data,len,0xA0,ao_pts);
+	send_lpcm_packet(data,len,0xA0,ao_data.pts);
     }
     return len;
 }
 
-// return: how many unplayed bytes are in the buffer
-static int get_delay(){
+// return: delay in seconds between first and last sample in buffer
+static float get_delay(){
 
-    return 0;
+    return 0.0;
 }