[FFmpeg-devel] [PATCH] Pass VBV delay to the calling application via ctx
Måns Rullgård
mans
Tue Feb 8 15:23:59 CET 2011
Christophe Massiot <massiot at via.ecp.fr> writes:
> 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.
This is probably a good idea.
> ---
> doc/APIchanges | 3 +++
> libavcodec/avcodec.h | 9 ++++++++-
> libavcodec/mpegvideo_enc.c | 1 +
> 3 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index b44182d..05e15bf 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,9 @@ libavutil: 2009-03-08
>
> API changes, most recent first:
>
> +2011-02-08 - X - lavc 52.110.0 - vbv_delay
> + Add vbv_delay field to AVCodecContext
> +
> 2011-02-06 - fe174fc - lavf 52.97.0 - avio.h
> Add flag for non-blocking protocols: URL_FLAG_NONBLOCK
>
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index f96ae84..05fa743 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 109
> +#define LIBAVCODEC_VERSION_MINOR 110
> #define LIBAVCODEC_VERSION_MICRO 0
>
> #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> @@ -2843,6 +2843,13 @@ typedef struct AVCodecContext {
> int64_t pts_correction_last_pts; /// PTS of the last frame
> int64_t pts_correction_last_dts; /// DTS of the last frame
>
> + /**
> + * VBV delay coded in the last frame (in seconds).
> + * Used for compliant TS muxing.
> + * - encoding: Set by libavcodec.
> + * - decoding: unused.
> + */
> + double vbv_delay;
I don't like floating-point. Could this be expressed in some other
units instead?
> } AVCodecContext;
>
> /**
> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
> index 6167a9b..5b9c34f 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/90000.;
> }
> s->total_bits += s->frame_bits;
> avctx->frame_bits = s->frame_bits;
> --
> 1.7.1
>
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list