Merge commit '1520c6ff05d835da4b793318fc88bbbc129c86a1'

* commit '1520c6ff05d835da4b793318fc88bbbc129c86a1':
  nvenc: export CPB props side data

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
This commit is contained in:
Hendrik Leppkes 2015-12-17 13:41:29 +01:00
commit 5fc17edc7d
1 changed files with 8 additions and 0 deletions

View File

@ -550,6 +550,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
GUID encoder_preset = NV_ENC_PRESET_HQ_GUID; GUID encoder_preset = NV_ENC_PRESET_HQ_GUID;
GUID codec; GUID codec;
NVENCSTATUS nv_status = NV_ENC_SUCCESS; NVENCSTATUS nv_status = NV_ENC_SUCCESS;
AVCPBProperties *cpb_props;
int surfaceCount = 0; int surfaceCount = 0;
int i, num_mbs; int i, num_mbs;
int isLL = 0; int isLL = 0;
@ -1095,6 +1096,13 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
if (ctx->encode_config.rcParams.averageBitRate > 0) if (ctx->encode_config.rcParams.averageBitRate > 0)
avctx->bit_rate = ctx->encode_config.rcParams.averageBitRate; avctx->bit_rate = ctx->encode_config.rcParams.averageBitRate;
cpb_props = ff_add_cpb_side_data(avctx);
if (!cpb_props)
return AVERROR(ENOMEM);
cpb_props->max_bitrate = ctx->encode_config.rcParams.maxBitRate;
cpb_props->avg_bitrate = avctx->bit_rate;
cpb_props->buffer_size = ctx->encode_config.rcParams.vbvBufferSize;
return 0; return 0;
error: error: