diff options
author | Matthieu Bouron <matthieu.bouron@gmail.com> | 2013-07-28 16:46:05 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-07-28 17:05:05 +0200 |
commit | 8a09195545029672470e44a0f5c6bc6c86fb2ed5 (patch) | |
tree | e29216032d342f48f7a222f6572d1229b2391311 /libavformat | |
parent | ee4ef139e36193a6aa48e0d251f71dfb95e5c2cd (diff) | |
download | ffmpeg-8a09195545029672470e44a0f5c6bc6c86fb2ed5.tar.gz |
lavf/movenc: improve psp check
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/movenc.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index e8e1a98dae..42ec3f23e7 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -3557,7 +3557,18 @@ static int mov_write_header(AVFormatContext *s) mov_write_ftyp_tag(pb,s); if (mov->mode == MODE_PSP) { - if (s->nb_streams != 2) { + int video_streams_nb = 0, audio_streams_nb = 0, other_streams_nb = 0; + for (i = 0; i < s->nb_streams; i++) { + AVStream *st = s->streams[i]; + if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) + video_streams_nb++; + else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) + audio_streams_nb++; + else + other_streams_nb++; + } + + if (video_streams_nb != 1 || audio_streams_nb != 1 || other_streams_nb) { av_log(s, AV_LOG_ERROR, "PSP mode need one video and one audio stream\n"); return -1; } |