diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-12-17 13:33:20 +0100 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-12-17 13:33:20 +0100 |
commit | d6322710c5ec51086aefef9037311922c7aa646c (patch) | |
tree | a7d35db28260c5d7022e75e118207be1ea6bd2b1 /libavcodec | |
parent | f49264a1c5912ee2bc23e7a09ded1024a178cf04 (diff) | |
parent | 03afb62e83516141ba999536fc97575faefb98af (diff) | |
download | ffmpeg-d6322710c5ec51086aefef9037311922c7aa646c.tar.gz |
Merge commit '03afb62e83516141ba999536fc97575faefb98af'
* commit '03afb62e83516141ba999536fc97575faefb98af':
libvpxenc: export CPB props side data
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/libvpxenc.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 6e1e915c69..96b1ac66f1 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -375,6 +375,7 @@ static av_cold int vpx_init(AVCodecContext *avctx, struct vpx_codec_enc_cfg enccfg = { 0 }; struct vpx_codec_enc_cfg enccfg_alpha; vpx_codec_flags_t flags = (avctx->flags & AV_CODEC_FLAG_PSNR) ? VPX_CODEC_USE_PSNR : 0; + AVCPBProperties *cpb_props; int res; vpx_img_fmt_t img_fmt = VPX_IMG_FMT_I420; #if CONFIG_LIBVPX_VP9_ENCODER @@ -631,6 +632,18 @@ static av_cold int vpx_init(AVCodecContext *avctx, vpx_img_wrap(&ctx->rawimg_alpha, VPX_IMG_FMT_I420, avctx->width, avctx->height, 1, (unsigned char*)1); + cpb_props = ff_add_cpb_side_data(avctx); + if (!cpb_props) + return AVERROR(ENOMEM); + + if (enccfg.rc_end_usage == VPX_CBR || + enccfg.g_pass != VPX_RC_ONE_PASS) { + cpb_props->max_bitrate = avctx->rc_max_rate; + cpb_props->min_bitrate = avctx->rc_min_rate; + cpb_props->avg_bitrate = avctx->bit_rate; + } + cpb_props->buffer_size = avctx->rc_buffer_size; + return 0; } |