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

Function dec_alloc

fftools/ffmpeg_dec.c:165–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163static int decoder_thread(void *arg);
164
165static int dec_alloc(DecoderPriv **pdec, Scheduler *sch, int send_end_ts)
166{
167 DecoderPriv *dp;
168 int ret = 0;
169
170 *pdec = NULL;
171
172 dp = av_mallocz(sizeof(*dp));
173 if (!dp)
174 return AVERROR(ENOMEM);
175
176 dp->frame = av_frame_alloc();
177 if (!dp->frame)
178 goto fail;
179
180 dp->pkt = av_packet_alloc();
181 if (!dp->pkt)
182 goto fail;
183
184 dp->index = -1;
185 dp->dec.class = &dec_class;
186 dp->last_filter_in_rescale_delta = AV_NOPTS_VALUE;
187 dp->last_frame_pts = AV_NOPTS_VALUE;
188 dp->last_frame_tb = (AVRational){ 1, 1 };
189 dp->hwaccel_pix_fmt = AV_PIX_FMT_NONE;
190
191 ret = sch_add_dec(sch, decoder_thread, dp, send_end_ts);
192 if (ret < 0)
193 goto fail;
194 dp->sch = sch;
195 dp->sch_idx = ret;
196
197 *pdec = dp;
198
199 return 0;
200fail:
201 dec_free((Decoder**)&dp);
202 return ret >= 0 ? AVERROR(ENOMEM) : ret;
203}
204
205static AVRational audio_samplerate_update(DecoderPriv *dp,
206 const AVFrame *frame)

Callers 2

dec_initFunction · 0.85
dec_createFunction · 0.85

Calls 5

av_frame_allocFunction · 0.85
av_packet_allocFunction · 0.85
sch_add_decFunction · 0.85
dec_freeFunction · 0.85
av_malloczFunction · 0.50

Tested by

no test coverage detected