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

Function libxevd_return_frame

libavcodec/libxevd.c:248–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248static int libxevd_return_frame(AVCodecContext *avctx, AVFrame *frame,
249 XEVD_IMGB *imgb, AVPacket **pkt_au)
250{
251 AVPacket *pkt_au_imgb = (AVPacket*)imgb->pdata[0];
252 int ret;
253
254 if (!pkt_au_imgb) {
255 av_log(avctx, AV_LOG_ERROR, "Invalid data needed to fill frame properties\n");
256
257 if (pkt_au)
258 av_packet_free(pkt_au);
259 av_frame_unref(frame);
260
261 imgb->release(imgb);
262 imgb = NULL;
263
264 return AVERROR_INVALIDDATA;
265 }
266
267 // got frame
268 ret = libxevd_image_copy(avctx, imgb, frame);
269 if (ret < 0) {
270 av_log(avctx, AV_LOG_ERROR, "Image copying error\n");
271
272 av_packet_free(&pkt_au_imgb);
273 av_frame_unref(frame);
274
275 imgb->release(imgb);
276 imgb = NULL;
277
278 return ret;
279 }
280
281 // use ff_decode_frame_props_from_pkt() to fill frame properties
282 ret = ff_decode_frame_props_from_pkt(avctx, frame, pkt_au_imgb);
283 if (ret < 0) {
284 av_log(avctx, AV_LOG_ERROR, "ff_decode_frame_props_from_pkt error\n");
285
286 av_packet_free(&pkt_au_imgb);
287 av_frame_unref(frame);
288
289 imgb->release(imgb);
290 imgb = NULL;
291
292 return ret;
293 }
294
295 frame->pkt_dts = imgb->ts[XEVD_TS_DTS];
296 frame->pts = imgb->ts[XEVD_TS_PTS];
297
298 av_packet_free(&pkt_au_imgb);
299
300 // xevd_pull uses pool of objects of type XEVD_IMGB.
301 // The pool size is equal MAX_PB_SIZE (26), so release object when it is no more needed
302 imgb->release(imgb);
303 imgb = NULL;
304
305 return 0;

Callers 1

libxevd_receive_frameFunction · 0.85

Calls 5

av_logFunction · 0.85
av_packet_freeFunction · 0.85
av_frame_unrefFunction · 0.85
libxevd_image_copyFunction · 0.85

Tested by

no test coverage detected