summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-08-18 08:50:22 +0200
committerHendrik Leppkes <h.leppkes@gmail.com>2015-08-18 08:50:22 +0200
commit1907e19d0ce2ad752912d73b798ebf4494aa1b1c (patch)
tree7ce15d4eb18d5d382a065f3bd815d04f06897018
parent737aa902f069ed218fd2d13c59015391facf73c8 (diff)
parent26ac22e5e7394346e9d59f800e7d4e91f4518d33 (diff)
downloadffmpeg-streaming-1907e19d0ce2ad752912d73b798ebf4494aa1b1c.zip
ffmpeg-streaming-1907e19d0ce2ad752912d73b798ebf4494aa1b1c.tar.gz
Merge commit '26ac22e5e7394346e9d59f800e7d4e91f4518d33'
* commit '26ac22e5e7394346e9d59f800e7d4e91f4518d33': movenc: Add a new flag for writing global sidx indexes for dash Conflicts: libavformat/movenc.c libavformat/movenc.h Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
-rw-r--r--libavformat/movenc.c15
-rw-r--r--libavformat/movenc.h5
2 files changed, 11 insertions, 9 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 41a4759..08d0c2a 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -66,6 +66,7 @@ static const AVOption options[] = {
{ "dash", "Write DASH compatible fragmented MP4", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_DASH}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
{ "frag_discont", "Signal that the next fragment is discontinuous from earlier ones", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_FRAG_DISCONT}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
{ "delay_moov", "Delay writing the initial moov until the first fragment is cut, or until the first fragment flush", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_DELAY_MOOV}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
+ { "global_sidx", "Write a global sidx index at the start of the file", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_GLOBAL_SIDX}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
{ "write_colr", "Write colr atom (Experimental, may be renamed or changed, do not use from scripts)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_WRITE_COLR}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
{ "write_gama", "Write deprecated gama atom", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_WRITE_GAMA}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags),
@@ -3765,7 +3766,7 @@ static int mov_write_moof_tag(AVIOContext *pb, MOVMuxContext *mov, int tracks,
mov_write_moof_tag_internal(avio_buf, mov, tracks, 0);
moof_size = ffio_close_null_buf(avio_buf);
- if (mov->flags & FF_MOV_FLAG_DASH && !(mov->flags & FF_MOV_FLAG_FASTSTART))
+ if (mov->flags & FF_MOV_FLAG_DASH && !(mov->flags & FF_MOV_FLAG_GLOBAL_SIDX))
mov_write_sidx_tags(pb, mov, tracks, moof_size + 8 + mdat_size);
if ((ret = mov_add_tfra_entries(pb, mov, tracks, moof_size + 8 + mdat_size)) < 0)
@@ -3905,7 +3906,7 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
else if (mov->mode == MODE_MP4)
ffio_wfourcc(pb, "mp41");
- if (mov->flags & FF_MOV_FLAG_DASH && mov->flags & FF_MOV_FLAG_FASTSTART)
+ if (mov->flags & FF_MOV_FLAG_DASH && mov->flags & FF_MOV_FLAG_GLOBAL_SIDX)
ffio_wfourcc(pb, "dash");
return update_size(pb, pos);
@@ -4167,7 +4168,7 @@ static int mov_flush_fragment(AVFormatContext *s)
return ret;
if (mov->flags & FF_MOV_FLAG_DELAY_MOOV) {
- if (mov->flags & FF_MOV_FLAG_FASTSTART)
+ if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX)
mov->reserved_header_pos = avio_tell(s->pb);
avio_flush(s->pb);
mov->moov_written = 1;
@@ -4181,7 +4182,7 @@ static int mov_flush_fragment(AVFormatContext *s)
avio_write(s->pb, buf, buf_size);
av_free(buf);
- if (mov->flags & FF_MOV_FLAG_FASTSTART)
+ if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX)
mov->reserved_header_pos = avio_tell(s->pb);
mov->moov_written = 1;
@@ -4460,7 +4461,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
* in sidx/tfrf/tfxd tags; make sure the sidx pts and duration match up with
* the next fragment. This means the cts of the first sample must
* be the same in all fragments. */
- if ((mov->flags & FF_MOV_FLAG_DASH && !(mov->flags & FF_MOV_FLAG_FASTSTART)) ||
+ if ((mov->flags & FF_MOV_FLAG_DASH && !(mov->flags & FF_MOV_FLAG_GLOBAL_SIDX)) ||
mov->mode == MODE_ISM)
pkt->pts = pkt->dts + trk->end_pts - trk->cluster[trk->entry].dts;
} else {
@@ -5304,7 +5305,7 @@ static int mov_write_header(AVFormatContext *s)
if ((ret = mov_write_moov_tag(pb, mov, s)) < 0)
return ret;
mov->moov_written = 1;
- if (mov->flags & FF_MOV_FLAG_FASTSTART)
+ if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX)
mov->reserved_header_pos = avio_tell(pb);
}
@@ -5532,7 +5533,7 @@ static int mov_write_trailer(AVFormatContext *s)
mov_auto_flush_fragment(s);
for (i = 0; i < mov->nb_streams; i++)
mov->tracks[i].data_offset = 0;
- if (mov->flags & FF_MOV_FLAG_FASTSTART) {
+ if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX) {
av_log(s, AV_LOG_INFO, "Starting second pass: inserting sidx atoms\n");
res = shift_data(s);
if (res == 0) {
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index 72862f1..06adf2b 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -209,8 +209,9 @@ typedef struct MOVMuxContext {
#define FF_MOV_FLAG_DASH (1 << 11)
#define FF_MOV_FLAG_FRAG_DISCONT (1 << 12)
#define FF_MOV_FLAG_DELAY_MOOV (1 << 13)
-#define FF_MOV_FLAG_WRITE_COLR (1 << 14)
-#define FF_MOV_FLAG_WRITE_GAMA (1 << 15)
+#define FF_MOV_FLAG_GLOBAL_SIDX (1 << 14)
+#define FF_MOV_FLAG_WRITE_COLR (1 << 15)
+#define FF_MOV_FLAG_WRITE_GAMA (1 << 16)
int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt);
OpenPOWER on IntegriCloud