From c0db930de43d3910783e4c10f6c71c4350909636 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 30 May 2013 19:55:15 +0200 Subject: [PATCH] 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. --- demux/demux_mkv.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 #include +#include + #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 } }