summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2014-03-31 17:35:28 +0200
committerLars-Dominik Braun <lars@6xq.net>2014-03-31 20:20:22 +0200
commitc872f00508ce4afe3b8ec863b23595c31fd8b4be (patch)
treec441d537a5ead0d659bb05e83e8b4bd7d4066f87 /Makefile
parent8e685c992516834e35bcccea1f61c39a9d847e2f (diff)
downloadpianobar-c872f00508ce4afe3b8ec863b23595c31fd8b4be.tar.gz
pianobar-c872f00508ce4afe3b8ec863b23595c31fd8b4be.tar.bz2
pianobar-c872f00508ce4afe3b8ec863b23595c31fd8b4be.zip
Use libav/ffmpeg for audio decoding
libav 9.12 and ffmpeg 2.2 have been tested. Here’s why: My mp4 “parser” *cough* never was a mp4 parser in the sense that it actually understood the file format. Instead it grepped the input stream for “magic” strings (section identifiers). That alone should be sufficient to throw away the code and rewrite it. Additionally libfaad2 has not been updated for ages. I guess it was abandoned in favor of libav/ffmpeg. With libav/ffmpeg, which we support both as long as the API’s don’t diverge too much, pianobar gains fast and reliable AAC and MP3 decoding without bothering too much about the details. Most users will have it installed already. On my own machine libav consumes about 2/3 CPU time compared to the previous solution when playing AAC. Unfortunately memory usage doubled and my attempts to disable unused protocols/formats/codec failed due to libav’s API limitations. While cleaning up a small detail regarding the eventcmd API has changed too: Song duration and position are measured in seconds instead of milliseconds now. Since libav/ffmpeg keeps track of accurate timing the precision pianobar keeps track of can be reduced, while still being sufficient for most users.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 7 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 2867da1..2267419 100644
--- a/Makefile
+++ b/Makefile
@@ -73,22 +73,8 @@ LIBWAITRESS_INCLUDE:=${LIBWAITRESS_DIR}
LIBWAITRESS_TEST_SRC=${LIBWAITRESS_DIR}/waitress-test.c
LIBWAITRESS_TEST_OBJ:=${LIBWAITRESS_TEST_SRC:.c=.o}
-ifeq (${DISABLE_FAAD}, 1)
- LIBFAAD_CFLAGS:=
- LIBFAAD_LDFLAGS:=
-else
- LIBFAAD_CFLAGS:=-DENABLE_FAAD
- LIBFAAD_LDFLAGS:=-lfaad
-endif
-
-ifeq (${DISABLE_MAD}, 1)
- LIBMAD_CFLAGS:=
- LIBMAD_LDFLAGS:=
-else
- LIBMAD_CFLAGS:=-DENABLE_MAD
- LIBMAD_CFLAGS+=$(shell pkg-config --cflags mad)
- LIBMAD_LDFLAGS:=$(shell pkg-config --libs mad)
-endif
+LIBAV_CFLAGS=$(shell pkg-config --cflags libavcodec libavformat libavutil libavfilter)
+LIBAV_LDFLAGS=$(shell pkg-config --libs libavcodec libavformat libavutil libavfilter)
LIBGNUTLS_CFLAGS:=$(shell pkg-config --cflags gnutls)
LIBGNUTLS_LDFLAGS:=$(shell pkg-config --libs gnutls)
@@ -104,15 +90,14 @@ ifeq (${DYNLINK},1)
pianobar: ${PIANOBAR_OBJ} ${PIANOBAR_HDR} libpiano.so.0
@echo " LINK $@"
@${CC} -o $@ ${PIANOBAR_OBJ} ${LDFLAGS} -lao -lpthread -lm -L. -lpiano \
- ${LIBFAAD_LDFLAGS} ${LIBMAD_LDFLAGS} ${LIBGNUTLS_LDFLAGS} \
- ${LIBGCRYPT_LDFLAGS}
+ ${LIBAV_LDFLAGS} ${LIBGNUTLS_LDFLAGS} ${LIBGCRYPT_LDFLAGS}
else
pianobar: ${PIANOBAR_OBJ} ${PIANOBAR_HDR} ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ} \
${LIBWAITRESS_HDR}
@echo " LINK $@"
@${CC} ${CFLAGS} ${LDFLAGS} ${PIANOBAR_OBJ} ${LIBPIANO_OBJ} \
${LIBWAITRESS_OBJ} -lao -lpthread -lm \
- ${LIBFAAD_LDFLAGS} ${LIBMAD_LDFLAGS} ${LIBGNUTLS_LDFLAGS} \
+ ${LIBAV_LDFLAGS} ${LIBGNUTLS_LDFLAGS} \
${LIBGCRYPT_LDFLAGS} ${LIBJSONC_LDFLAGS} -o $@
endif
@@ -134,7 +119,7 @@ libpiano.so.0: ${LIBPIANO_RELOBJ} ${LIBPIANO_HDR} ${LIBWAITRESS_RELOBJ} \
%.d: %.c
@set -e; rm -f $@; \
$(CC) -M ${CFLAGS} -I ${LIBPIANO_INCLUDE} -I ${LIBWAITRESS_INCLUDE} \
- ${LIBFAAD_CFLAGS} ${LIBMAD_CFLAGS} ${LIBGNUTLS_CFLAGS} \
+ ${LIBAV_CFLAGS} ${LIBGNUTLS_CFLAGS} \
${LIBGCRYPT_CFLAGS} ${LIBJSONC_CFLAGS} $< > $@.$$$$; \
sed '1 s,^.*\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
@@ -147,7 +132,7 @@ libpiano.so.0: ${LIBPIANO_RELOBJ} ${LIBPIANO_HDR} ${LIBWAITRESS_RELOBJ} \
%.o: %.c
@echo " CC $<"
@${CC} ${CFLAGS} -I ${LIBPIANO_INCLUDE} -I ${LIBWAITRESS_INCLUDE} \
- ${LIBFAAD_CFLAGS} ${LIBMAD_CFLAGS} ${LIBGNUTLS_CFLAGS} \
+ ${LIBAV_CFLAGS} ${LIBGNUTLS_CFLAGS} \
${LIBGCRYPT_CFLAGS} ${LIBJSONC_CFLAGS} -c -o $@ $<
# create position independent code (for shared libraries)
@@ -168,10 +153,9 @@ all: pianobar
debug: pianobar
debug: CC=clang
-debug: CFLAGS=-Wall -Wextra \
+debug: CFLAGS=-g -Wall -Wextra \
-pedantic \
-Wno-unused-parameter \
- -fsanitize=address \
-fsanitize=integer \
-fsanitize=undefined \
-fsanitize=alignment \