mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-16 03:50:05 +01:00
avcodec/utils: move ff_add_cpb_side_data() to encoder code
It's only used by encoders, so move it to prevent wrong usage. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@@ -865,3 +865,34 @@ AVCodecInternal *ff_encode_internal_alloc(void)
|
||||
{
|
||||
return av_mallocz(sizeof(EncodeContext));
|
||||
}
|
||||
|
||||
AVCPBProperties *ff_encode_add_cpb_side_data(AVCodecContext *avctx)
|
||||
{
|
||||
AVPacketSideData *tmp;
|
||||
AVCPBProperties *props;
|
||||
size_t size;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < avctx->nb_coded_side_data; i++)
|
||||
if (avctx->coded_side_data[i].type == AV_PKT_DATA_CPB_PROPERTIES)
|
||||
return (AVCPBProperties *)avctx->coded_side_data[i].data;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user