shithub: aubio

Download patch

ref: a9c33a293278a0b6bc3b1122d331469bc1601865
parent: 23982aa9ec2f22b67b8aca59cc69c8d1c1ad9c57
author: Paul Brossier <piem@piem.org>
date: Tue May 3 15:18:34 EDT 2016

src/io/source_avcodec.c: check if we still need max_analyze_duration2 (closes #53, thanks to @anthonylauzon)

--- a/src/io/source_avcodec.c
+++ b/src/io/source_avcodec.c
@@ -23,8 +23,14 @@
 
 #ifdef HAVE_LIBAV
 
-// determine whether we use libavformat from ffmpe or libav
-#define FFMPEG_LIBAVFORMAT (LIBAVFORMAT_VERSION_MICRO > 99)
+// determine whether we use libavformat from ffmpeg or from libav
+#define FFMPEG_LIBAVFORMAT (LIBAVFORMAT_VERSION_MICRO > 99 )
+// max_analyze_duration2 was used from ffmpeg libavformat 55.43.100 through 57.2.100
+#define FFMPEG_LIBAVFORMAT_MAX_DUR2 FFMPEG_LIBAVFORMAT && defined( \
+      (LIBAVFORMAT_VERSION_MAJOR == 55 && LIBAVFORMAT_VERSION_MINOR >= 43) \
+      || (LIBAVFORMAT_VERSION_MAJOR == 56) \
+      || (LIBAVFORMAT_VERSION_MAJOR == 57 && LIBAVFORMAT_VERSION_MINOR < 2) \
+      )
 
 #include <libavcodec/avcodec.h>
 #include <libavformat/avformat.h>
@@ -106,7 +112,7 @@
   }
 
   // try to make sure max_analyze_duration is big enough for most songs
-#if FFMPEG_LIBAVFORMAT
+#if FFMPEG_LIBAVFORMAT_MAX_DUR2
   avFormatCtx->max_analyze_duration2 *= 100;
 #else
   avFormatCtx->max_analyze_duration *= 100;
@@ -302,7 +308,7 @@
   s->avr = avr;
   s->output = output;
 
-  av_free_packet(&avPacket);
+  av_packet_unref(&avPacket);
 }
 
 void aubio_source_avcodec_do(aubio_source_avcodec_t * s, fvec_t * read_data, uint_t * read){