[FFmpeg-devel] [PATCH] movenc: Add an option for offsetting the ISM fragment info timestamps

Thomas Volkert silvo at gmx.net
Tue Jun 21 21:04:27 CEST 2016


From: Martin Storsjö <martin at martin.st>

---
 libavformat/movenc.c | 2 ++
 libavformat/movenc.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 837e1e5..589c2ea 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -87,6 +87,7 @@ static const AVOption options[] = {
     { "encryption_scheme",    "Configures the encryption scheme, allowed values are none, cenc-aes-ctr", offsetof(MOVMuxContext, encryption_scheme_str),   AV_OPT_TYPE_STRING, {.str = NULL}, .flags = AV_OPT_FLAG_ENCODING_PARAM },
     { "encryption_key", "The media encryption key (hex)", offsetof(MOVMuxContext, encryption_key), AV_OPT_TYPE_BINARY, .flags = AV_OPT_FLAG_ENCODING_PARAM },
     { "encryption_kid", "The media encryption key identifier (hex)", offsetof(MOVMuxContext, encryption_kid), AV_OPT_TYPE_BINARY, .flags = AV_OPT_FLAG_ENCODING_PARAM },
+    { "ism_offset", "Offset to the ISM fragment start times", offsetof(MOVMuxContext, ism_offset), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
     { NULL },
 };
 
@@ -5342,6 +5343,7 @@ static int mov_write_header(AVFormatContext *s)
         track->start_dts  = AV_NOPTS_VALUE;
         track->start_cts  = AV_NOPTS_VALUE;
         track->end_pts    = AV_NOPTS_VALUE;
+        track->frag_start+= mov->ism_offset;
         if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
             if (track->tag == MKTAG('m','x','3','p') || track->tag == MKTAG('m','x','3','n') ||
                 track->tag == MKTAG('m','x','4','p') || track->tag == MKTAG('m','x','4','n') ||
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index 1090085..1406cb0 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -214,6 +214,7 @@ typedef struct MOVMuxContext {
     uint8_t *encryption_kid;
     int encryption_kid_len;
 
+    int64_t ism_offset;
 } MOVMuxContext;
 
 #define FF_MOV_FLAG_RTP_HINT              (1 <<  0)
-- 
1.9.1



More information about the ffmpeg-devel mailing list