Merge commit 'b886f5c2f1e71b3e60e4265c500158d392b4b9a4'
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 20 Aug 2013 09:44:25 +0000 (11:44 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 20 Aug 2013 09:44:25 +0000 (11:44 +0200)
* commit 'b886f5c2f1e71b3e60e4265c500158d392b4b9a4':
  mkv: Allow flushing the current cluster in progress

Conflicts:
libavformat/matroskaenc.c
libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/matroskaenc.c
libavformat/version.h

@@@ -1561,6 -1342,29 +1561,29 @@@ static int mkv_write_packet(AVFormatCon
      return ret;
  }
  
 -        if (mkv->cluster_pos) {
+ static int mkv_write_flush_packet(AVFormatContext *s, AVPacket *pkt)
+ {
+     MatroskaMuxContext *mkv = s->priv_data;
+     AVIOContext *pb;
+     if (s->pb->seekable)
+         pb = s->pb;
+     else
+         pb = mkv->dyn_bc;
+     if (!pkt) {
 -            mkv->cluster_pos = 0;
++        if (mkv->cluster_pos != -1) {
+             av_log(s, AV_LOG_DEBUG, "Flushing cluster at offset %" PRIu64
+                    " bytes\n", avio_tell(pb));
+             end_ebml_master(pb, mkv->cluster);
++            mkv->cluster_pos = -1;
+             if (mkv->dyn_bc)
+                 mkv_flush_dynbuf(s);
+             avio_flush(s->pb);
+         }
+         return 0;
+     }
+     return mkv_write_packet(s, pkt);
+ }
  static int mkv_write_trailer(AVFormatContext *s)
  {
      MatroskaMuxContext *mkv = s->priv_data;
@@@ -1703,19 -1481,14 +1726,19 @@@ AVOutputFormat ff_matroska_muxer = 
      .video_codec       = CONFIG_LIBX264_ENCODER ?
                           AV_CODEC_ID_H264 : AV_CODEC_ID_MPEG4,
      .write_header      = mkv_write_header,
-     .write_packet      = mkv_write_packet,
+     .write_packet      = mkv_write_flush_packet,
      .write_trailer     = mkv_write_trailer,
      .flags             = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |
-                          AVFMT_TS_NONSTRICT,
+                          AVFMT_TS_NONSTRICT | AVFMT_ALLOW_FLUSH,
      .codec_tag         = (const AVCodecTag* const []){
 -         ff_codec_bmp_tags, ff_codec_wav_tags, 0
 +         ff_codec_bmp_tags, ff_codec_wav_tags,
 +         additional_audio_tags, additional_video_tags, 0
      },
 +#if FF_API_ASS_SSA
      .subtitle_codec    = AV_CODEC_ID_SSA,
 +#else
 +    .subtitle_codec    = AV_CODEC_ID_ASS,
 +#endif
      .query_codec       = mkv_query_codec,
      .priv_class        = &matroska_class,
  };
@@@ -1737,12 -1510,11 +1760,12 @@@ AVOutputFormat ff_webm_muxer = 
      .priv_data_size    = sizeof(MatroskaMuxContext),
      .audio_codec       = AV_CODEC_ID_VORBIS,
      .video_codec       = AV_CODEC_ID_VP8,
 +    .subtitle_codec    = AV_CODEC_ID_WEBVTT,
      .write_header      = mkv_write_header,
-     .write_packet      = mkv_write_packet,
+     .write_packet      = mkv_write_flush_packet,
      .write_trailer     = mkv_write_trailer,
      .flags             = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |
-                          AVFMT_TS_NONSTRICT,
+                          AVFMT_TS_NONSTRICT | AVFMT_ALLOW_FLUSH,
      .priv_class        = &webm_class,
  };
  #endif
@@@ -1764,12 -1536,11 +1787,13 @@@ AVOutputFormat ff_matroska_audio_muxer 
                           AV_CODEC_ID_VORBIS : AV_CODEC_ID_AC3,
      .video_codec       = AV_CODEC_ID_NONE,
      .write_header      = mkv_write_header,
-     .write_packet      = mkv_write_packet,
+     .write_packet      = mkv_write_flush_packet,
      .write_trailer     = mkv_write_trailer,
-     .flags             = AVFMT_GLOBALHEADER | AVFMT_TS_NONSTRICT,
+     .flags             = AVFMT_GLOBALHEADER | AVFMT_TS_NONSTRICT |
+                          AVFMT_ALLOW_FLUSH,
 -    .codec_tag         = (const AVCodecTag* const []){ ff_codec_wav_tags, 0 },
 +    .codec_tag         = (const AVCodecTag* const []){
 +        ff_codec_wav_tags, additional_audio_tags, 0
 +    },
      .priv_class        = &mka_class,
  };
  #endif
@@@ -30,8 -30,8 +30,8 @@@
  #include "libavutil/avutil.h"
  
  #define LIBAVFORMAT_VERSION_MAJOR 55
- #define LIBAVFORMAT_VERSION_MINOR 13
- #define LIBAVFORMAT_VERSION_MICRO 103
 -#define LIBAVFORMAT_VERSION_MINOR  3
 -#define LIBAVFORMAT_VERSION_MICRO  0
++#define LIBAVFORMAT_VERSION_MINOR 14
++#define LIBAVFORMAT_VERSION_MICRO 100
  
  #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                 LIBAVFORMAT_VERSION_MINOR, \