Commit 7653ebff authored by Hendrik Leppkes's avatar Hendrik Leppkes

Merge commit '83f254e6'

* commit '83f254e6':
  movenc: Rename reserved_moov_pos to reserved_header_pos

Conflicts:
	libavformat/movenc.c
	libavformat/movenc.h
Merged-by: 's avatarHendrik Leppkes <h.leppkes@gmail.com>
parents 6c52432b 83f254e6
...@@ -4168,7 +4168,7 @@ static int mov_flush_fragment(AVFormatContext *s) ...@@ -4168,7 +4168,7 @@ static int mov_flush_fragment(AVFormatContext *s)
if (mov->flags & FF_MOV_FLAG_DELAY_MOOV) { if (mov->flags & FF_MOV_FLAG_DELAY_MOOV) {
if (mov->flags & FF_MOV_FLAG_FASTSTART) if (mov->flags & FF_MOV_FLAG_FASTSTART)
mov->reserved_moov_pos = avio_tell(s->pb); mov->reserved_header_pos = avio_tell(s->pb);
avio_flush(s->pb); avio_flush(s->pb);
mov->moov_written = 1; mov->moov_written = 1;
return 0; return 0;
...@@ -5229,7 +5229,7 @@ static int mov_write_header(AVFormatContext *s) ...@@ -5229,7 +5229,7 @@ static int mov_write_header(AVFormatContext *s)
if (mov->reserved_moov_size){ if (mov->reserved_moov_size){
mov->reserved_moov_pos= avio_tell(pb); mov->reserved_header_pos = avio_tell(pb);
if (mov->reserved_moov_size > 0) if (mov->reserved_moov_size > 0)
avio_skip(pb, mov->reserved_moov_size); avio_skip(pb, mov->reserved_moov_size);
} }
...@@ -5242,7 +5242,7 @@ static int mov_write_header(AVFormatContext *s) ...@@ -5242,7 +5242,7 @@ static int mov_write_header(AVFormatContext *s)
mov->flags |= FF_MOV_FLAG_FRAG_KEYFRAME; mov->flags |= FF_MOV_FLAG_FRAG_KEYFRAME;
} else { } else {
if (mov->flags & FF_MOV_FLAG_FASTSTART) if (mov->flags & FF_MOV_FLAG_FASTSTART)
mov->reserved_moov_pos = avio_tell(pb); mov->reserved_header_pos = avio_tell(pb);
mov_write_mdat_tag(pb, mov); mov_write_mdat_tag(pb, mov);
} }
...@@ -5302,7 +5302,7 @@ static int mov_write_header(AVFormatContext *s) ...@@ -5302,7 +5302,7 @@ static int mov_write_header(AVFormatContext *s)
return ret; return ret;
mov->moov_written = 1; mov->moov_written = 1;
if (mov->flags & FF_MOV_FLAG_FASTSTART) if (mov->flags & FF_MOV_FLAG_FASTSTART)
mov->reserved_moov_pos = avio_tell(pb); mov->reserved_header_pos = avio_tell(pb);
} }
return 0; return 0;
...@@ -5419,10 +5419,10 @@ static int shift_data(AVFormatContext *s) ...@@ -5419,10 +5419,10 @@ static int shift_data(AVFormatContext *s)
/* mark the end of the shift to up to the last data we wrote, and get ready /* mark the end of the shift to up to the last data we wrote, and get ready
* for writing */ * for writing */
pos_end = avio_tell(s->pb); pos_end = avio_tell(s->pb);
avio_seek(s->pb, mov->reserved_moov_pos + moov_size, SEEK_SET); avio_seek(s->pb, mov->reserved_header_pos + moov_size, SEEK_SET);
/* start reading at where the new moov will be placed */ /* start reading at where the new moov will be placed */
avio_seek(read_pb, mov->reserved_moov_pos, SEEK_SET); avio_seek(read_pb, mov->reserved_header_pos, SEEK_SET);
pos = avio_tell(read_pb); pos = avio_tell(read_pb);
#define READ_BLOCK do { \ #define READ_BLOCK do { \
...@@ -5496,13 +5496,13 @@ static int mov_write_trailer(AVFormatContext *s) ...@@ -5496,13 +5496,13 @@ static int mov_write_trailer(AVFormatContext *s)
ffio_wfourcc(pb, "mdat"); ffio_wfourcc(pb, "mdat");
avio_wb64(pb, mov->mdat_size + 16); avio_wb64(pb, mov->mdat_size + 16);
} }
avio_seek(pb, mov->reserved_moov_size > 0 ? mov->reserved_moov_pos : moov_pos, SEEK_SET); avio_seek(pb, mov->reserved_moov_size > 0 ? mov->reserved_header_pos : moov_pos, SEEK_SET);
if (mov->flags & FF_MOV_FLAG_FASTSTART) { if (mov->flags & FF_MOV_FLAG_FASTSTART) {
av_log(s, AV_LOG_INFO, "Starting second pass: moving the moov atom to the beginning of the file\n"); av_log(s, AV_LOG_INFO, "Starting second pass: moving the moov atom to the beginning of the file\n");
res = shift_data(s); res = shift_data(s);
if (res == 0) { if (res == 0) {
avio_seek(pb, mov->reserved_moov_pos, SEEK_SET); avio_seek(pb, mov->reserved_header_pos, SEEK_SET);
if ((res = mov_write_moov_tag(pb, mov, s)) < 0) if ((res = mov_write_moov_tag(pb, mov, s)) < 0)
goto error; goto error;
} }
...@@ -5510,7 +5510,7 @@ static int mov_write_trailer(AVFormatContext *s) ...@@ -5510,7 +5510,7 @@ static int mov_write_trailer(AVFormatContext *s)
int64_t size; int64_t size;
if ((res = mov_write_moov_tag(pb, mov, s)) < 0) if ((res = mov_write_moov_tag(pb, mov, s)) < 0)
goto error; goto error;
size = mov->reserved_moov_size - (avio_tell(pb) - mov->reserved_moov_pos); size = mov->reserved_moov_size - (avio_tell(pb) - mov->reserved_header_pos);
if (size < 8){ if (size < 8){
av_log(s, AV_LOG_ERROR, "reserved_moov_size is too small, needed %"PRId64" additional\n", 8-size); av_log(s, AV_LOG_ERROR, "reserved_moov_size is too small, needed %"PRId64" additional\n", 8-size);
res = AVERROR(EINVAL); res = AVERROR(EINVAL);
...@@ -5534,7 +5534,7 @@ static int mov_write_trailer(AVFormatContext *s) ...@@ -5534,7 +5534,7 @@ static int mov_write_trailer(AVFormatContext *s)
res = shift_data(s); res = shift_data(s);
if (res == 0) { if (res == 0) {
int64_t end = avio_tell(pb); int64_t end = avio_tell(pb);
avio_seek(pb, mov->reserved_moov_pos, SEEK_SET); avio_seek(pb, mov->reserved_header_pos, SEEK_SET);
mov_write_sidx_tags(pb, mov, -1, 0); mov_write_sidx_tags(pb, mov, -1, 0);
avio_seek(pb, end, SEEK_SET); avio_seek(pb, end, SEEK_SET);
mov_write_mfra_tag(pb, mov); mov_write_mfra_tag(pb, mov);
......
...@@ -181,7 +181,7 @@ typedef struct MOVMuxContext { ...@@ -181,7 +181,7 @@ typedef struct MOVMuxContext {
int video_track_timescale; int video_track_timescale;
int reserved_moov_size; ///< 0 for disabled, -1 for automatic, size otherwise int reserved_moov_size; ///< 0 for disabled, -1 for automatic, size otherwise
int64_t reserved_moov_pos; int64_t reserved_header_pos;
char *major_brand; char *major_brand;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment