diff libao2/ao_oss.c @ 1528:a444bd456fcc

ac3/spdif patch by German Gomez Garcia <german@piraos.com>
author arpi
date Wed, 15 Aug 2001 11:50:55 +0000
parents 8c57a5a3c645
children cb9bc07f3d4c
line wrap: on
line diff
--- a/libao2/ao_oss.c	Wed Aug 15 07:21:33 2001 +0000
+++ b/libao2/ao_oss.c	Wed Aug 15 11:50:55 2001 +0000
@@ -55,6 +55,9 @@
 	{
 	    ao_control_vol_t *vol = (ao_control_vol_t *)arg;
 	    int fd, v, mcmd, devs;
+
+	    if(ao_format == AFMT_AC3)
+		return CONTROL_TRUE;
     
 	    if ((fd = open("/dev/mixer", O_RDONLY)) > 0)
 	    {
@@ -119,9 +122,14 @@
 
   ao_format=format;
   ioctl (audio_fd, SNDCTL_DSP_SETFMT, &ao_format);
+  if(format == AFMT_AC3 && ao_format != AFMT_AC3) {
+      printf("Can't set audio device %s to AC3 output\n", dsp);
+      return 0;
+  }
   printf("audio_setup: sample format: %s (requested: %s)\n",
     audio_out_format_name(ao_format), audio_out_format_name(format));
   
+  if(format != AFMT_AC3) {
   ao_channels=channels-1;
   ioctl (audio_fd, SNDCTL_DSP_STEREO, &ao_channels);
   
@@ -129,6 +137,7 @@
   ao_samplerate=rate;
   ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_samplerate);
   printf("audio_setup: using %d Hz samplerate (requested: %d)\n",ao_samplerate,rate);
+  }
 
   if(ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &zz)==-1){
       int r=0;
@@ -191,9 +200,10 @@
     }
 
   ioctl (audio_fd, SNDCTL_DSP_SETFMT, &ao_format);
+  if(ao_format != AFMT_AC3) {
   ioctl (audio_fd, SNDCTL_DSP_STEREO, &ao_channels);
   ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_samplerate);
-
+  }
 }
 
 // stop playing, keep buffers (for pause)