]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit '4f7723cb3b913c577842a5bb088c804ddacac8df'
authorHendrik Leppkes <h.leppkes@gmail.com>
Thu, 17 Nov 2016 13:54:51 +0000 (14:54 +0100)
committerHendrik Leppkes <h.leppkes@gmail.com>
Thu, 17 Nov 2016 13:54:51 +0000 (14:54 +0100)
* commit '4f7723cb3b913c577842a5bb088c804ddacac8df':
  movenc: Add an option for skipping writing the mfra/tfra/mfro trailer

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
1  2 
libavformat/movenc.c
libavformat/movenc.h

index 7a726c6bfd1e1f8cc226789e0d420e23ec4ddda2,31b940a4b2db0e8e3a7c533a70a0ebb4bca4e178..473aac0065ba84960ec6fee09df5042b1faa05dd
@@@ -69,11 -60,9 +69,12 @@@ static const AVOption options[] = 
      { "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" },
 +    { "use_metadata_tags", "Use mdta atom for metadata.", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_USE_MDTA}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
+     { "skip_trailer", "Skip writing the mfra/tfra/mfro trailer for fragmented files", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_SKIP_TRAILER}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
      FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags),
 -    { "skip_iods", "Skip writing iods atom.", offsetof(MOVMuxContext, iods_skip), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
 +    { "skip_iods", "Skip writing iods atom.", offsetof(MOVMuxContext, iods_skip), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
      { "iods_audio_profile", "iods audio profile atom.", offsetof(MOVMuxContext, iods_audio_profile), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM},
      { "iods_video_profile", "iods video profile atom.", offsetof(MOVMuxContext, iods_video_profile), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM},
      { "frag_duration", "Maximum fragment duration", offsetof(MOVMuxContext, max_fragment_duration), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
@@@ -6139,18 -4402,17 +6162,18 @@@ static int mov_write_trailer(AVFormatCo
          for (i = 0; i < mov->nb_streams; i++)
             mov->tracks[i].data_offset = 0;
          if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX) {
 +            int64_t end;
              av_log(s, AV_LOG_INFO, "Starting second pass: inserting sidx atoms\n");
              res = shift_data(s);
 -            if (res == 0) {
 -                int64_t end = avio_tell(pb);
 -                avio_seek(pb, mov->reserved_header_pos, SEEK_SET);
 -                mov_write_sidx_tags(pb, mov, -1, 0);
 -                avio_seek(pb, end, SEEK_SET);
 -                avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_TRAILER);
 -                mov_write_mfra_tag(pb, mov);
 -            }
 +            if (res < 0)
 +                return res;
 +            end = avio_tell(pb);
 +            avio_seek(pb, mov->reserved_header_pos, SEEK_SET);
 +            mov_write_sidx_tags(pb, mov, -1, 0);
 +            avio_seek(pb, end, SEEK_SET);
 +            avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_TRAILER);
 +            mov_write_mfra_tag(pb, mov);
-         } else {
+         } else if (!(mov->flags & FF_MOV_FLAG_SKIP_TRAILER)) {
              avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_TRAILER);
              mov_write_mfra_tag(pb, mov);
          }
index 1f7a9d7abda8e00208214ad4d9045c91c70b0666,f4ed188c385ee05036a420709ab5c028192967df..4c4f3cdfc3f8514cebeb2e79946406f56dca24f1
@@@ -237,9 -194,7 +237,10 @@@ typedef struct MOVMuxContext 
  #define FF_MOV_FLAG_FRAG_DISCONT          (1 << 12)
  #define FF_MOV_FLAG_DELAY_MOOV            (1 << 13)
  #define FF_MOV_FLAG_GLOBAL_SIDX           (1 << 14)
 -#define FF_MOV_FLAG_SKIP_TRAILER          (1 << 15)
 +#define FF_MOV_FLAG_WRITE_COLR            (1 << 15)
 +#define FF_MOV_FLAG_WRITE_GAMA            (1 << 16)
 +#define FF_MOV_FLAG_USE_MDTA              (1 << 17)
++#define FF_MOV_FLAG_SKIP_TRAILER          (1 << 18)
  
  int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt);