[FFmpeg-cvslog] Pass VBV delay to the calling application via ctx

Christophe Massiot git
Wed Feb 16 02:26:17 CET 2011


ffmpeg | branch: master | Christophe Massiot <massiot at via.ecp.fr> | Thu Feb 10 16:38:03 2011 +0100| [b6d0700058aeb6ef2c4655d6738c51ed2eb80e56] | committer: Michael Niedermayer

Pass VBV delay to the calling application via ctx

VBV delay is useful for T-STD compliance in some TS muxers. It is
certainly possible to retrieve it by parsing the output of FFmpeg, but
getting it from the context makes it simpler and less error-prone.

Signed-off-by: Mans Rullgard <mans at mansr.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/avcodec.h       |   10 +++++++++-
 libavcodec/mpegvideo_enc.c |    1 +
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 6fbc433..6af5066 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -32,7 +32,7 @@
 #include "libavutil/cpu.h"
 
 #define LIBAVCODEC_VERSION_MAJOR 52
-#define LIBAVCODEC_VERSION_MINOR 112
+#define LIBAVCODEC_VERSION_MINOR 113
 #define LIBAVCODEC_VERSION_MICRO  1
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -2902,6 +2902,14 @@ typedef struct AVCodecContext {
     int thread_safe_callbacks;
 
     /**
+     * VBV delay coded in the last frame (in periods of a 27 MHz clock).
+     * Used for compliant TS muxing.
+     * - encoding: Set by libavcodec.
+     * - decoding: unused.
+     */
+    uint64_t vbv_delay;
+
+    /**
      * Current statistics for PTS correction.
      * - decoding: maintained and used by libavcodec, not intended to be used by user apps
      * - encoding: unused
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 6167a9b..a7f1608 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1381,6 +1381,7 @@ vbv_retry:
             s->vbv_delay_ptr[1]  = vbv_delay>>5;
             s->vbv_delay_ptr[2] &= 0x07;
             s->vbv_delay_ptr[2] |= vbv_delay<<3;
+            avctx->vbv_delay = vbv_delay*300;
         }
         s->total_bits += s->frame_bits;
         avctx->frame_bits  = s->frame_bits;




More information about the ffmpeg-cvslog mailing list