diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-12-17 13:36:09 +0100 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-12-17 13:36:09 +0100 |
commit | 31ae2308b3f6c1021d79da69c504490239895d60 (patch) | |
tree | 4760053d9a303c341ab1eca82582b982ea3d5bfd | |
parent | b799619f48ba5fd07e91243f27f74638bcb875fb (diff) | |
parent | 2507b5dd674834be7261772996f47ae3b95cca69 (diff) | |
download | ffmpeg-streaming-31ae2308b3f6c1021d79da69c504490239895d60.zip ffmpeg-streaming-31ae2308b3f6c1021d79da69c504490239895d60.tar.gz |
Merge commit '2507b5dd674834be7261772996f47ae3b95cca69'
* commit '2507b5dd674834be7261772996f47ae3b95cca69':
mpegvideo_enc: export vbv_delay in side data
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
-rw-r--r-- | libavcodec/avcodec.h | 5 | ||||
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 13 | ||||
-rw-r--r-- | libavcodec/version.h | 3 |
3 files changed, 21 insertions, 0 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index e7f016c..020465b 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3162,13 +3162,18 @@ typedef struct AVCodecContext { int error_rate; #endif +#if FF_API_VBV_DELAY /** * 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. + * @deprecated this value is now exported as a part of + * AV_PKT_DATA_CPB_PROPERTIES packet side data */ + attribute_deprecated uint64_t vbv_delay; +#endif #if FF_API_SIDEDATA_ONLY_PKT /** diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 136733c..83a43c7 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1948,6 +1948,9 @@ vbv_retry: s->out_format == FMT_MPEG1 && 90000LL * (avctx->rc_buffer_size - 1) <= s->avctx->rc_max_rate * 0xFFFFLL) { + AVCPBProperties *props; + size_t props_size; + int vbv_delay, min_delay; double inbits = s->avctx->rc_max_rate * av_q2d(s->avctx->time_base); @@ -1974,7 +1977,17 @@ vbv_retry: s->vbv_delay_ptr[1] = vbv_delay >> 5; s->vbv_delay_ptr[2] &= 0x07; s->vbv_delay_ptr[2] |= vbv_delay << 3; + + props = av_cpb_properties_alloc(&props_size); + if (!props) + return AVERROR(ENOMEM); + props->vbv_delay = vbv_delay * 300; + +#if FF_API_VBV_DELAY +FF_DISABLE_DEPRECATION_WARNINGS avctx->vbv_delay = vbv_delay * 300; +FF_ENABLE_DEPRECATION_WARNINGS +#endif } s->total_bits += s->frame_bits; avctx->frame_bits = s->frame_bits; diff --git a/libavcodec/version.h b/libavcodec/version.h index 6f88ee4..3a533c2 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -197,5 +197,8 @@ #ifndef FF_API_RTP_CALLBACK #define FF_API_RTP_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 59) #endif +#ifndef FF_API_VBV_DELAY +#define FF_API_VBV_DELAY (LIBAVCODEC_VERSION_MAJOR < 59) +#endif #endif /* AVCODEC_VERSION_H */ |