mirror of https://github.com/mpv-player/mpv
player: rearrange libav* library check
No need to be nice. Also hopefully breaks idiotic distro patches.
This commit is contained in:
parent
d0d9ace421
commit
62c1d79724
|
@ -176,7 +176,7 @@ struct lib {
|
||||||
unsigned runv;
|
unsigned runv;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool print_libav_versions(struct mp_log *log, int v)
|
void check_library_versions(struct mp_log *log, int v)
|
||||||
{
|
{
|
||||||
const struct lib libs[] = {
|
const struct lib libs[] = {
|
||||||
{"libavutil", LIBAVUTIL_VERSION_INT, avutil_version()},
|
{"libavutil", LIBAVUTIL_VERSION_INT, avutil_version()},
|
||||||
|
@ -189,21 +189,22 @@ bool print_libav_versions(struct mp_log *log, int v)
|
||||||
|
|
||||||
mp_msg(log, v, "FFmpeg library versions:\n");
|
mp_msg(log, v, "FFmpeg library versions:\n");
|
||||||
|
|
||||||
bool mismatch = false;
|
|
||||||
for (int n = 0; n < MP_ARRAY_SIZE(libs); n++) {
|
for (int n = 0; n < MP_ARRAY_SIZE(libs); n++) {
|
||||||
const struct lib *l = &libs[n];
|
const struct lib *l = &libs[n];
|
||||||
mp_msg(log, v, " %-15s %d.%d.%d", l->name, V(l->buildv));
|
mp_msg(log, v, " %-15s %d.%d.%d", l->name, V(l->buildv));
|
||||||
if (l->buildv != l->runv) {
|
if (l->buildv != l->runv)
|
||||||
mp_msg(log, v, " (runtime %d.%d.%d)", V(l->runv));
|
mp_msg(log, v, " (runtime %d.%d.%d)", V(l->runv));
|
||||||
mismatch = l->buildv > l->runv ||
|
|
||||||
AV_VERSION_MAJOR(l->buildv) != AV_VERSION_MAJOR(l->runv);
|
|
||||||
}
|
|
||||||
mp_msg(log, v, "\n");
|
mp_msg(log, v, "\n");
|
||||||
|
if (l->buildv > l->runv ||
|
||||||
|
AV_VERSION_MAJOR(l->buildv) != AV_VERSION_MAJOR(l->runv))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%s: %d.%d.%d -> %d.%d.%d\n",
|
||||||
|
l->name, V(l->buildv), V(l->runv));
|
||||||
|
abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_msg(log, v, "FFmpeg version: %s\n", av_version_info());
|
mp_msg(log, v, "FFmpeg version: %s\n", av_version_info());
|
||||||
|
|
||||||
return !mismatch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef V
|
#undef V
|
||||||
|
|
|
@ -7,5 +7,5 @@ struct mpv_global;
|
||||||
struct mp_log;
|
struct mp_log;
|
||||||
void init_libav(struct mpv_global *global);
|
void init_libav(struct mpv_global *global);
|
||||||
void uninit_libav(struct mpv_global *global);
|
void uninit_libav(struct mpv_global *global);
|
||||||
bool print_libav_versions(struct mp_log *log, int v);
|
void check_library_versions(struct mp_log *log, int v);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -144,7 +144,7 @@ void mp_print_version(struct mp_log *log, int always)
|
||||||
int v = always ? MSGL_INFO : MSGL_V;
|
int v = always ? MSGL_INFO : MSGL_V;
|
||||||
mp_msg(log, v, "%s %s\n built on %s\n",
|
mp_msg(log, v, "%s %s\n built on %s\n",
|
||||||
mpv_version, mpv_copyright, mpv_builddate);
|
mpv_version, mpv_copyright, mpv_builddate);
|
||||||
print_libav_versions(log, v);
|
check_library_versions(log, v);
|
||||||
mp_msg(log, v, "\n");
|
mp_msg(log, v, "\n");
|
||||||
// Only in verbose mode.
|
// Only in verbose mode.
|
||||||
if (!always) {
|
if (!always) {
|
||||||
|
@ -371,17 +371,7 @@ int mp_initialize(struct MPContext *mpctx, char **options)
|
||||||
if (handle_help_options(mpctx))
|
if (handle_help_options(mpctx))
|
||||||
return 1; // help
|
return 1; // help
|
||||||
|
|
||||||
if (!print_libav_versions(mp_null_log, 0)) {
|
check_library_versions(mp_null_log, 0);
|
||||||
// This happens only if the runtime FFmpeg version is lower than the
|
|
||||||
// build version, which will not work according to FFmpeg's ABI rules.
|
|
||||||
// This does not happen if runtime FFmpeg is newer, which is compatible.
|
|
||||||
print_libav_versions(mpctx->log, MSGL_FATAL);
|
|
||||||
MP_FATAL(mpctx, "\nmpv was compiled against an incompatible version of "
|
|
||||||
"FFmpeg/Libav than the shared\nlibrary it is linked against. "
|
|
||||||
"This is most likely a broken build and could\nresult in "
|
|
||||||
"misbehavior and crashes.\n\nThis is a broken build.\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if HAVE_TESTS
|
#if HAVE_TESTS
|
||||||
if (opts->test_mode && opts->test_mode[0])
|
if (opts->test_mode && opts->test_mode[0])
|
||||||
|
|
Loading…
Reference in New Issue