summaryrefslogtreecommitdiff
path: root/libavformat/rawenc.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <ceffmpeg@gmail.com>2019-07-01 00:37:08 +0200
committerJames Almer <jamrial@gmail.com>2019-09-06 16:22:44 -0300
commitaef24efb0c1e65097ab77a4bf9264189bdf3ace3 (patch)
tree82b269981b690e645436e416e2836cf6d40c99f4 /libavformat/rawenc.c
parent4857688732e27e33fac58e2bd30989f20da2f181 (diff)
downloadffmpeg-aef24efb0c1e65097ab77a4bf9264189bdf3ace3.tar.gz
lavf/rawenc: Only accept the appropriate stream type for raw muxers.
This does not affect the rawvideo muxer. Fixes ticket #7979.
Diffstat (limited to 'libavformat/rawenc.c')
-rw-r--r--libavformat/rawenc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index 993d232b70..32704f9bfd 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;
}