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

Function decode_receive_frame_internal

libavcodec/decode.c:650–709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

648}
649
650static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame,
651 unsigned flags)
652{
653 AVCodecInternal *avci = avctx->internal;
654 DecodeContext *dc = decode_ctx(avci);
655 int ret, ok;
656
657 if (avctx->active_thread_type & FF_THREAD_FRAME)
658 ret = ff_thread_receive_frame(avctx, frame, flags);
659 else
660 ret = ff_decode_receive_frame_internal(avctx, frame);
661
662 /* preserve ret */
663 ok = detect_colorspace(avctx, frame);
664 if (ok < 0) {
665 av_frame_unref(frame);
666 return ok;
667 }
668
669 if (!ret) {
670 if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
671 if (!frame->width)
672 frame->width = avctx->width;
673 if (!frame->height)
674 frame->height = avctx->height;
675 }
676
677 ret = fill_frame_props(avctx, frame);
678 if (ret < 0) {
679 av_frame_unref(frame);
680 return ret;
681 }
682
683 frame->best_effort_timestamp = guess_correct_pts(dc,
684 frame->pts,
685 frame->pkt_dts);
686
687 /* the only case where decode data is not set should be decoders
688 * that do not call ff_get_buffer() */
689 av_assert0(frame->private_ref ||
690 !(avctx->codec->capabilities & AV_CODEC_CAP_DR1));
691
692 if (frame->private_ref) {
693 FrameDecodeData *fdd = frame->private_ref;
694
695 if (fdd->post_process) {
696 ret = fdd->post_process(avctx, frame);
697 if (ret < 0) {
698 av_frame_unref(frame);
699 return ret;
700 }
701 }
702 }
703 }
704
705 /* free the per-frame decode data */
706 av_refstruct_unref(&frame->private_ref);
707

Callers 2

avcodec_send_packetFunction · 0.85
ff_decode_receive_frameFunction · 0.85

Calls 8

decode_ctxFunction · 0.85
ff_thread_receive_frameFunction · 0.85
detect_colorspaceFunction · 0.85
av_frame_unrefFunction · 0.85
fill_frame_propsFunction · 0.85
guess_correct_ptsFunction · 0.85
av_refstruct_unrefFunction · 0.85

Tested by

no test coverage detected