summaryrefslogtreecommitdiff
path: root/libavdevice/alsa-audio-enc.c
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2011-03-10 12:10:34 +0100
committerNicolas George <nicolas.george@normalesup.org>2011-03-26 16:50:09 +0100
commit813dbb44424846274a318bfc6d02a53b4189f884 (patch)
tree6343ebd25d52e3c2ee587287a8a720f3b603c6ea /libavdevice/alsa-audio-enc.c
parent98ac192b4e4df786107d7f6adb3e4e7d1336510e (diff)
ALSA: implement channel layout for playback.
Currently, only S16 quad, 5.1 and 7.1 are implemented. Implementing support for other formats/layouts and capture should be straightforward. 7.1 support by Carl Eugen Hoyos.
Diffstat (limited to 'libavdevice/alsa-audio-enc.c')
-rw-r--r--libavdevice/alsa-audio-enc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libavdevice/alsa-audio-enc.c b/libavdevice/alsa-audio-enc.c
index 83a179ecfe..0bc53b6f54 100644
--- a/libavdevice/alsa-audio-enc.c
+++ b/libavdevice/alsa-audio-enc.c
@@ -76,7 +76,15 @@ static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
int size = pkt->size;
uint8_t *buf = pkt->data;
- while((res = snd_pcm_writei(s->h, buf, size / s->frame_size)) < 0) {
+ size /= s->frame_size;
+ if (s->reorder_func) {
+ if (size > s->reorder_buf_size)
+ if (ff_alsa_extend_reorder_buf(s, size))
+ return AVERROR(ENOMEM);
+ s->reorder_func(buf, s->reorder_buf, size);
+ buf = s->reorder_buf;
+ }
+ while ((res = snd_pcm_writei(s->h, buf, size)) < 0) {
if (res == -EAGAIN) {
return AVERROR(EAGAIN);