From: Christophe Massiot Date: Thu, 10 Feb 2011 15:38:03 +0000 (+0100) Subject: Pass VBV delay to the calling application via ctx X-Git-Tag: android-x86-4.4-r1~12310^2~2194 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=55bad0c602c75a2c7e4dbfa466edacb0bad6a6eb;p=android-x86%2Fexternal-ffmpeg.git 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 --- diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index e48033dca0..9ed6f50856 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, \ @@ -2892,6 +2892,14 @@ typedef struct AVCodecContext { * - decoding: Set by user. */ 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; } AVCodecContext; /** diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 6167a9b20e..a7f16080f4 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;