[FFmpeg-devel] [PATCH] lavd/oss: support for more than 2 channels
Paul B Mahol
onemda at gmail.com
Fri Jul 20 04:26:05 CEST 2012
Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
libavdevice/oss_audio.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
index 53acba3..feb3bb2 100644
--- a/libavdevice/oss_audio.c
+++ b/libavdevice/oss_audio.c
@@ -119,11 +119,20 @@ static int audio_open(AVFormatContext *s1, int is_output, const char *audio_devi
goto fail;
}
- tmp = (s->channels == 2);
- err = ioctl(audio_fd, SNDCTL_DSP_STEREO, &tmp);
- if (err < 0) {
- av_log(s1, AV_LOG_ERROR, "SNDCTL_DSP_STEREO: %s\n", strerror(errno));
- goto fail;
+ if (s->channels > 2) {
+ tmp = s->channels;
+ err = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &tmp);
+ if (err < 0) {
+ av_log(s1, AV_LOG_ERROR, "SNDCTL_DSP_CHANNELS: %s\n", strerror(errno));
+ goto fail;
+ }
+ } else {
+ tmp = (s->channels == 2);
+ err = ioctl(audio_fd, SNDCTL_DSP_STEREO, &tmp);
+ if (err < 0) {
+ av_log(s1, AV_LOG_ERROR, "SNDCTL_DSP_STEREO: %s\n", strerror(errno));
+ goto fail;
+ }
}
tmp = s->sample_rate;
--
1.7.7
More information about the ffmpeg-devel
mailing list