summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-05-30 19:55:15 +0200
committerwm4 <wm4@nowhere>2013-05-30 19:55:15 +0200
commitc0db930de43d3910783e4c10f6c71c4350909636 (patch)
treef4d54feb165510ff8106cd0235dd59bbd7fd8695 /demux
parent3f3531f5607cd973488260aa00c752c3a74496a5 (diff)
downloadmpv-c0db930de43d3910783e4c10f6c71c4350909636.tar.bz2
mpv-c0db930de43d3910783e4c10f6c71c4350909636.tar.xz
demux_mkv: make sure wavpacks works with older libavcodec versions
The new wavpack packet format (see previous commit) doesn't work with older libavcodec versions, so disable the new code in this case. The version numbers are only approximate, since the libavcodec version wasn't bumped with the wavpack change, but it's close enough.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_mkv.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index 4b0decff1a..f2f558fb69 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -33,6 +33,8 @@
#include <libavutil/intreadwrite.h>
#include <libavutil/avstring.h>
+#include <libavcodec/version.h>
+
#include "config.h"
#if CONFIG_ZLIB
@@ -73,6 +75,17 @@ static const int cook_fl2bps[COOK_FLAVORS] = {
12016, 16408, 22911, 33506
};
+#define IS_LIBAV_FORK (LIBAVCODEC_VERSION_MICRO < 100)
+
+// Both of these versions were bumped by unrelated commits.
+#if (IS_LIBAV_FORK && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 7, 1)) || \
+ (!IS_LIBAV_FORK && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 12, 101))
+#define NEED_WAVPACK_PARSE 1
+#else
+#define NEED_WAVPACK_PARSE 0
+#endif
+
+
enum {
MAX_NUM_LACES = 256,
};
@@ -2140,12 +2153,14 @@ fail:
static void mkv_parse_packet(mkv_track_t *track, bstr *buffer)
{
if (track->a_formattag == mmioFOURCC('W', 'V', 'P', 'K')) {
+#if NEED_WAVPACK_PARSE
int size = buffer->len;
uint8_t *parsed;
if (libav_parse_wavpack(track, buffer->start, &parsed, &size) >= 0) {
buffer->start = parsed;
buffer->len = size;
}
+#endif
}
}