diff options
author | Martin Storsjö <martin@martin.st> | 2013-09-22 01:29:33 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-09-22 16:10:21 +0300 |
commit | 187023f6b2b43966acb2449a379b4ededdc4b22e (patch) | |
tree | 735e3daaf42e7f9c42ec3ece1bc7d45261b63870 /libavformat | |
parent | 5055035670bd1a1eaca64bd3bc71fb07de9df2c3 (diff) | |
download | ffmpeg-187023f6b2b43966acb2449a379b4ededdc4b22e.tar.gz |
movenc: Set mov->mode earlier in mov_write_header
This allows simplifying some early checks that depend on the
muxer mode.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/movenc.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index dbff36906b..dd0a31f17d 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -3139,10 +3139,22 @@ static int mov_write_header(AVFormatContext *s) AVDictionaryEntry *t; int i, hint_track = 0; + /* Default mode == MP4 */ + mov->mode = MODE_MP4; + + if (s->oformat != NULL) { + if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP; + else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3GP|MODE_3G2; + else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV; + else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP; + else if (!strcmp("ipod",s->oformat->name)) mov->mode = MODE_IPOD; + else if (!strcmp("ismv",s->oformat->name)) mov->mode = MODE_ISM; + } + /* Set the FRAGMENT flag if any of the fragmentation methods are * enabled. */ if (mov->max_fragment_duration || mov->max_fragment_size || - (s->oformat && !strcmp(s->oformat->name, "ismv")) || + mov->mode == MODE_ISM || mov->flags & (FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_FRAG_KEYFRAME | FF_MOV_FLAG_FRAG_CUSTOM)) @@ -3166,25 +3178,14 @@ static int mov_write_header(AVFormatContext *s) return -1; } - /* Default mode == MP4 */ - mov->mode = MODE_MP4; - - if (s->oformat != NULL) { - if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP; - else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3GP|MODE_3G2; - else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV; - else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP; - else if (!strcmp("ipod",s->oformat->name)) mov->mode = MODE_IPOD; - else if (!strcmp("ismv",s->oformat->name)) mov->mode = MODE_ISM; - mov_write_ftyp_tag(pb,s); - if (mov->mode == MODE_PSP) { - if (s->nb_streams != 2) { - av_log(s, AV_LOG_ERROR, "PSP mode need one video and one audio stream\n"); - return -1; - } - mov_write_uuidprof_tag(pb, s); + mov_write_ftyp_tag(pb,s); + if (mov->mode == MODE_PSP) { + if (s->nb_streams != 2) { + av_log(s, AV_LOG_ERROR, "PSP mode need one video and one audio stream\n"); + return -1; } + mov_write_uuidprof_tag(pb, s); } mov->nb_streams = s->nb_streams; |