[FFmpeg-cvslog] lavf/rawenc: Only accept the appropriate stream type for raw muxers.

Carl Eugen Hoyos git at videolan.org
Sat Sep 7 01:05:36 EEST 2019


ffmpeg | branch: release/4.0 | Carl Eugen Hoyos <ceffmpeg at gmail.com> | Mon Jul  1 00:37:08 2019 +0200| [4a79f30d774dd81bde2da751fbd588e3413da2d7] | committer: James Almer

lavf/rawenc: Only accept the appropriate stream type for raw muxers.

This does not affect the rawvideo muxer.

Fixes ticket #7979.

(cherry picked from commit aef24efb0c1e65097ab77a4bf9264189bdf3ace3)

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

 libavformat/rawenc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index 809ca23b1a..6e5d175483 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -39,6 +39,18 @@ static int force_one_stream(AVFormatContext *s)
                s->oformat->name);
         return AVERROR(EINVAL);
     }
+    if (   s->oformat->audio_codec != AV_CODEC_ID_NONE
+        && s->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) {
+        av_log(s, AV_LOG_ERROR, "%s files have exactly one audio stream\n",
+               s->oformat->name);
+        return AVERROR(EINVAL);
+    }
+    if (   s->oformat->video_codec != AV_CODEC_ID_NONE
+        && s->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) {
+        av_log(s, AV_LOG_ERROR, "%s files have exactly one video stream\n",
+               s->oformat->name);
+        return AVERROR(EINVAL);
+    }
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list