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

Function wrapped_avframe_encode

libavcodec/wrapped_avframe.c:42–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42static int wrapped_avframe_encode(AVCodecContext *avctx, AVPacket *pkt,
43 const AVFrame *frame, int *got_packet)
44{
45 AVFrame *wrapped = av_frame_clone(frame);
46 uint8_t *data;
47 int size = sizeof(*wrapped) + AV_INPUT_BUFFER_PADDING_SIZE;
48
49 if (!wrapped)
50 return AVERROR(ENOMEM);
51
52 data = av_mallocz(size);
53 if (!data) {
54 av_frame_free(&wrapped);
55 return AVERROR(ENOMEM);
56 }
57
58 pkt->buf = av_buffer_create(data, size,
59 wrapped_avframe_release_buffer, NULL,
60 AV_BUFFER_FLAG_READONLY);
61 if (!pkt->buf) {
62 av_frame_free(&wrapped);
63 av_freep(&data);
64 return AVERROR(ENOMEM);
65 }
66
67 av_frame_move_ref((AVFrame*)data, wrapped);
68 av_frame_free(&wrapped);
69
70 pkt->data = data;
71 pkt->size = sizeof(*wrapped);
72
73 pkt->flags |= AV_PKT_FLAG_KEY;
74 *got_packet = 1;
75 return 0;
76}
77
78static int wrapped_avframe_decode(AVCodecContext *avctx, AVFrame *out,
79 int *got_frame, AVPacket *pkt)

Callers

nothing calls this directly

Calls 6

av_frame_cloneFunction · 0.85
av_frame_freeFunction · 0.85
av_buffer_createFunction · 0.85
av_freepFunction · 0.85
av_frame_move_refFunction · 0.85
av_malloczFunction · 0.50

Tested by

no test coverage detected