diff options
author | Johns <johns98@gmx.net> | 2012-04-21 16:45:56 +0200 |
---|---|---|
committer | Johns <johns98@gmx.net> | 2012-04-21 16:45:56 +0200 |
commit | ebe0beb40048c90a8128cf81678bd2c250973a1e (patch) | |
tree | b1c8df2ee08422f3794f2ec677c747b1297bbd2e /audio.c | |
parent | 93ddd26a4a8983859a4f6f29979f0c5b1cce12ed (diff) | |
download | vdr-plugin-softhddevice-ebe0beb40048c90a8128cf81678bd2c250973a1e.tar.gz vdr-plugin-softhddevice-ebe0beb40048c90a8128cf81678bd2c250973a1e.tar.bz2 |
Add upmix from 5 to 6 channels.
Diffstat (limited to 'audio.c')
-rw-r--r-- | audio.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -536,6 +536,30 @@ static void AudioSurround2Stereo(const int16_t * in, int in_chan, int frames, } /** +** Upmix @a in_chan channels to @a out_chan. +** +** @param in input sample buffer +** @param in_chan nr. of input channels +** @param frames number of frames in sample buffer +** @param out output sample buffer +** @param out_chan nr. of output channels +*/ +static void AudioUpmix(const int16_t * in, int in_chan, int frames, + int16_t * out, int out_chan) +{ + while (frames--) { + int i; + + for (i = 0; i < in_chan; ++i) { // copy existing channels + *out++ = *in++; + } + for (; i < out_chan; ++i) { // silents missing channels + *out++ = 0; + } + } +} + +/** ** Resample ffmpeg sample format to hardware format. ** ** @param in input sample buffer @@ -572,6 +596,9 @@ static void AudioResample(const int16_t * in, int in_chan, int frames, case 8 * 8 + 2: AudioSurround2Stereo(in, in_chan, frames, out); break; + case 5 * 8 + 6: + AudioUpmix(in, in_chan, frames, out, out_chan); + break; default: Error("audio: unsupported %d -> %d channels resample\n", in_chan, |