[008/264] mpegvideo_enc: export CPB props side data

Message ID 1447012658-16819-9-git-send-email-anton@khirnov.net
State Committed
Headers show

Commit Message

Anton Khirnov Nov. 8, 2015, 7:57 p.m.
---
 libavcodec/mpegvideo_enc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index ab4fb32..70f3303 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -241,6 +241,7 @@  static void mpv_encode_defaults(MpegEncContext *s)
 av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
 {
     MpegEncContext *s = avctx->priv_data;
+    AVCPBProperties *cpb_props;
     int i, ret, format_supported;
 
     mpv_encode_defaults(s);
@@ -872,6 +873,14 @@  FF_ENABLE_DEPRECATION_WARNINGS
         }
     }
 
+    cpb_props = ff_add_cpb_sd(avctx);
+    if (!cpb_props)
+        return AVERROR(ENOMEM);
+    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;
 fail:
     ff_mpv_encode_end(avctx);