summaryrefslogtreecommitdiffstats
path: root/demux/demux_lavf.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-09-19 19:14:09 +0200
committerwm4 <wm4@nowhere>2019-09-19 20:37:05 +0200
commitd75bdf070f2c1043f7eaca83c20db195a5197cb5 (patch)
treea1f5abac8a02e4f1796d7ebad158fb2ac0ad4025 /demux/demux_lavf.c
parent389f1b0ef3ebdc05d7eee31f3f8598567d3f5165 (diff)
downloadmpv-d75bdf070f2c1043f7eaca83c20db195a5197cb5.tar.bz2
mpv-d75bdf070f2c1043f7eaca83c20db195a5197cb5.tar.xz
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.
Diffstat (limited to 'demux/demux_lavf.c')
-rw-r--r--demux/demux_lavf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index ad2e6df6ea..1730d79716 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -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;