summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-02-10 23:28:10 +0100
committerwm4 <wm4@nowhere>2014-02-10 23:28:10 +0100
commit2868fbea3f177747316bec4444abfd0e8db5b806 (patch)
tree02c6cdad34a5c1b9dcb5d1fa878525d07c350928
parent476a4a378a61f661a99d06137b5bee98eeb72fed (diff)
downloadmpv-2868fbea3f177747316bec4444abfd0e8db5b806.tar.bz2
mpv-2868fbea3f177747316bec4444abfd0e8db5b806.tar.xz
av_log: add tons of warnings against mismatched ffmpeg/libav libraries
Print a warning if a library has mismatched compile time and link time versions. Refuse to work if the compile time and link time versions are a mix of ffmpeg and libav. We print an error message and call exit(). Since we'd randomly crash anyway, I think this is ok. This doesn't catch the case if you e.g. use a ffmpeg libavcodec and a libav libavformat, which would of course just crash as quickly, but I think this checks enough already.
-rw-r--r--common/av_log.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/common/av_log.c b/common/av_log.c
index d043488979..5599ca0584 100644
--- a/common/av_log.c
+++ b/common/av_log.c
@@ -208,14 +208,36 @@ void print_libav_versions(struct mp_log *log, int v)
mp_msg(log, v, "%s library versions:\n", LIB_PREFIX);
+ bool mismatch = false;
+ bool broken = false;
for (int n = 0; n < MP_ARRAY_SIZE(libs); n++) {
const struct lib *l = &libs[n];
mp_msg(log, v, " %-15s %d.%d.%d", l->name, V(l->buildv));
if (l->buildv != l->runv) {
mp_msg(log, v, " (runtime %d.%d.%d)", V(l->runv));
+ mismatch = true;
+ broken |= ((l->buildv & 255) >= 100) != ((l->runv & 255) >= 100);
}
mp_msg(log, v, "\n");
}
+ // This just won't work. It's 100% broken.
+ if (broken) {
+ mp_fatal(log, "mpv was compiled and linked against a mixture of Libav "
+ "and FFmpeg versions. This won't work and will most likely "
+ "crash at some point. Exiting.\n");
+ exit(42);
+ }
+ // We don't "really" support mismatched libraries, but if you like to
+ // suffer, you're free to enjoy the terrible aspects of dynamic linking.
+ // In particular, we don't use all these crazy accessors ffmpeg wants us
+ // to use in order to be ABI compatible after Libav merges - because that
+ // would make our code incompatible to Libav. It's madness.
+ if (mismatch) {
+ mp_warn(log, "Warning: mpv was compiled against a different version of "
+ "%s than the shared\nlibrary it is linked against. This can "
+ "expose subtle ABI compatibility issues\nand can lead to "
+ "misbehavior and crashes.\n", LIB_PREFIX);
+ }
}
#undef V