[vlc-commits] amem: add channel mapping
Sébastien Toque
git at videolan.org
Sun Oct 2 21:57:06 CEST 2011
vlc | branch: master | Sébastien Toque <xilasz at gmail.com> | Sun Oct 2 21:15:47 2011 +0200| [815fd326665beb2f4d868fc32903162630d47df9] | committer: Rémi Denis-Courmont
amem: add channel mapping
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=815fd326665beb2f4d868fc32903162630d47df9
---
modules/audio_output/amem.c | 51 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 49 insertions(+), 2 deletions(-)
diff --git a/modules/audio_output/amem.c b/modules/audio_output/amem.c
index ac9d9fa..599c6b4 100644
--- a/modules/audio_output/amem.c
+++ b/modules/audio_output/amem.c
@@ -25,6 +25,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
+#include <assert.h>
static int Open (vlc_object_t *);
static void Close (vlc_object_t *);
@@ -143,14 +144,60 @@ static int Open (vlc_object_t *obj)
goto error;
/* TODO: amem-format */
- /* FIXME/TODO channel mapping */
- if (strcmp(format, "S16N") || aout->format.i_channels != channels)
+ if (strcmp(format, "S16N"))
{
msg_Err (aout, "format not supported");
goto error;
}
+
+ /* channel mapping */
+ switch (channels)
+ {
+ case 1:
+ aout->format.i_physical_channels = AOUT_CHAN_CENTER;
+ break;
+ case 2:
+ aout->format.i_physical_channels =
+ AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
+ break;
+ case 3:
+ aout->format.i_physical_channels =
+ AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_LFE;
+ break;
+ case 4:
+ aout->format.i_physical_channels =
+ AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
+ AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
+ break;
+ case 5:
+ aout->format.i_physical_channels =
+ AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER |
+ AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
+ break;
+ case 6:
+ aout->format.i_physical_channels =
+ AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER |
+ AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT | AOUT_CHAN_LFE;
+ break;
+ case 7:
+ aout->format.i_physical_channels =
+ AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER |
+ AOUT_CHAN_REARCENTER | AOUT_CHAN_MIDDLELEFT |
+ AOUT_CHAN_MIDDLERIGHT | AOUT_CHAN_LFE;
+ break;
+ case 8:
+ aout->format.i_physical_channels =
+ AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER |
+ AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT |
+ AOUT_CHAN_MIDDLELEFT | AOUT_CHAN_MIDDLERIGHT | AOUT_CHAN_LFE;
+ break;
+ default:
+ assert(0);
+ }
+
aout->format.i_format = VLC_CODEC_S16N;
aout->format.i_rate = rate;
+ aout->format.i_original_channels = aout->format.i_physical_channels;
aout->pf_play = Play;
aout->pf_pause = Pause;
More information about the vlc-commits
mailing list