summaryrefslogtreecommitdiffstats
path: root/dec_audio.c
diff options
context:
space:
mode:
authorsteve <steve@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-11-28 12:46:23 +0000
committersteve <steve@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-11-28 12:46:23 +0000
commitf6ee7f826c787b760deeab4403f206fa0f4581cf (patch)
treee7877e14806fa9c528288542f3bdef093a8e3c66 /dec_audio.c
parentb7ff737901eeb3425e56a587f812c34ff969a776 (diff)
downloadmpv-f6ee7f826c787b760deeab4403f206fa0f4581cf.tar.bz2
mpv-f6ee7f826c787b760deeab4403f206fa0f4581cf.tar.xz
Extended oss output driver and libac3 to support 4 and 6 channel output mixes. added -channels command line option
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3182 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'dec_audio.c')
-rw-r--r--dec_audio.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/dec_audio.c b/dec_audio.c
index c13c2880ab..52de2bebf2 100644
--- a/dec_audio.c
+++ b/dec_audio.c
@@ -83,6 +83,9 @@ static struct mad_stream mad_stream;
static struct mad_frame mad_frame;
static struct mad_synth mad_synth;
+/* used for ac3surround decoder - set using -channels option */
+int audio_output_channels = 2;
+
// ensure buffer is filled with some data
static void mad_prepare_buffer(sh_audio_t* sh_audio, struct mad_stream* ms, int length)
@@ -228,7 +231,8 @@ case AFM_ALAW:
break;
case AFM_AC3:
// Dolby AC3 audio:
- sh_audio->audio_out_minsize=4*256*6;
+ // however many channels, 2 bytes in a word, 256 samples in a block, 6 blocks in a frame
+ sh_audio->audio_out_minsize=audio_output_channels*2*256*6;
break;
case AFM_HWAC3:
// Dolby AC3 audio:
@@ -329,7 +333,7 @@ case AFM_AC3: {
// Dolby AC3 audio:
dec_audio_sh=sh_audio; // save sh_audio for the callback:
ac3_config.fill_buffer_callback = ac3_fill_buffer;
- ac3_config.num_output_ch = 2;
+ ac3_config.num_output_ch = audio_output_channels;
ac3_config.flags = 0;
if(gCpuCaps.hasMMX){
ac3_config.flags |= AC3_MMX_ENABLE;
@@ -342,7 +346,7 @@ if(gCpuCaps.has3DNow){
if(sh_audio->ac3_frame){
ac3_frame_t* fr=(ac3_frame_t*)sh_audio->ac3_frame;
sh_audio->samplerate=fr->sampling_rate;
- sh_audio->channels=2;
+ sh_audio->channels=ac3_config.num_output_ch;
// 1 frame: 6*256 samples 1 sec: sh_audio->samplerate samples
//sh_audio->i_bps=fr->frame_size*fr->sampling_rate/(6*256);
sh_audio->i_bps=fr->bit_rate*(1000/8);