MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / ff_alloc_packet

Function ff_alloc_packet

libavcodec/encode.c:61–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
62{
63 if (size < 0 || size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
64 av_log(avctx, AV_LOG_ERROR, "Invalid minimum required packet size %"PRId64" (max allowed is %d)\n",
65 size, INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE);
66 return AVERROR(EINVAL);
67 }
68
69 av_assert0(!avpkt->data);
70
71 av_fast_padded_malloc(&avctx->internal->byte_buffer,
72 &avctx->internal->byte_buffer_size, size);
73 avpkt->data = avctx->internal->byte_buffer;
74 if (!avpkt->data) {
75 av_log(avctx, AV_LOG_ERROR, "Failed to allocate packet of size %"PRId64"\n", size);
76 return AVERROR(ENOMEM);
77 }
78 avpkt->size = size;
79
80 return 0;
81}
82
83int avcodec_default_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int flags)
84{

Callers 15

encode_frameFunction · 0.85
wavpack_encode_frameFunction · 0.85
encode_frameFunction · 0.85
encode_frameFunction · 0.85
flashsv_encode_frameFunction · 0.85
gif_encode_frameFunction · 0.85
smc_encode_frameFunction · 0.85
qtrle_encode_frameFunction · 0.85
targa_encode_frameFunction · 0.85
prores_encode_frameFunction · 0.85
ffat_encodeFunction · 0.85
encode_frameFunction · 0.85

Calls 2

av_logFunction · 0.85
av_fast_padded_mallocFunction · 0.85

Tested by

no test coverage detected