diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2011-03-10 12:10:34 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-06-23 08:49:48 +0200 |
commit | 147bcf27c4f8b22a386ea626f9455cf3f7cf0410 (patch) | |
tree | d471dd55b35516d8153ceee5fe82880c93415448 /libavdevice/alsa-audio-enc.c | |
parent | 2359aeb52d2325ed6c28d4f7579e0999963bcec1 (diff) | |
download | ffmpeg-147bcf27c4f8b22a386ea626f9455cf3f7cf0410.tar.gz |
ALSA: implement channel layout for playback.
Currently quad, 5.0, 5.1 and 7.1 are implemented.
Implementing support for other formats/layouts and capture should be
straightforward.
5.0 and 7.1 support by Carl Eugen Hoyos.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavdevice/alsa-audio-enc.c')
-rw-r--r-- | libavdevice/alsa-audio-enc.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libavdevice/alsa-audio-enc.c b/libavdevice/alsa-audio-enc.c index ebe598c86f..f3782c5ab6 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); |