1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-10 19:51:43 +00:00

demux_lavf: document intentional FFmpeg API violation

This field is documented as internal, so an API user should not
access it. However, this is the only way to get some read statistics
without replacing FFmpeg's entire HLS demuxer. (Using custom I/O as
workaround doesn't work: the HLS code uses some weird internal APIs
that cannot be provided by FFmpeg API users; I even made the author
of the relevant patch to provide a public API, but which was shot
down by another FFmpeg developer. So I take this as my right to
access this field.)

Mention this explicitly, as it affects ABI and API compatibility, and
I don't want that anyone claims this was a "mistake". Add some
explanations.
This commit is contained in:
wm4 2019-09-19 19:14:09 +02:00
parent 389f1b0ef3
commit d75bdf070f

View File

@ -250,6 +250,10 @@ static void update_read_stats(struct demuxer *demuxer)
for (int n = 0; n < priv->num_nested; n++) {
struct nested_stream *nest = &priv->nested[n];
// Note: accessing the bytes_read field is not allowed by FFmpeg's API.
// This is fully intentional - there is no other way to get this
// information (not even by custom I/O, because the connection reuse
// mechanism by the HLS demuxer would get disabled).
int64_t cur = nest->id->bytes_read;
int64_t new = cur - nest->last_bytes;
nest->last_bytes = cur;