avcodec: Add a min size parameter to ff_alloc_packet2()

This parameter can be used to inform the allocation code about how much
downsizing might occur, and can be used to optimize how to allocate the
packet

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2015-07-27 19:36:16 +02:00
parent 59216e0525
commit e36db49b7b
89 changed files with 96 additions and 92 deletions

View File

@@ -1777,7 +1777,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
goto end;
}
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
{
if (avpkt->size < 0) {
av_log(avctx, AV_LOG_ERROR, "Invalid negative user packet size %d\n", avpkt->size);
@@ -1835,7 +1835,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
int ff_alloc_packet(AVPacket *avpkt, int size)
{
return ff_alloc_packet2(NULL, avpkt, size);
return ff_alloc_packet2(NULL, avpkt, size, 0);
}
/**