Browse Source

movenc: Rename reserved_moov_pos to reserved_header_pos

The same field is also used for writing the sidx index header,
for fragmented files, when the faststart flag is used.

Signed-off-by: Martin Storsjö <martin@martin.st>
tags/n2.8
Martin Storsjö 10 years ago
parent
commit
83f254e65f
2 changed files with 8 additions and 8 deletions
  1. +7
    -7
      libavformat/movenc.c
  2. +1
    -1
      libavformat/movenc.h

+ 7
- 7
libavformat/movenc.c View File

@@ -3229,7 +3229,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;
@@ -4011,7 +4011,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);
} }


@@ -4046,7 +4046,7 @@ static int mov_write_header(AVFormatContext *s)
mov_write_moov_tag(pb, mov, s); mov_write_moov_tag(pb, mov, s);
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;
@@ -4162,10 +4162,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 { \
@@ -4232,7 +4232,7 @@ static int mov_write_trailer(AVFormatContext *s)
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);
mov_write_moov_tag(pb, mov, s); mov_write_moov_tag(pb, mov, s);
} }
} else { } else {
@@ -4247,7 +4247,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);


+ 1
- 1
libavformat/movenc.h View File

@@ -166,7 +166,7 @@ typedef struct MOVMuxContext {
AVIOContext *mdat_buf; AVIOContext *mdat_buf;
int first_trun; int first_trun;


int64_t reserved_moov_pos;
int64_t reserved_header_pos;


char *major_brand; char *major_brand;




Loading…
Cancel
Save