aboutsummaryrefslogtreecommitdiffhomepage
path: root/libao2/ao_dxr3.c
diff options
context:
space:
mode:
authorGravatar mswitch <mswitch@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-12-04 23:13:15 +0000
committerGravatar mswitch <mswitch@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-12-04 23:13:15 +0000
commit6409ef3cc8c7cd983e60268c41b09b09d52d066d (patch)
tree406f32edda37ae1e2a54b6b7d68ff40f1d1ae36a /libao2/ao_dxr3.c
parent7af3856b519388e95fe0afb22de303640dc948af (diff)
Tried fixing a bug relating to users with digital audio output (I'm unable to test if this works myself since I don't have a decoder)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3329 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2/ao_dxr3.c')
-rw-r--r--libao2/ao_dxr3.c98
1 files changed, 48 insertions, 50 deletions
diff --git a/libao2/ao_dxr3.c b/libao2/ao_dxr3.c
index 65c9c18f9d..b9d770216b 100644
--- a/libao2/ao_dxr3.c
+++ b/libao2/ao_dxr3.c
@@ -53,61 +53,59 @@ static int control(int cmd,int arg)
// return: 1=success 0=fail
static int init(int rate,int channels,int format,int flags)
{
- int ioval;
- fd_audio = open( "/dev/em8300_ma", O_WRONLY );
- if( fd_audio < 0 )
- {
- printf("AO: [dxr3] Can't open audio device /dev/em8300_ma -> nosound\n");
- return 0;
- }
+ int ioval;
+ fd_audio = open( "/dev/em8300_ma", O_WRONLY );
+ if( fd_audio < 0 )
+ {
+ printf("AO: [dxr3] Can't open audio device /dev/em8300_ma -> nosound\n");
+ return 0;
+ }
- fd_control = open( "/dev/em8300", O_WRONLY );
- if( fd_control < 0 )
- {
- printf("AO: [dxr3] Can't open em8300 control /dev/em8300\n");
- return 0;
- }
+ fd_control = open( "/dev/em8300", O_WRONLY );
+ if( fd_control < 0 )
+ {
+ printf("AO: [dxr3] Can't open em8300 control /dev/em8300\n");
+ return 0;
+ }
- ioctl(fd_audio, SNDCTL_DSP_RESET, NULL);
- ao_data.format = format;
- if( ioctl (fd_audio, SNDCTL_DSP_SETFMT, &ao_data.format) < 0 )
- printf( "AO: [dxr3] Unable to set audio format\n" );
- if(format == AFMT_AC3 && ao_data.format != AFMT_AC3)
- {
- printf("AO: [dxr3] Can't set audio device /dev/em8300_ma to AC3 output\n");
- return 0;
- }
- printf("AO: [dxr3] Sample format: %s (requested: %s)\n",
- audio_out_format_name(ao_data.format), audio_out_format_name(format));
+ ioctl(fd_audio, SNDCTL_DSP_RESET, NULL);
+ ao_data.format = format;
+ if( ioctl (fd_audio, SNDCTL_DSP_SETFMT, &ao_data.format) < 0 )
+ printf( "AO: [dxr3] Unable to set audio format\n" );
+ if(format == AFMT_AC3 && ao_data.format != AFMT_AC3)
+ {
+ printf("AO: [dxr3] Can't set audio device /dev/em8300_ma to AC3 output\n");
+ return 0;
+ }
- if(format != AFMT_AC3)
- {
- ao_data.channels=channels-1;
- if( ioctl (fd_audio, SNDCTL_DSP_STEREO, &ao_data.channels) < 0 )
- printf( "AO: [dxr3] Unable to set number of channels\n" );
+ printf("AO: [dxr3] Sample format: %s (requested: %s)\n",
+ audio_out_format_name(ao_data.format), audio_out_format_name(format));
- ao_data.bps = (channels+1)*rate;
- ao_data.samplerate=rate;
- if( ioctl (fd_audio, SNDCTL_DSP_SPEED, &ao_data.samplerate) < 0 )
- {
- printf( "AO: [dxr3] Unable to set samplerate\n" );
- return 0;
- }
- if( rate < ao_data.samplerate )
- {
- ao_data.samplerate = 44100;
- ioctl(fd_audio, SNDCTL_DSP_SPEED, &ao_data.samplerate);
- if( ao_data.samplerate != 44100 )
- {
- printf( "AO: [dxr3] Unable to set samplerate\n" );
- return 0;
- }
- printf("AO: [dxr3] Using %d Hz samplerate (requested: %d) (Upsampling)\n",ao_data.samplerate,rate);
- ao_data.samplerate = rate;
- }
+ ao_data.channels=channels-1;
+ if( ioctl (fd_audio, SNDCTL_DSP_STEREO, &ao_data.channels) < 0 )
+ printf( "AO: [dxr3] Unable to set number of channels\n" );
+
+ ao_data.bps = (channels+1)*rate;
+ ao_data.samplerate=rate;
+ if( ioctl (fd_audio, SNDCTL_DSP_SPEED, &ao_data.samplerate) < 0 )
+ {
+ printf( "AO: [dxr3] Unable to set samplerate\n" );
+ return 0;
+ }
+ if( rate < ao_data.samplerate )
+ {
+ ao_data.samplerate = 44100;
+ ioctl(fd_audio, SNDCTL_DSP_SPEED, &ao_data.samplerate);
+ if( ao_data.samplerate != 44100 )
+ {
+ printf( "AO: [dxr3] Unable to set samplerate\n" );
+ return 0;
+ }
+ printf("AO: [dxr3] Using %d Hz samplerate (requested: %d) (Upsampling)\n",ao_data.samplerate,rate);
+ ao_data.samplerate = rate;
+ }
else printf("AO: [dxr3] Using %d Hz samplerate (requested: %d)\n",ao_data.samplerate,rate);
- }
- else ao_data.bps *= 2;
+ if(format == AFMT_AC3 ) ao_data.bps *= 2;
if( ioctl(fd_audio, SNDCTL_DSP_GETOSPACE, &dxr3_buf_info)==-1 )
{