summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile24
-rw-r--r--src/player.c20
2 files changed, 21 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index b228a5e..3d1d151 100644
--- a/Makefile
+++ b/Makefile
@@ -6,13 +6,6 @@ LIBDIR:=${PREFIX}/lib
INCDIR:=${PREFIX}/include
MANDIR:=${PREFIX}/share/man
DYNLINK:=0
-# Choose the libav implementation your system is using by uncommenting one line
-# below. These versions are supported:
-#LIBAV:=ffmpeg2.2
-#LIBAV:=ffmpeg2.1
-#LIBAV:=ffmpeg1.2
-#LIBAV:=libav10
-#LIBAV:=libav9
# Respect environment variables set by user; does not work with :=
ifeq (${CFLAGS},)
@@ -92,25 +85,10 @@ LIBGCRYPT_LDFLAGS:=-lgcrypt
LIBJSONC_CFLAGS:=$(shell pkg-config --cflags json-c 2>/dev/null || pkg-config --cflags json)
LIBJSONC_LDFLAGS:=$(shell pkg-config --libs json-c 2>/dev/null || pkg-config --libs json)
-# libav* quirks
-ifeq (${LIBAV}, ffmpeg2.2)
-EXTRA_CFLAGS:=-DHAVE_AVFILTER_GRAPH_SEND_COMMAND
-else ifeq (${LIBAV}, ffmpeg2.1)
-EXTRA_CFLAGS:=
-else ifeq (${LIBAV}, ffmpeg1.2)
-EXTRA_CFLAGS:=-DHAVE_AV_BUFFERSINK_GET_BUFFER_REF -DHAVE_LIBAVFILTER_AVCODEC_H
-else ifeq (${LIBAV}, libav10)
-EXTRA_CFLAGS:=
-else ifeq (${LIBAV}, libav9)
-EXTRA_CFLAGS:=
-else
-$(error Please choose a valid libav implementation at the top of this file)
-endif
-
# combine all flags
ALL_CFLAGS:=${CFLAGS} -I ${LIBPIANO_INCLUDE} -I ${LIBWAITRESS_INCLUDE} \
${LIBAV_CFLAGS} ${LIBGNUTLS_CFLAGS} \
- ${LIBGCRYPT_CFLAGS} ${LIBJSONC_CFLAGS} ${EXTRA_CFLAGS}
+ ${LIBGCRYPT_CFLAGS} ${LIBJSONC_CFLAGS}
ALL_LDFLAGS:=${LDFLAGS} -lao -lpthread -lm \
${LIBAV_LDFLAGS} ${LIBGNUTLS_LDFLAGS} \
${LIBGCRYPT_LDFLAGS} ${LIBJSONC_LDFLAGS}
diff --git a/src/player.c b/src/player.c
index b82a3aa..fba1d47 100644
--- a/src/player.c
+++ b/src/player.c
@@ -31,6 +31,26 @@ THE SOFTWARE.
#include <assert.h>
#include <arpa/inet.h>
+/* ffmpeg/libav quirks
+ * ffmpeg’s micro versions always start at 100, that’s how we can distinguish
+ * ffmpeg and libav */
+#include <libavfilter/version.h>
+/* ffmpeg 2.2 */
+#if LIBAVFILTER_VERSION_MAJOR == 4 && \
+ LIBAVFILTER_VERSION_MINOR <= 2 && \
+ LIBAVFILTER_VERSION_MICRO >= 100
+#define HAVE_AVFILTER_GRAPH_SEND_COMMAND
+#endif
+
+/* ffmpeg 1.2 */
+#if LIBAVFILTER_VERSION_MAJOR == 3 && \
+ LIBAVFILTER_VERSION_MINOR <= 42 && \
+ LIBAVFILTER_VERSION_MINOR > 32 && \
+ LIBAVFILTER_VERSION_MICRO >= 100
+#define HAVE_AV_BUFFERSINK_GET_BUFFER_REF
+#define HAVE_LIBAVFILTER_AVCODEC_H
+#endif
+
#include <ao/ao.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>