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

Vignesh Venkatasubramanian git at videolan.org
Tue Sep 10 01:53:24 CEST 2013


ffmpeg | branch: master | Vignesh Venkatasubramanian <vigneshv at google.com> | Fri Aug 30 10:52:36 2013 -0700| [d92b1b1babe69268971863649c225e1747358a74] | committer: Michael Niedermayer

lavf/matroska: Adding support for Opus CodecDelay

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>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d92b1b1babe69268971863649c225e1747358a74
---

 libavformat/matroska.h    |    1 +
 libavformat/matroskaenc.c |    5 +++++
 libavformat/version.h     |    2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 002fc4c..0c3dc29 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 9730761..13523f8 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -653,7 +653,12 @@ static int mkv_write_tracks(AVFormatContext *s)
         }
 
         if (codec->codec_id == AV_CODEC_ID_OPUS) {
+            uint64_t codec_delay =av_rescale_q(codec->delay,
+                                               (AVRational){1, codec->sample_rate},
+                                               (AVRational){1, 1000000000});
+            put_ebml_uint(pb, MATROSKA_ID_CODECDELAY, codec_delay);
             put_ebml_uint(pb, MATROSKA_ID_SEEKPREROLL, OPUS_SEEK_PREROLL);
+
         }
 
         if (mkv->mode == MODE_WEBM && !(codec->codec_id == AV_CODEC_ID_VP8 ||
diff --git a/libavformat/version.h b/libavformat/version.h
index 8ae40ab..4f59ff3 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
 
 #define LIBAVFORMAT_VERSION_MAJOR 55
 #define LIBAVFORMAT_VERSION_MINOR 16
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MICRO 102
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list