aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/movenc.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2014-12-18 23:52:42 +0200
committerMartin Storsjö <martin@martin.st>2015-01-03 01:18:28 +0200
commit355d01a1bf55297b1d1f04e4bfbf0ddc93b6247e (patch)
tree0f65ab7c5c0a138947586fdec5ed3661e5cd368e /libavformat/movenc.c
parent8d54bacb789c7d37ca3cf48d9ac13083ad0c1ba7 (diff)
downloadffmpeg-355d01a1bf55297b1d1f04e4bfbf0ddc93b6247e.tar.gz
movenc: Factorize writing ftyp and other identification tags to a separate function
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r--libavformat/movenc.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index a809c36e59..3f5a6aee7e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2988,6 +2988,20 @@ static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s)
avio_wb32(pb, 0x010001); /* ? */
}
+static int mov_write_identification(AVIOContext *pb, AVFormatContext *s)
+{
+ MOVMuxContext *mov = s->priv_data;
+ 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 AVERROR(EINVAL);
+ }
+ mov_write_uuidprof_tag(pb, s);
+ }
+ return 0;
+}
+
static int mov_parse_mpeg2_frame(AVPacket *pkt, uint32_t *flags)
{
uint32_t c = -1;
@@ -3605,7 +3619,7 @@ static int mov_write_header(AVFormatContext *s)
AVIOContext *pb = s->pb;
MOVMuxContext *mov = s->priv_data;
AVDictionaryEntry *t;
- int i, hint_track = 0;
+ int i, ret, hint_track = 0;
mov->fc = s;
@@ -3664,14 +3678,8 @@ static int mov_write_header(AVFormatContext *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 AVERROR(EINVAL);
- }
- mov_write_uuidprof_tag(pb, s);
- }
+ if ((ret = mov_write_identification(pb, s)) < 0)
+ return ret;
mov->nb_streams = s->nb_streams;
if (mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && s->nb_chapters)