summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2015-10-03 15:19:10 +0200
committerAnton Khirnov <anton@khirnov.net>2015-12-06 10:24:21 +0100
commit11c9bd633f635f07a762be1ecd672de55daf4edc (patch)
tree2aa24f66079131513eecef9c29f9d147cfa5d2ee /libavcodec/utils.c
parentf0b769c16daafa64720dcba7fa81a9f5255e1d29 (diff)
libopenh264enc: export CPB props side data
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d2f4de770b..4f2f951069 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2383,3 +2383,29 @@ AVCPBProperties *av_cpb_properties_alloc(size_t *size)
return props;
}
+
+AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx)
+{
+ AVPacketSideData *tmp;
+ AVCPBProperties *props;
+ size_t size;
+
+ props = av_cpb_properties_alloc(&size);
+ if (!props)
+ return NULL;
+
+ tmp = av_realloc_array(avctx->coded_side_data, avctx->nb_coded_side_data + 1, sizeof(*tmp));
+ if (!tmp) {
+ av_freep(&props);
+ return NULL;
+ }
+
+ avctx->coded_side_data = tmp;
+ avctx->nb_coded_side_data++;
+
+ avctx->coded_side_data[avctx->nb_coded_side_data - 1].type = AV_PKT_DATA_CPB_PROPERTIES;
+ avctx->coded_side_data[avctx->nb_coded_side_data - 1].data = (uint8_t*)props;
+ avctx->coded_side_data[avctx->nb_coded_side_data - 1].size = size;
+
+ return props;
+}