From d75bdf070f2c1043f7eaca83c20db195a5197cb5 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 19 Sep 2019 19:14:09 +0200 Subject: 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. --- demux/demux_lavf.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'demux/demux_lavf.c') 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; -- cgit v1.2.3