summaryrefslogtreecommitdiff
path: root/libavformat/au.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2013-01-29 10:54:02 +0000
committerPaul B Mahol <onemda@gmail.com>2013-01-30 22:17:52 +0000
commit0dcfccaa691bf533b0f144b6d98b49eb59f1f3ab (patch)
tree02f350932ecde38ad4f1fcfbbc74ebbd35101424 /libavformat/au.c
parent10e4905dd9b741a109c26341e2e5850852518604 (diff)
auenc: strict check for supported codec
Also check number of streams and give error message why muxing failed. This prevents muxing unsupported codec with known and supported tag. Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavformat/au.c')
-rw-r--r--libavformat/au.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libavformat/au.c b/libavformat/au.c
index f887162110..db2ab27558 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -156,8 +156,16 @@ static int au_write_header(AVFormatContext *s)
AVIOContext *pb = s->pb;
AVCodecContext *enc = s->streams[0]->codec;
- if (!enc->codec_tag)
+ if (s->nb_streams != 1) {
+ av_log(s, AV_LOG_ERROR, "only one stream is supported\n");
return AVERROR(EINVAL);
+ }
+
+ enc->codec_tag = ff_codec_get_tag(codec_au_tags, enc->codec_id);
+ if (!enc->codec_tag) {
+ av_log(s, AV_LOG_ERROR, "unsupported codec\n");
+ return AVERROR(EINVAL);
+ }
ffio_wfourcc(pb, ".snd"); /* magic number */
avio_wb32(pb, AU_HEADER_SIZE); /* header size */