| 612 | } |
| 613 | |
| 614 | int ff_decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) |
| 615 | { |
| 616 | AVCodecInternal *avci = avctx->internal; |
| 617 | DecodeContext *dc = decode_ctx(avci); |
| 618 | const FFCodec *const codec = ffcodec(avctx->codec); |
| 619 | int ret; |
| 620 | |
| 621 | av_assert0(!frame->buf[0]); |
| 622 | |
| 623 | if (codec->cb_type == FF_CODEC_CB_TYPE_RECEIVE_FRAME) { |
| 624 | while (1) { |
| 625 | frame->pict_type = dc->initial_pict_type; |
| 626 | frame->flags |= dc->intra_only_flag; |
| 627 | ret = codec->cb.receive_frame(avctx, frame); |
| 628 | emms_c(); |
| 629 | if (!ret) { |
| 630 | if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) { |
| 631 | int64_t discarded_samples = 0; |
| 632 | ret = discard_samples(avctx, frame, &discarded_samples); |
| 633 | } |
| 634 | if (ret == AVERROR(EAGAIN) || (frame->flags & AV_FRAME_FLAG_DISCARD)) { |
| 635 | av_frame_unref(frame); |
| 636 | continue; |
| 637 | } |
| 638 | } |
| 639 | break; |
| 640 | } |
| 641 | } else |
| 642 | ret = decode_simple_receive_frame(avctx, frame); |
| 643 | |
| 644 | if (ret == AVERROR_EOF) |
| 645 | avci->draining_done = 1; |
| 646 | |
| 647 | return ret; |
| 648 | } |
| 649 | |
| 650 | static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame, |
| 651 | unsigned flags) |
no test coverage detected