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

Function avcodec_default_get_encode_buffer

libavcodec/encode.c:83–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83int avcodec_default_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int flags)
84{
85 int ret;
86
87 if (avpkt->size < 0 || avpkt->size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
88 return AVERROR(EINVAL);
89
90 if (avpkt->data || avpkt->buf) {
91 av_log(avctx, AV_LOG_ERROR, "avpkt->{data,buf} != NULL in avcodec_default_get_encode_buffer()\n");
92 return AVERROR(EINVAL);
93 }
94
95 ret = av_buffer_realloc(&avpkt->buf, avpkt->size + AV_INPUT_BUFFER_PADDING_SIZE);
96 if (ret < 0) {
97 av_log(avctx, AV_LOG_ERROR, "Failed to allocate packet of size %d\n", avpkt->size);
98 return ret;
99 }
100 avpkt->data = avpkt->buf->data;
101
102 return 0;
103}
104
105int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
106{

Callers

nothing calls this directly

Calls 2

av_logFunction · 0.85
av_buffer_reallocFunction · 0.85

Tested by

no test coverage detected