mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 16:33:02 +00:00
{wscript,demux_lavf}: clean up last bits of !FFMPEG_STRICT_ABI
The bytes_read struct member in AVIOContext is now officially public, so its usage no longer has to be specified as non-compliance with FFmpeg's ABI/API rules. That said, unfortunately there was a short period of time between August 2021 and October 2021 where the struct member did not exist in FFmpeg's git master, so keep a feature check for it alive for now to enable building with those versions. Thankfully, no release version of FFmpeg will be without this field, so it should be possible to drop this check with time. Finally, simplify the function in case the struct member is not found. After all, there is zero reason to iterate through the AVIO contexts if we cannot get the information we require.
This commit is contained in:
parent
f560437594
commit
78cfeee2b9
@ -257,22 +257,20 @@ typedef struct lavf_priv {
|
||||
|
||||
static void update_read_stats(struct demuxer *demuxer)
|
||||
{
|
||||
#if !HAVE_FFMPEG_AVIOCONTEXT_BYTES_READ
|
||||
return;
|
||||
#else
|
||||
lavf_priv_t *priv = demuxer->priv;
|
||||
|
||||
for (int n = 0; n < priv->num_nested; n++) {
|
||||
struct nested_stream *nest = &priv->nested[n];
|
||||
|
||||
#if !HAVE_FFMPEG_STRICT_ABI
|
||||
// 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;
|
||||
demux_report_unbuffered_read_bytes(demuxer, new);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// At least mp4 has name="mov,mp4,m4a,3gp,3g2,mj2", so we split the name
|
||||
|
12
wscript
12
wscript
@ -412,10 +412,14 @@ FFmpeg libraries. Git master is recommended."
|
||||
'desc': 'libavdevice',
|
||||
'func': check_pkg_config('libavdevice', '>= 57.0.0'),
|
||||
}, {
|
||||
'name': '--ffmpeg-strict-abi',
|
||||
'desc': 'Disable all known FFmpeg ABI violations',
|
||||
'func': check_true,
|
||||
'default': 'enable',
|
||||
# The following should be removed in 2022 or if libavformat requirement
|
||||
# is bumped to >= 59.8.100
|
||||
'name': 'ffmpeg-aviocontext-bytes-read',
|
||||
'desc': 'FFmpeg AVIOContext bytes_read statistic field',
|
||||
'deps': 'ffmpeg',
|
||||
'func': check_statement(['libavformat/avio.h'],
|
||||
'(struct AVIOContext){ 0 }.bytes_read = 7357',
|
||||
use=['ffmpeg']),
|
||||
}
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user