[FFmpeg-cvslog] auenc: strict check for supported codec

Paul B Mahol git at videolan.org
Wed Jan 30 23:20:36 CET 2013


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Jan 29 10:54:02 2013 +0000| [0dcfccaa691bf533b0f144b6d98b49eb59f1f3ab] | committer: Paul B Mahol

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 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0dcfccaa691bf533b0f144b6d98b49eb59f1f3ab
---

 libavformat/au.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavformat/au.c b/libavformat/au.c
index f887162..db2ab27 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 */



More information about the ffmpeg-cvslog mailing list