[FFmpeg-devel] [PATCH] lavf/flacenc: disallow creation of invalid files with -c copy

Paul B Mahol onemda at gmail.com
Sun Oct 21 00:17:57 CEST 2012


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavformat/flacenc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index 8c270ee..b625278 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -69,6 +69,15 @@ static int flac_write_header(struct AVFormatContext *s)
     int ret;
     AVCodecContext *codec = s->streams[0]->codec;
 
+    if (s->nb_streams > 1) {
+        av_log(s, AV_LOG_ERROR, "only one stream is supported\n");
+        return AVERROR(EINVAL);
+    }
+    if (codec->codec_id != AV_CODEC_ID_FLAC) {
+        av_log(s, AV_LOG_ERROR, "unsupported codec\n");
+        return AVERROR(EINVAL);
+    }
+
     ret = ff_flac_write_header(s->pb, codec, 0);
     if (ret)
         return ret;
-- 
1.7.11.2



More information about the ffmpeg-devel mailing list