aboutsummaryrefslogtreecommitdiffhomepage
path: root/libao2
diff options
context:
space:
mode:
authorGravatar arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-08-15 11:50:55 +0000
committerGravatar arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-08-15 11:50:55 +0000
commit7c9c86fb97c49974274ea2404c5461fe42db5472 (patch)
treefe0535a64aee23c1413683f1a997b625c79d7b9f /libao2
parent26543fef95be404da8ee8b1ef242acb6eea9cc22 (diff)
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1529 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2')
-rw-r--r--libao2/ao_oss.c12
-rw-r--r--libao2/audio_out.c2
2 files changed, 13 insertions, 1 deletions
diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c
index d6f1673b79..7f0bb0b056 100644
--- a/libao2/ao_oss.c
+++ b/libao2/ao_oss.c
@@ -55,6 +55,9 @@ static int control(int cmd,int arg){
{
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 @@ static int init(int rate,int channels,int format,int flags){
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 @@ static int init(int rate,int channels,int format,int flags){
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 @@ static void reset(){
}
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)
diff --git a/libao2/audio_out.c b/libao2/audio_out.c
index d87f06e2f5..bf416ad148 100644
--- a/libao2/audio_out.c
+++ b/libao2/audio_out.c
@@ -87,6 +87,8 @@ char *audio_out_format_name(int format)
return("Unsigned 16-bit (Big-Endian)");
case AFMT_MPEG:
return("MPEG (2) audio");
+ case AFMT_AC3:
+ return("AC3");
/*
the following two formats are not available with old linux kernel
headers (e.g. in 2.2.16)