Skip to content

Commit

Permalink
Return AVERROR_EOF from read_packet at EOF instead of 0
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lighterowl committed Mar 23, 2022
1 parent 700523c commit 91b1af0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(ret);
}

/* Conditionally free all memebers of decodecontext. */
Expand Down

0 comments on commit 91b1af0

Please sign in to comment.