diff libao2/ao_oss.c @ 1038:b36fb1ae4b53

applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
author arpi_esp
date Tue, 05 Jun 2001 18:40:44 +0000
parents 72cacd3b8f30
children cab5ba9ffc6c
line wrap: on
line diff
--- a/libao2/ao_oss.c	Tue Jun 05 16:52:51 2001 +0000
+++ b/libao2/ao_oss.c	Tue Jun 05 18:40:44 2001 +0000
@@ -7,11 +7,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#ifdef __sun
-#include <sys/audioio.h>
-#else
 #include <sys/soundcard.h>
-#endif
 
 #include "../config.h"
 
@@ -36,13 +32,8 @@
 // ao_outburst
 // ao_buffersize
 
-#ifdef __sun
-static char *dsp="/dev/audio";
-static int queued_bursts = 0;
-#else
 static char *dsp="/dev/dsp";
 static audio_buf_info zz;
-#endif
 static int audio_fd=-1;
 
 // to set/get/query special features/parameters
@@ -69,22 +60,6 @@
     return 0;
   }
 
-#ifdef __sun
-  {
-    audio_info_t info;
-    ioctl(audio_fd, AUDIO_GETINFO, &info);
-    ioctl(audio_fd, AUDIO_DRAIN, 0);
-    info.play.encoding = ao_format = format;
-    info.play.precision = (format==AUDIO_ENCODING_LINEAR? AUDIO_PRECISION_16:AUDIO_PRECISION_8);
-    info.play.channels = ao_channels = channels;
-    --ao_channels;
-    info.play.sample_rate = ao_samplerate = rate;
-    if(ioctl (audio_fd, AUDIO_SETINFO, &info)<0)
-      printf("audio_setup: your card doesn't support %d Hz samplerate\n",rate);
-    ao_outburst=8192;
-    queued_bursts = 0;
-  }
-#else
   ao_format=format;
   ioctl (audio_fd, SNDCTL_DSP_SETFMT, &ao_format);
   printf("audio_setup: sample format: 0x%X  (requested: 0x%X)\n",ao_format,format);
@@ -112,7 +87,6 @@
       if(ao_buffersize==-1) ao_buffersize=zz.bytes;
       ao_outburst=zz.fragsize;
   }
-#endif
 
   if(ao_buffersize==-1){
     // Measuring buffer size:
@@ -135,9 +109,6 @@
           printf("Recompile mplayer with #undef HAVE_AUDIO_SELECT in config.h !\n\n");
         return 0;
     }
-#ifdef __sun
-    ioctl(audio_fd, AUDIO_DRAIN, 0);
-#endif
 #endif
   }
 
@@ -161,26 +132,25 @@
 	return;
     }
 
-#ifdef __sun
-  {
-    audio_info_t info;
-    ioctl(audio_fd, AUDIO_GETINFO, &info);
-    ioctl(audio_fd, AUDIO_DRAIN, 0);
-    info.play.encoding = ao_format;
-    info.play.precision = (ao_format==AUDIO_ENCODING_LINEAR? AUDIO_PRECISION_16:AUDIO_PRECISION_8);
-    info.play.channels = ao_channels+1;
-    info.play.sample_rate = ao_samplerate;
-    ioctl (audio_fd, AUDIO_SETINFO, &info);
-    queued_bursts = 0;
-  }
-#else
   ioctl (audio_fd, SNDCTL_DSP_SETFMT, &ao_format);
   ioctl (audio_fd, SNDCTL_DSP_STEREO, &ao_channels);
   ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_samplerate);
-#endif
 
 }
 
+// stop playing, keep buffers (for pause)
+static void audio_pause()
+{
+    // for now, just call reset();
+    reset();
+}
+
+// resume playing, after audio_pause()
+static void audio_resume()
+{
+}
+
+
 // return: how many bytes can be played without blocking
 static int get_space(){
   int playsize=ao_outburst;
@@ -204,14 +174,6 @@
     }
 #endif
 
-#ifdef __sun
-  {
-    audio_info_t info;
-    ioctl(audio_fd, AUDIO_GETINFO, &info);
-    if(queued_bursts - info.play.eof > 2)
-      return 0;
-  }
-#endif
   return ao_outburst;
 }
 
@@ -221,12 +183,6 @@
 static int play(void* data,int len,int flags){
     len/=ao_outburst;
     len=write(audio_fd,data,len*ao_outburst);
-#ifdef __sun
-    if(len>0) {
-      queued_bursts ++;
-      write(audio_fd,data,0);
-    }
-#endif
     return len;
 }
 
@@ -234,14 +190,6 @@
 
 // return: how many unplayed bytes are in the buffer
 static int get_delay(){
-#ifdef __sun
- {
-   int q;
-    audio_info_t info;
-    ioctl(audio_fd, AUDIO_GETINFO, &info);
-    return (queued_bursts - info.play.eof) * ao_outburst;
- }
-#else
   if(audio_delay_method==2){
       // 
       int r=0;
@@ -256,6 +204,5 @@
       audio_delay_method=0; // fallback if not supported
   }
   return ao_buffersize;
-#endif
 }