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

Function enc_alloc

fftools/ffmpeg_enc.c:99–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97};
98
99int enc_alloc(Encoder **penc, const AVCodec *codec,
100 Scheduler *sch, unsigned sch_idx, void *log_parent)
101{
102 EncoderPriv *ep;
103 int ret = 0;
104
105 *penc = NULL;
106
107 ep = av_mallocz(sizeof(*ep));
108 if (!ep)
109 return AVERROR(ENOMEM);
110
111 ep->e.class = &enc_class;
112 ep->log_parent = log_parent;
113
114 ep->sch = sch;
115 ep->sch_idx = sch_idx;
116
117 snprintf(ep->log_name, sizeof(ep->log_name), "enc:%s", codec->name);
118
119 ep->e.enc_ctx = avcodec_alloc_context3(codec);
120 if (!ep->e.enc_ctx) {
121 ret = AVERROR(ENOMEM);
122 goto fail;
123 }
124
125 *penc = &ep->e;
126
127 return 0;
128fail:
129 enc_free((Encoder**)&ep);
130 return ret;
131}
132
133static int hw_device_setup_for_encode(Encoder *e, AVCodecContext *enc_ctx,
134 AVBufferRef *frames_ref)

Callers 1

ost_addFunction · 0.85

Calls 3

avcodec_alloc_context3Function · 0.85
enc_freeFunction · 0.85
av_malloczFunction · 0.50

Tested by

no test coverage detected