[Mplayer-cvslog] CVS: main/libao2 ao_oss.c,1.2,1.3

GEREOFFY arpi_esp at users.sourceforge.net
Tue Jun 5 04:26:58 CEST 2001


Update of /cvsroot/mplayer/main/libao2
In directory usw-pr-cvs1:/tmp/cvs-serv8385/libao2

Modified Files:
	ao_oss.c 
Log Message:
Solaris 8 support - patch by Marcus Comstedt <marcus at idonex.se>

Index: ao_oss.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_oss.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** ao_oss.c	2001/06/03 00:24:49	1.2
--- ao_oss.c	2001/06/05 02:26:56	1.3
***************
*** 8,12 ****
--- 8,16 ----
  #include <sys/stat.h>
  #include <fcntl.h>
+ #ifdef __sun
+ #include <sys/audioio.h>
+ #else
  #include <sys/soundcard.h>
+ #endif
  
  #include "../config.h"
***************
*** 33,39 ****
  // ao_buffersize
  
! static char* dsp="/dev/dsp";
! static int audio_fd=-1;
  static audio_buf_info zz;
  
  // to set/get/query special features/parameters
--- 37,48 ----
  // 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
***************
*** 61,64 ****
--- 70,89 ----
    }
  
+ #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);
***************
*** 88,91 ****
--- 113,117 ----
        ao_outburst=zz.fragsize;
    }
+ #endif
  
    if(ao_buffersize==-1){
***************
*** 110,114 ****
--- 136,143 ----
          return 0;
      }
+ #ifdef __sun
+     ioctl(audio_fd, AUDIO_DRAIN, 0);
  #endif
+ #endif
    }
  
***************
*** 118,122 ****
--- 147,153 ----
  // close audio device
  static void uninit(){
+ #ifdef SNDCTL_DSP_RESET
      ioctl(audio_fd, SNDCTL_DSP_RESET, NULL);
+ #endif
      close(audio_fd);
  }
***************
*** 131,137 ****
--- 162,182 ----
      }
  
+ #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
  
  }
***************
*** 141,148 ****
--- 186,195 ----
    int playsize=ao_outburst;
  
+ #ifdef SNDCTL_DSP_GETOSPACE
    if(ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &zz)!=-1){
        // calculate exact buffer space:
        return zz.fragments*zz.fragsize;
    }
+ #endif
  
      // check buffer
***************
*** 158,162 ****
  #endif
  
!     return ao_outburst;
  }
  
--- 205,217 ----
  #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;
  }
  
***************
*** 167,170 ****
--- 222,231 ----
      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;
  }
***************
*** 174,177 ****
--- 235,246 ----
  // 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){
        // 
***************
*** 188,191 ****
--- 257,261 ----
    }
    return ao_buffersize;
+ #endif
  }
  


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list