This does not affect the rawvideo muxer. Fixes ticket #7979.
Unified · Split
| @@ -39,6 +39,18 @@ static int force_one_stream(AVFormatContext *s) · 38 unmodified lines | ||
| 39 | 39 | s->oformat->name); |
| 40 | 40 | return AVERROR(EINVAL); |
| 41 | 41 | } |
| 42 | + if ( s->oformat->audio_codec != AV_CODEC_ID_NONE | |
| 43 | + && s->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) { | |
| 44 | + av_log(s, AV_LOG_ERROR, "%s files have exactly one audio stream\n", | |
| 45 | + s->oformat->name); | |
| 46 | + return AVERROR(EINVAL); | |
| 47 | + } | |
| 48 | + if ( s->oformat->video_codec != AV_CODEC_ID_NONE | |
| 49 | + && s->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) { | |
| 50 | + av_log(s, AV_LOG_ERROR, "%s files have exactly one video stream\n", | |
| 51 | + s->oformat->name); | |
| 52 | + return AVERROR(EINVAL); | |
| 53 | + } | |
| 42 | 54 | return 0; |
| 43 | 55 | } |
| 44 | 56 | |