mirror of https://github.com/mpv-player/mpv
build: add --enable-ffmpeg-strict-abi option
This can be used by distros to disable all known FFmpeg ABI violations. Currently only 1 is known, in demux_lavf.c. In addition to if-defing out the access to the private FFmpeg field, this disables the possibly fragile nested open callbacks, which make sense only if the aforementioned field can be accessed.
This commit is contained in:
parent
5dba244c22
commit
9565ff522b
|
@ -247,6 +247,7 @@ static void update_read_stats(struct demuxer *demuxer)
|
||||||
for (int n = 0; n < priv->num_nested; n++) {
|
for (int n = 0; n < priv->num_nested; n++) {
|
||||||
struct nested_stream *nest = &priv->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.
|
// 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
|
// This is fully intentional - there is no other way to get this
|
||||||
// information (not even by custom I/O, because the connection reuse
|
// information (not even by custom I/O, because the connection reuse
|
||||||
|
@ -255,6 +256,7 @@ static void update_read_stats(struct demuxer *demuxer)
|
||||||
int64_t new = cur - nest->last_bytes;
|
int64_t new = cur - nest->last_bytes;
|
||||||
nest->last_bytes = cur;
|
nest->last_bytes = cur;
|
||||||
demux_report_unbuffered_read_bytes(demuxer, new);
|
demux_report_unbuffered_read_bytes(demuxer, new);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -970,8 +972,10 @@ static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check)
|
||||||
if (demuxer->access_references) {
|
if (demuxer->access_references) {
|
||||||
priv->default_io_open = avfc->io_open;
|
priv->default_io_open = avfc->io_open;
|
||||||
priv->default_io_close = avfc->io_close;
|
priv->default_io_close = avfc->io_close;
|
||||||
|
#if !HAVE_FFMPEG_STRICT_ABI
|
||||||
avfc->io_open = nested_io_open;
|
avfc->io_open = nested_io_open;
|
||||||
avfc->io_close = nested_io_close;
|
avfc->io_close = nested_io_close;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
avfc->io_open = block_io_open;
|
avfc->io_open = block_io_open;
|
||||||
}
|
}
|
||||||
|
|
4
wscript
4
wscript
|
@ -490,6 +490,10 @@ FFmpeg/Libav libraries. Git master is recommended."
|
||||||
'name': '--libavdevice',
|
'name': '--libavdevice',
|
||||||
'desc': 'libavdevice',
|
'desc': 'libavdevice',
|
||||||
'func': check_pkg_config('libavdevice', '>= 57.0.0'),
|
'func': check_pkg_config('libavdevice', '>= 57.0.0'),
|
||||||
|
}, {
|
||||||
|
'name': '--ffmpeg-strict-abi',
|
||||||
|
'desc': 'Disable all known FFmpeg ABI violations',
|
||||||
|
'default': 'disable',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue