diff options
author | Carl Eugen Hoyos <ceffmpeg@gmail.com> | 2019-07-01 00:37:08 +0200 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2019-09-06 18:57:57 -0300 |
commit | 9b236547f480a012cab32f8cad2dfe02774537c1 (patch) | |
tree | 7f1cf83f28c0ee46f040f066bc88509c4d151928 | |
parent | 5fd65ebf28d9e8f2c9aadf8d8ba08d181b8ddfc1 (diff) | |
download | ffmpeg-9b236547f480a012cab32f8cad2dfe02774537c1.tar.gz |
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)
-rw-r--r-- | libavformat/rawenc.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c index 730e99a020..12274ca22b 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; } |