]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit 'e3b225a4fe0ff1e64a220b757c6f0a5cf9258521'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 3 May 2013 11:16:34 +0000 (13:16 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 3 May 2013 11:16:34 +0000 (13:16 +0200)
* commit 'e3b225a4fe0ff1e64a220b757c6f0a5cf9258521':
  matroskaenc: add an option to put the index at the start of the file

Conflicts:
doc/muxers.texi
libavformat/matroskaenc.c
libavformat/version.h

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

diff --cc Changelog
index c3d84b3b5fcc2b85803b4922e66beda43f920b4c,e605345e2132963d4a3e9595e0bebfc37b89fb3a..ab17dc62f611a733510296630e857451926f6483
+++ b/Changelog
  Entries are sorted chronologically from oldest to youngest within each release,
  releases are sorted from youngest to oldest.
  
 -version 10:
 -- av_strnstr
 -- support ID3v2 tags in ASF files
 +version <next>:
 +- curves filter
  - reference-counting for AVFrame and AVPacket data
 -- avconv now fails when input options are used for output file
 +- ffmpeg now fails when input options are used for output file
    or vice versa
 -- new avconv options -filter_script and -filter_complex_script, which allow a
 +- support for Monkey's Audio versions from 3.93
 +- perms and aperms filters
 +- audio filtering support in ffplay
 +- 10% faster aac encoding on x86 and MIPS
 +- sine audio filter source
 +- WebP demuxing and decoding support
 +- new ffmpeg options -filter_script and -filter_complex_script, which allow a
    filtergraph description to be read from a file
 +- OpenCL support
 +- audio phaser filter
 +- separatefields filter
 +- libquvi demuxer
  - uniform options syntax across all filters
 +- telecine filter
  - new interlace filter
 -- JPEG 2000 decoder
 -- new asetpts filter (same as setpts, but for audio)
 -- new trim and atrim filters
 -- avconv -t and -ss (output-only) options are now sample-accurate when
 +- smptehdbars source
 +- inverse telecine filters (fieldmatch and decimate)
 +- colorbalance filter
 +- colorchannelmixer filter
 +- The matroska demuxer can now output proper verbatim ASS packets. It will
 +  become the default at the next libavformat major bump.
 +- decent native animated GIF encoding
 +- asetrate filter
 +- interleave filter
 +- timeline editing with filters
 +- vidstabdetect and vidstabtransform filters for video stabilization using
 +  the vid.stab library
 +- astats filter
 +- trim and atrim filters
 +- ffmpeg -t and -ss (output-only) options are now sample-accurate when
    transcoding audio
+ - Matroska muxer can now put the index at the beginning of the file.
  
  
 -version 9:
 -- av_basename and av_dirname
 -- adobe and limelight publisher authentication in RTMP
 +version 1.2:
 +
  - VDPAU hardware acceleration through normal hwaccel
  - SRTP support
 -
 -
 -version 9_beta3:
 -- ashowinfo audio filter
 +- Error diffusion dither in Swscale
 +- Chained Ogg support
 +- Theora Midstream reconfiguration support
 +- EVRC decoder
 +- audio fade filter
 +- filtering audio with unknown channel layout
 +- allpass, bass, bandpass, bandreject, biquad, equalizer, highpass, lowpass
 +  and treble audio filter
 +- improved showspectrum filter, with multichannel support and sox-like colors
 +- histogram filter
 +- tee muxer
 +- il filter ported from libmpcodecs
 +- support ID3v2 tags in ASF files
 +- encrypted TTA stream decoding support
 +- RF64 support in WAV muxer
 +- noise filter ported from libmpcodecs
 +- Subtitles character encoding conversion
 +- blend filter
 +- stereo3d filter ported from libmpcodecs
 +
 +
 +version 1.1:
 +
 +- stream disposition information printing in ffprobe
 +- filter for loudness analysis following EBU R128
 +- Opus encoder using libopus
 +- ffprobe -select_streams option
 +- Pinnacle TARGA CineWave YUV16 decoder
 +- TAK demuxer, decoder and parser
 +- DTS-HD demuxer
 +- remove -same_quant, it hasn't worked for years
 +- FFM2 support
 +- X-Face image encoder and decoder
  - 24-bit FLAC encoding
 -- audio volume filter
 -- deprecated the avconv -vol option. the volume filter is to be used instead.
  - multi-channel ALAC encoding up to 7.1
 -- TAK demuxer, parser, and decoder
 -- adaptive frame-level multithreading for H.264
 -
 -
 -version 9_beta2:
  - metadata (INFO tag) support in WAV muxer
 +- subtitles raw text decoder
  - support for building DLLs using MSVC
 -- remove avserver daemon mode
 +- LVF demuxer
 +- ffescape tool
 +- metadata (info chunk) support in CAF muxer
 +- field filter ported from libmpcodecs
 +- AVR demuxer
 +- geq filter ported from libmpcodecs
 +- remove ffserver daemon mode
 +- AST muxer/demuxer
 +- new expansion syntax for drawtext
 +- BRender PIX image decoder
 +- ffprobe -show_entries option
 +- ffprobe -sections option
 +- ADPCM IMA Dialogic decoder
 +- BRSTM demuxer
 +- animated GIF decoder and demuxer
 +- PVF demuxer
 +- subtitles filter
 +- IRCAM muxer/demuxer
 +- Paris Audio File demuxer
 +- Virtual concatenation demuxer
 +- VobSub demuxer
 +- JSON captions for TED talks decoding support
 +- SOX Resampler support in libswresample
 +- aselect filter
 +- SGI RLE 8-bit decoder
 +- Silicon Graphics Motion Video Compressor 1 & 2 decoder
 +- Silicon Graphics Movie demuxer
 +- apad filter
 +- Resolution & pixel format change support with multithreading for H.264
 +- documentation split into per-component manuals
 +- pp (postproc) filter ported from MPlayer
 +- NIST Sphere demuxer
 +- MPL2, VPlayer, MPlayer, AQTitle, PJS and SubViewer v1 subtitles demuxers and decoders
 +- Sony Wave64 muxer
 +- adobe and limelight publisher authentication in RTMP
 +- data: URI scheme
  - support building on the Plan 9 operating system
 -- ffv1: support version 1.3
 +- kerndeint filter ported from MPlayer
 +- histeq filter ported from VirtualDub
 +- Megalux Frame demuxer
 +- 012v decoder
 +- Improved AVC Intra decoding support
  
  
 -version 9_beta1:
 +version 1.0:
  
 -- XWD encoder and decoder
 -- Support for fragmentation in the mov/mp4 muxer
 -- ISMV (Smooth Streaming) muxer
 -- CDXL demuxer and decoder
 -- Apple ProRes encoder
 -- Sun Rasterfile Encoder
 -- remove libpostproc
 -- ID3v2 attached pictures reading and writing
 -- WMA Lossless decoder
 -- XBM encoder
 -- RealAudio Lossless decoder
 -- ZeroCodec decoder
 -- drop support for avconv without libavfilter
 -- add libavresample audio conversion library
 -- audio filters support in libavfilter and avconv
 -- add fps filter
 -- audio split filter
 -- audio mix filter
 -- avprobe output is now standard INI or JSON. The old format can still
 -  be used with -of old.
 +- INI and flat output in ffprobe
 +- Scene detection in libavfilter
  - Indeo Audio decoder
  - channelsplit audio filter
 +- setnsamples audio filter
 +- atempo filter
 +- ffprobe -show_data option
  - RTMPT protocol support
  - iLBC encoding/decoding via libilbc
  - Microsoft Screen 1 decoder
diff --cc doc/muxers.texi
index f1274948f892a7db32ba960c10e1b279cda18bea,742e72aa02af4338119a77342b7c5c7f05f882bb..dc627dc9685b2d528fc79ec06647c8f71edc84fb
@@@ -486,10 -370,31 +486,31 @@@ Both eyes laced in one Block, Right-ey
  
  For example a 3D WebM clip can be created using the following command line:
  @example
 -avconv -i sample_left_right_clip.mpg -an -c:v libvpx -metadata STEREO_MODE=left_right -y stereo_clip.webm
 +ffmpeg -i sample_left_right_clip.mpg -an -c:v libvpx -metadata stereo_mode=left_right -y stereo_clip.webm
  @end example
  
 -@section segment
+ This muxer supports the following options:
+ @table @option
+ @item reserve_index_space
+ By default, this muxer writes the index for seeking (called cues in Matroska
+ terms) at the end of the file, because it cannot know in advance how much space
+ to leave for the index at the beginning of the file. However for some use cases
+ -- e.g.  streaming where seeking is possible but slow -- it is useful to put the
+ index at the beginning of the file.
+ If this option is set to a non-zero value, the muxer will reserve a given amount
+ of space in the file header and then try to write the cues there when the muxing
+ finishes. If the available space does not suffice, muxing will fail. A safe size
+ for most use cases should be about 50kB per hour of video.
+ Note that cues are only written if the output is seekable and this option will
+ have no effect if it is not.
+ @end table
 +@section segment, stream_segment, ssegment
  
  Basic stream segmenter.
  
index 1f1ff49ecef9b754b174e991aef92b8486d1f1d4,c521ed392616a6631d4a66af625cff44c15dfc7d..da34ea7677147be3eee6076b9cdea5bacce9ecac
  #include "libavutil/intreadwrite.h"
  #include "libavutil/lfg.h"
  #include "libavutil/mathematics.h"
+ #include "libavutil/opt.h"
  #include "libavutil/random_seed.h"
  #include "libavutil/samplefmt.h"
 +#include "libavutil/sha.h"
  
  #include "libavcodec/xiph.h"
  #include "libavcodec/mpeg4audio.h"
@@@ -1042,9 -973,13 +1047,14 @@@ static int mkv_write_header(AVFormatCon
      if (mkv->cues == NULL)
          return AVERROR(ENOMEM);
  
+     if (pb->seekable && mkv->reserve_cues_space) {
+         mkv->cues_pos = avio_tell(pb);
+         put_ebml_void(pb, mkv->reserve_cues_space);
+     }
      av_init_packet(&mkv->cur_audio_pkt);
      mkv->cur_audio_pkt.size = 0;
 +    mkv->cluster_pos = -1;
  
      avio_flush(pb);
      return 0;
@@@ -1336,7 -1260,28 +1346,28 @@@ static int mkv_write_trailer(AVFormatCo
  
      if (pb->seekable) {
          if (mkv->cues->num_entries) {
-             cuespos = mkv_write_cues(pb, mkv->cues, mkv->tracks, s->nb_streams);
+             if (mkv->reserve_cues_space) {
+                 int64_t cues_end;
+                 currentpos = avio_tell(pb);
+                 avio_seek(pb, mkv->cues_pos, SEEK_SET);
 -                cuespos = mkv_write_cues(pb, mkv->cues, s->nb_streams);
++                cuespos = mkv_write_cues(pb, mkv->cues, mkv->tracks, s->nb_streams);
+                 cues_end = avio_tell(pb);
+                 if (cues_end > cuespos + mkv->reserve_cues_space) {
+                     av_log(s, AV_LOG_ERROR, "Insufficient space reserved for cues: %d "
+                            "(needed: %"PRId64").\n", mkv->reserve_cues_space,
+                            cues_end - cuespos);
+                     return AVERROR(EINVAL);
+                 }
+                 if (cues_end < cuespos + mkv->reserve_cues_space)
+                     put_ebml_void(pb, mkv->reserve_cues_space - (cues_end - cuespos));
+                 avio_seek(pb, currentpos, SEEK_SET);
+             } else {
 -                cuespos = mkv_write_cues(pb, mkv->cues, s->nb_streams);
++                cuespos = mkv_write_cues(pb, mkv->cues, mkv->tracks, s->nb_streams);
+             }
  
              ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CUES, cuespos);
              if (ret < 0) return ret;
@@@ -1377,34 -1322,22 +1408,49 @@@ static int mkv_query_codec(enum AVCodec
      return 0;
  }
  
 +const AVCodecTag additional_audio_tags[] = {
 +    { AV_CODEC_ID_ALAC,      0XFFFFFFFF },
 +    { AV_CODEC_ID_EAC3,      0XFFFFFFFF },
 +    { AV_CODEC_ID_MLP,       0xFFFFFFFF },
 +    { AV_CODEC_ID_OPUS,      0xFFFFFFFF },
 +    { AV_CODEC_ID_PCM_S16BE, 0xFFFFFFFF },
 +    { AV_CODEC_ID_PCM_S24BE, 0xFFFFFFFF },
 +    { AV_CODEC_ID_PCM_S32BE, 0xFFFFFFFF },
 +    { AV_CODEC_ID_QDM2,      0xFFFFFFFF },
 +    { AV_CODEC_ID_RA_144,    0xFFFFFFFF },
 +    { AV_CODEC_ID_RA_288,    0xFFFFFFFF },
 +    { AV_CODEC_ID_COOK,      0xFFFFFFFF },
 +    { AV_CODEC_ID_TRUEHD,    0xFFFFFFFF },
 +    { AV_CODEC_ID_WAVPACK,   0xFFFFFFFF },
 +    { AV_CODEC_ID_NONE,      0xFFFFFFFF }
 +};
 +
 +const AVCodecTag additional_video_tags[] = {
 +    { AV_CODEC_ID_PRORES,    0xFFFFFFFF },
 +    { AV_CODEC_ID_RV10,      0xFFFFFFFF },
 +    { AV_CODEC_ID_RV20,      0xFFFFFFFF },
 +    { AV_CODEC_ID_RV30,      0xFFFFFFFF },
 +    { AV_CODEC_ID_RV40,      0xFFFFFFFF },
 +    { AV_CODEC_ID_VP9,       0xFFFFFFFF },
 +    { AV_CODEC_ID_NONE,      0xFFFFFFFF }
 +};
 +
+ #define OFFSET(x) offsetof(MatroskaMuxContext, x)
+ #define FLAGS AV_OPT_FLAG_ENCODING_PARAM
+ static const AVOption options[] = {
+     { "reserve_index_space", "Reserve a given amount of space (in bytes) at the beginning "
+         "of the file for the index (cues).", OFFSET(reserve_cues_space), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
+     { NULL },
+ };
  #if CONFIG_MATROSKA_MUXER
+ static const AVClass matroska_class = {
+     .class_name = "matroska muxer",
+     .item_name  = av_default_item_name,
+     .option     = options,
+     .version    = LIBAVUTIL_VERSION_INT,
+ };
  AVOutputFormat ff_matroska_muxer = {
      .name              = "matroska",
      .long_name         = NULL_IF_CONFIG_SMALL("Matroska"),
      .flags             = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |
                           AVFMT_TS_NONSTRICT,
      .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,
  };
  #endif
  
@@@ -1464,8 -1407,7 +1525,9 @@@ AVOutputFormat ff_matroska_audio_muxer 
      .write_packet      = mkv_write_packet,
      .write_trailer     = mkv_write_trailer,
      .flags             = AVFMT_GLOBALHEADER | AVFMT_TS_NONSTRICT,
 -    .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
index 3e186a9e0249e90666f2bcfcf8e1d2f6af4d2912,4ebf0784e910510c89f13ebb00a492a998993a09..4666640d02cbdbe018e3bcc54f8952f13b931cab
@@@ -30,8 -30,8 +30,8 @@@
  #include "libavutil/avutil.h"
  
  #define LIBAVFORMAT_VERSION_MAJOR 55
 -#define LIBAVFORMAT_VERSION_MINOR  0
 -#define LIBAVFORMAT_VERSION_MICRO  1
 +#define LIBAVFORMAT_VERSION_MINOR  4
- #define LIBAVFORMAT_VERSION_MICRO 100
++#define LIBAVFORMAT_VERSION_MICRO 101
  
  #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                 LIBAVFORMAT_VERSION_MINOR, \