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

Function ff_videotoolbox_alloc_frame

libavcodec/videotoolbox.c:150–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150int ff_videotoolbox_alloc_frame(AVCodecContext *avctx, AVFrame *frame)
151{
152 size_t size = sizeof(VTHWFrame);
153 uint8_t *data = NULL;
154 AVBufferRef *buf = NULL;
155 int ret = ff_attach_decode_data(frame);
156 FrameDecodeData *fdd;
157 if (ret < 0)
158 return ret;
159
160 data = av_mallocz(size);
161 if (!data)
162 return AVERROR(ENOMEM);
163 buf = av_buffer_create(data, size, videotoolbox_buffer_release, NULL, 0);
164 if (!buf) {
165 av_freep(&data);
166 return AVERROR(ENOMEM);
167 }
168 frame->buf[0] = buf;
169
170 fdd = frame->private_ref;
171 fdd->post_process = videotoolbox_postproc_frame;
172
173 frame->width = avctx->width;
174 frame->height = avctx->height;
175 frame->format = avctx->pix_fmt;
176
177 return 0;
178}
179
180#define AV_W8(p, v) *(p) = (v)
181

Callers

nothing calls this directly

Calls 4

ff_attach_decode_dataFunction · 0.85
av_buffer_createFunction · 0.85
av_freepFunction · 0.85
av_malloczFunction · 0.50

Tested by

no test coverage detected