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

Function decode_read

tools/decode_simple.c:35–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33#include "libavutil/frame.h"
34
35static int decode_read(DecodeContext *dc, int flush)
36{
37 const int ret_done = flush ? AVERROR_EOF : AVERROR(EAGAIN);
38 int ret = 0;
39
40 while (ret >= 0 &&
41 (dc->max_frames == 0 || dc->decoder->frame_num < dc->max_frames)) {
42 ret = avcodec_receive_frame(dc->decoder, dc->frame);
43 if (ret < 0) {
44 if (ret == AVERROR_EOF) {
45 int err = dc->process_frame(dc, NULL);
46 if (err < 0)
47 return err;
48 }
49
50 return (ret == ret_done) ? 0 : ret;
51 }
52
53 ret = dc->process_frame(dc, dc->frame);
54 av_frame_unref(dc->frame);
55 if (ret < 0)
56 return ret;
57
58 if (dc->max_frames && dc->decoder->frame_num == dc->max_frames)
59 return 1;
60 }
61
62 return (dc->max_frames == 0 || dc->decoder->frame_num < dc->max_frames) ? 0 : 1;
63}
64
65int ds_run(DecodeContext *dc)
66{

Callers 1

ds_runFunction · 0.85

Calls 2

avcodec_receive_frameFunction · 0.85
av_frame_unrefFunction · 0.85

Tested by

no test coverage detected