[FFmpeg-devel] [PATCH] lavf/matroska: Adding support for Opus CodecDelay

Vignesh Venkatasubramanian vigneshv at google.com
Wed Aug 21 00:26:07 CEST 2013


In order to represent the codec delay accurately in Matroska, a
new element CodecDelay has been introduced. It contains the
overall delay added by the codec in nanoseconds. This patch adds
support for muxing CodecDelay value in the container.
Matroska spec for CodecDelay element can be found here:
http://matroska.org/technical/specs/index.html#CodecDelay

Signed-off-by: Vignesh Venkatasubramanian <vigneshv at google.com>
---
 libavformat/matroska.h    | 1 +
 libavformat/matroskaenc.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 7cf423c..2c72d3e 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -91,6 +91,7 @@
 #define MATROSKA_ID_CODECINFOURL 0x3B4040
 #define MATROSKA_ID_CODECDOWNLOADURL 0x26B240
 #define MATROSKA_ID_CODECDECODEALL 0xAA
+#define MATROSKA_ID_CODECDELAY 0x56AA
 #define MATROSKA_ID_SEEKPREROLL 0x56BB
 #define MATROSKA_ID_TRACKNAME  0x536E
 #define MATROSKA_ID_TRACKLANGUAGE 0x22B59C
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 92df6cb..cbfef04 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -649,6 +649,7 @@ static int mkv_write_tracks(AVFormatContext *s)
 
         if (codec->codec_id == AV_CODEC_ID_OPUS) {
             put_ebml_uint(pb, MATROSKA_ID_SEEKPREROLL, OPUS_SEEK_PREROLL);
+            put_ebml_uint(pb, MATROSKA_ID_CODECDELAY, codec->delay);
         }
 
         if (mkv->mode == MODE_WEBM && !(codec->codec_id == AV_CODEC_ID_VP8 ||
-- 
1.8.3



More information about the ffmpeg-devel mailing list