From 91b1af08cca4e22db89542141372b26f1f8f30bc Mon Sep 17 00:00:00 2001 From: Daniel Kamil Kozar Date: Wed, 23 Mar 2022 23:10:13 +0100 Subject: [PATCH] Return AVERROR_EOF from read_packet at EOF instead of 0 ffmpeg's examples/avio_reading.c does that as well, and looking through that file's history reveals that this return was added in 2017. I presume something must've changed in libav* internals but this shouldn't break older ffmpegs. --- src/core/decode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/decode.cpp b/src/core/decode.cpp index c38e81a..a7da59e 100644 --- a/src/core/decode.cpp +++ b/src/core/decode.cpp @@ -117,7 +117,7 @@ static int read_packet(void *opaque, uint8_t *buf, int size) ret += fread(buf + ret, 1, size - ret, ctx->files[ctx->cur_file]); } - return ((int) ret); + return ret == 0 ? AVERROR_EOF : static_cast(ret); } /* Conditionally free all memebers of decodecontext. */