flvenc: do not mux more than one stream per type

FLV does not support multiple audio or video streams.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
Rafaël Carré 2013-04-15 13:14:28 +02:00 committed by Luca Barbato
parent 6add6272da
commit 5b27c307e7

View File

@ -208,6 +208,11 @@ static int flv_write_header(AVFormatContext *s)
} else { } else {
framerate = 1 / av_q2d(s->streams[i]->codec->time_base); framerate = 1 / av_q2d(s->streams[i]->codec->time_base);
} }
if (video_enc) {
av_log(s, AV_LOG_ERROR,
"at most one video stream is supported in flv\n");
return AVERROR(EINVAL);
}
video_enc = enc; video_enc = enc;
if (enc->codec_tag == 0) { if (enc->codec_tag == 0) {
av_log(s, AV_LOG_ERROR, "video codec not compatible with flv\n"); av_log(s, AV_LOG_ERROR, "video codec not compatible with flv\n");
@ -215,6 +220,11 @@ static int flv_write_header(AVFormatContext *s)
} }
break; break;
case AVMEDIA_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
if (audio_enc) {
av_log(s, AV_LOG_ERROR,
"at most one audio stream is supported in flv\n");
return AVERROR(EINVAL);
}
audio_enc = enc; audio_enc = enc;
if (get_audio_flags(s, enc) < 0) if (get_audio_flags(s, enc) < 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;