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

Function decode_frame

libavcodec/proresdec.c:761–842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

759}
760
761static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
762 int *got_frame, AVPacket *avpkt)
763{
764 ProresContext *ctx = avctx->priv_data;
765 const uint8_t *buf = avpkt->data;
766 int buf_size = avpkt->size;
767 int frame_hdr_size, pic_size, ret;
768 int i;
769
770 if (buf_size < 28 || AV_RL32(buf + 4) != AV_RL32("icpf")) {
771 av_log(avctx, AV_LOG_ERROR, "invalid frame header\n");
772 return AVERROR_INVALIDDATA;
773 }
774
775 ctx->frame = frame;
776 ctx->first_field = 1;
777
778 buf += 8;
779 buf_size -= 8;
780
781 frame_hdr_size = decode_frame_header(ctx, buf, buf_size, avctx);
782 if (frame_hdr_size < 0)
783 return frame_hdr_size;
784
785 if (avctx->skip_frame == AVDISCARD_ALL)
786 return 0;
787
788 buf += frame_hdr_size;
789 buf_size -= frame_hdr_size;
790
791 if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0)
792 return ret;
793
794 av_refstruct_unref(&ctx->hwaccel_picture_private);
795
796 if ((ret = ff_hwaccel_frame_priv_alloc(avctx, &ctx->hwaccel_picture_private)) < 0)
797 return ret;
798
799 ff_thread_finish_setup(avctx);
800
801 decode_picture:
802 pic_size = decode_picture_header(avctx, buf, buf_size);
803 if (pic_size < 0) {
804 av_log(avctx, AV_LOG_ERROR, "error decoding picture header\n");
805 return pic_size;
806 }
807
808 if (HWACCEL_MAX && avctx->hwaccel) {
809 const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel);
810
811 ret = hwaccel->start_frame(avctx, avpkt->buf, avpkt->data, avpkt->size);
812 if (ret < 0)
813 return ret;
814
815 for (i = 0; i < ctx->slice_count; ++i) {
816 ret = hwaccel->decode_slice(avctx, ctx->slices[i].data, ctx->slices[i].data_size);
817 if (ret < 0)
818 return ret;

Callers

nothing calls this directly

Calls 9

av_logFunction · 0.85
av_refstruct_unrefFunction · 0.85
decode_picture_headerFunction · 0.85
ffhwaccelFunction · 0.85
decode_pictureFunction · 0.85
decode_frame_headerFunction · 0.70
ff_thread_get_bufferFunction · 0.70
ff_thread_finish_setupFunction · 0.70

Tested by

no test coverage detected