Procházet zdrojové kódy

Merge pull request #1573 from thess/squeeze-import

squeezelite: Import new package
Ted Hess před 9 roky
rodič
revize
892c0ffcef

+ 146
- 0
sound/squeezelite/Makefile Zobrazit soubor

@@ -0,0 +1,146 @@
1
+#
2
+# Copyright (C) 2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=squeezelite
11
+PKG_VERSION:=1.8
12
+PKG_RELEASE=1
13
+
14
+PKG_LICENSE:=GPL-3.0
15
+PKG_LICENSE_FILES:=LICENSE.txt
16
+PKG_MAINTAINER:= Ted Hess <thess@kitschensync.net>
17
+
18
+PKG_SOURCE_PROTO:=git
19
+PKG_SOURCE_URL:=https://code.google.com/p/squeezelite/
20
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
21
+PKG_SOURCE_VERSION:=8b8dfe6918ebe45ade5f3d9b68d453d7b8128d99
22
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
23
+
24
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
25
+
26
+PKG_BUILD_DEPENDS:=libflac libvorbis libmad libfaad2 SQUEEZELITE_WMA:libffmpeg-audio-dec
27
+
28
+include $(INCLUDE_DIR)/package.mk
29
+
30
+define Package/squeezelite/default
31
+    SECTION:=sound
32
+    CATEGORY:=Sound
33
+    TITLE:=Headless squeezebox emulator
34
+    PROVIDES:=squeezelite
35
+    URL:=https://code.google.com/p/squeezelite/
36
+    DEPENDS:= +alsa-lib +SQUEEZELITE_RESAMPLE:libsoxr
37
+    MENU:=1
38
+endef
39
+
40
+define Package/squeezelite-full
41
+    $(call Package/squeezelite/default)
42
+    TITLE+= (full)
43
+    DEPENDS+= +libflac +libvorbis +libmad +libfaad2 \
44
+              +SQUEEZELITE_WMA:libffmpeg-audio-dec
45
+    VARIANT:=full
46
+endef
47
+
48
+define Package/squeezelite-mini
49
+    $(call Package/squeezelite/default)
50
+    TITLE+= (minimal)
51
+    VARIANT:=mini
52
+endef
53
+
54
+define Package/squeezelite/config/default
55
+
56
+	config SQUEEZELITE_WMA
57
+	    bool "WMA/ALAC decode support"
58
+	    help
59
+		Include WMA and ALAC decoding using ffmpeg
60
+	    default n
61
+
62
+	config SQUEEZELITE_RESAMPLE
63
+	    bool "Resample support"
64
+	    help
65
+		Include support for resampling using libsoxr
66
+	    default n
67
+
68
+	config SQUEEZELITE_DSD
69
+	    bool "DSD playback over PCM (DoP)"
70
+	    help
71
+		Include support for DSD over PCM for compatible DAC"
72
+	    default n
73
+endef
74
+
75
+define Package/squeezelite-full/config
76
+    if PACKAGE_squeezelite-full
77
+	$(call Package/squeezelite/config/default)
78
+    endif
79
+endef
80
+
81
+define Package/squeezelite-mini/config
82
+    if PACKAGE_squeezelite-mini
83
+	$(call Package/squeezelite/config/default)
84
+    endif
85
+endef
86
+
87
+define Package/squeezelite/description/default
88
+    Squeezelite is a small headless squeezebox emulator for linux using alsa audio output 
89
+    It is aimed at supporting high quality audio at multiple sample rates including 
90
+    44.1/48/88.2/96/176.4/192k/352.8/384kHz 
91
+    Supported codecs: mp3, flac, ogg, aac, (wma and alac via ffmpeg) 
92
+    Native support for PCM builtin
93
+    Optional support of DSD playback via PCM for DoP capable DAC
94
+    Optional resampling to match sound device
95
+endef
96
+
97
+define Package/squeezelite/description
98
+    $(call Package/squeezelite/description/default)
99
+    .
100
+    This package has all the audio codecs compiled in.
101
+endef
102
+
103
+define Package/squeezelite-mini/description
104
+    $(call Package/squeezelite/description/default)
105
+    .
106
+    This package will dynamically load installed codecs.
107
+endef
108
+
109
+#ifeq ($(CONFIG_SQUEEZELITE_WMA),y)
110
+#    PKG_BUILD_DEPENDS+= libffmpeg-audio-dec
111
+#endif
112
+
113
+TARGET_CFLAGS+= -Wall -fPIC -O2 -DSELFPIPE
114
+
115
+ifeq ($(CONFIG_SQUEEZELITE_WMA),y)
116
+    TARGET_CFLAGS+= -DFFMPEG
117
+endif
118
+
119
+ifeq ($(CONFIG_SQUEEZELITE_DSD),y)
120
+    TARGET_CFLAGS+= -DDSD
121
+endif
122
+
123
+ifeq ($(CONFIG_SQUEEZELITE_RESAMPLE),y)
124
+    TARGET_CFLAGS+= -DRESAMPLE
125
+endif
126
+
127
+TARGET_LDFLAGS+= -lasound -lpthread -lm -lrt
128
+
129
+ifeq ($(BUILD_VARIANT),full)
130
+    TARGET_CFLAGS+= -DLINKALL
131
+endif
132
+
133
+define Package/squeezelite/install
134
+	$(INSTALL_DIR) $(1)/usr/bin
135
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/squeezelite $(1)/usr/bin
136
+	$(INSTALL_DIR) $(1)/etc/init.d
137
+	$(INSTALL_BIN) ./files/squeezelite.init $(1)/etc/init.d/squeezelite
138
+	$(INSTALL_DIR) $(1)/etc/config
139
+	$(INSTALL_CONF) ./files/squeezelite.conf $(1)/etc/config/squeezelite
140
+endef
141
+
142
+Package/squeezelite-mini/install=$(Package/squeezelite/install)
143
+Package/squeezelite-full/install=$(Package/squeezelite/install)
144
+
145
+$(eval $(call BuildPackage,squeezelite-mini))
146
+$(eval $(call BuildPackage,squeezelite-full))

+ 12
- 0
sound/squeezelite/files/squeezelite.conf Zobrazit soubor

@@ -0,0 +1,12 @@
1
+
2
+config options 'options'
3
+	option name 'SqueezeWrt'
4
+	option model_name 'SqueezeLite'
5
+	option close_delay '0'
6
+	option priority '0'
7
+	option max_sr '0'
8
+	option device 'hw:0,0'
9
+	option decoder_auto_conf '1'
10
+	option dsd_over_pcm '0'
11
+	option ircontrol '0'
12
+	option enabled '1'

+ 134
- 0
sound/squeezelite/files/squeezelite.init Zobrazit soubor

@@ -0,0 +1,134 @@
1
+#!/bin/sh /etc/rc.common
2
+# Copyright (C) 2015 OpenWrt.org
3
+
4
+START=99
5
+STOP=1
6
+
7
+USE_PROCD=1
8
+PROG=/usr/bin/squeezelite
9
+
10
+#
11
+# Auto config checks for existing codec installations if not specified in config
12
+# Explicit disable (override) by setting appropriate "decode_xxx" in config
13
+#
14
+checkcodec() {
15
+	config_get_bool auto_conf options "decoder_auto_conf" 1
16
+	config_get_bool codec options "$1" $auto_conf
17
+	
18
+	if [ $codec -ne 0 ] ; then 
19
+		if [ $auto_conf -eq 0 ] ; then
20
+			#force use requested
21
+			echo "$4"
22
+		else
23
+			if [ -e "/usr/lib/${2}" ] ; then
24
+				# Use codec (it exists)
25
+				echo "$4"
26
+			else
27
+ 				#exclude non-existant
28
+			        if [ -z "$4" ] ; then
29
+			                echo "-e $3"
30
+			        else
31
+			                echo "$4,$3"
32
+			        fi
33
+			fi
34
+		fi
35
+	else
36
+		# explicitly excluded
37
+	        if [ -z "$4" ] ; then
38
+	                echo "-e $3"
39
+	        else
40
+	                echo "$4,$3"
41
+	        fi
42
+	fi
43
+}
44
+
45
+make_cmdline() {
46
+	cmdline=""
47
+
48
+	config_get name options name "SqueezeWrt"
49
+	cmdline="$cmdline -n $name"
50
+
51
+	config_get model_name options model_name "SqueezeLite"
52
+	cmdline="$cmdline -M $model_name"
53
+
54
+	config_get device options device ""
55
+	[ -n $device ] && cmdline="$cmdline -o $device"
56
+
57
+	config_get alsa_buffer options alsa_buffer 200
58
+	[ $alsa_buffer -eq 0 ] && alsa_buffer="200"
59
+    
60
+	config_get alsa_period options alsa_period 4
61
+	[ $alsa_period -eq 0 ] && alsa_period="4"
62
+    
63
+	config_get alsa_format options alsa_format 16
64
+	[ $alsa_format = "0" ] && alsa_format="16"
65
+
66
+	config_get alsa_mmap options alsa_mmap 0
67
+	cmdline="$cmdline -a $alsa_buffer:$alsa_period:$alsa_format:$alsa_mmap"
68
+
69
+	config_get stream_bufsiz options stream_bufsiz 2048
70
+	config_get out_bufsiz options out_bufsiz 3763
71
+	cmdline="$cmdline -b $stream_bufsiz:$out_bufsiz"
72
+
73
+	config_get max_sr options max_sr 0
74
+	if [ $max_sr -ne 0 ] ; then
75
+		max_sr="-r $max_sr"
76
+
77
+		config_get sr_delay options sr_delay 0
78
+		[ $sr_delay -ne 0 ] && 	max_sr="$max_sr:$sr_delay"
79
+		cmdline="$cmdline $max_sr"
80
+	fi
81
+
82
+
83
+	config_get close_delay options close_delay 0
84
+	[ $close_delay -ne 0 ] && cmdline="$cmdline -C $close_delay"
85
+
86
+	config_get server_addr options server_addr ""
87
+	if [ -n "$server_addr" ] ; then
88
+		config_get server_port options server_port 3483
89
+		cmdline="$cmdline -s $server_addr:$server_port"
90
+	fi
91
+
92
+	config_get priority options priority 0
93
+	[ $priority -ne 0 ] && cmdline="$cmdline -p $priority"
94
+
95
+	#
96
+	# ***NOTE: codec lib names are in squeezelite.h (set decode_auto_conf to 0 to ignore)
97
+	#
98
+	local excl_codecs=""
99
+	excl_codecs=`checkcodec decode_flac "libFLAC.so.8" flac "$excl_codecs"`
100
+	excl_codecs=`checkcodec decode_mp3 "libmad.so.0" mp3 "$excl_codecs"`
101
+	excl_codecs=`checkcodec decode_aac "libfaad.so.2" aac "$excl_codecs"`
102
+	excl_codecs=`checkcodec decode_ogg "libvorbisfile.so.3" ogg "$excl_codecs"`
103
+	excl_codecs=`checkcodec decode_wma_alac "libavcodec.so.56" wma,alac "$excl_codecs"`
104
+	cmdline="$cmdline $excl_codecs"
105
+
106
+	config_get dop options dsd_over_pcm 0
107
+	[ $dop -eq 1 ] && cmdline="$cmdline -D"
108
+}
109
+
110
+start_service() {
111
+	config_load squeezelite
112
+
113
+	config_get_bool enabled options 'enabled' 0
114
+	[ $enabled -eq 0 ] && return
115
+
116
+	# Build command params
117
+	make_cmdline
118
+
119
+	procd_open_instance
120
+	logger -t 'squeezelite' "$cmdline"
121
+	procd_set_param command "$PROG" $cmdline
122
+	procd_close_instance
123
+}
124
+
125
+# Wait for service to exit and release sockets
126
+reload_service() {
127
+	stop
128
+	sleep 2
129
+	start
130
+}
131
+
132
+restart() {
133
+	reload_service
134
+}

+ 56
- 0
sound/squeezelite/patches/005-respect_LDFLAGS.patch Zobrazit soubor

@@ -0,0 +1,56 @@
1
+From 1c53ed7db5b49ebf347efe65dbf9b740f9d54557 Mon Sep 17 00:00:00 2001
2
+From: Carlo Landmeter <clandmeter@gmail.com>
3
+Date: Tue, 31 Mar 2015 09:52:53 +0000
4
+Subject: [PATCH] respect LDFLAGS
5
+
6
+---
7
+ Makefile | 17 +++++++++--------
8
+ 1 file changed, 9 insertions(+), 8 deletions(-)
9
+
10
+--- a/Makefile
11
++++ b/Makefile
12
+@@ -1,6 +1,7 @@
13
+ # Cross compile support - create a Makefile which defines these three variables and then includes this Makefile...
14
+-CFLAGS  ?= -Wall -fPIC -O2 $(OPTS)
15
+-LDFLAGS ?= -lasound -lpthread -lm -lrt
16
++CFLAGS  ?= -Wall -O2
17
++CFLAGS  += -fPIC $(OPTS)
18
++LIBS ?= -lasound -lpthread -lm -lrt
19
+ EXECUTABLE ?= squeezelite
20
+ 
21
+ # passing one or more of these in $(OPTS) enables optional feature inclusion
22
+@@ -52,20 +53,20 @@ endif
23
+ 
24
+ # add optional link options
25
+ ifneq (,$(findstring $(OPT_LINKALL), $(CFLAGS)))
26
+-	LDFLAGS += $(LINKALL)
27
++	LIBS += $(LINKALL)
28
+ ifneq (,$(findstring $(OPT_FF), $(CFLAGS)))
29
+-	LDFLAGS += $(LINKALL_FF)
30
++	LIBS += $(LINKALL_FF)
31
+ endif
32
+ ifneq (,$(findstring $(OPT_RESAMPLE), $(CFLAGS)))
33
+-	LDFLAGS += $(LINKALL_RESAMPLE)
34
++	LIBS += $(LINKALL_RESAMPLE)
35
+ endif
36
+ ifneq (,$(findstring $(OPT_IR), $(CFLAGS)))
37
+-	LDFLAGS += $(LINKALL_IR)
38
++	LIBS += $(LINKALL_IR)
39
+ endif
40
+ else
41
+ # if not LINKALL and linux add LINK_LINUX
42
+ ifeq ($(UNAME), Linux)
43
+-	LDFLAGS += $(LINK_LINUX)
44
++	LIBS += $(LINK_LINUX)
45
+ endif
46
+ endif
47
+ 
48
+@@ -74,7 +75,7 @@ OBJECTS = $(SOURCES:.c=.o)
49
+ all: $(EXECUTABLE)
50
+ 
51
+ $(EXECUTABLE): $(OBJECTS)
52
+-	$(CC) $(OBJECTS) $(LDFLAGS) -o $@
53
++	$(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@
54
+ 
55
+ $(OBJECTS): $(DEPS)
56
+ 

+ 30
- 0
sound/squeezelite/patches/010-wait_for_nonzero_mac.patch Zobrazit soubor

@@ -0,0 +1,30 @@
1
+--- a/main.c
2
++++ b/main.c
3
+@@ -187,6 +187,17 @@ static void sighandler(int signum) {
4
+ 	signal(signum, SIG_DFL);
5
+ }
6
+ 
7
++// Waits for nonzero MAC
8
++static void get_nonzero_mac(u8_t mac[], u32_t timeout_ms) {
9
++	u32_t wait_timeout = gettime_ms() + timeout_ms;
10
++	do{
11
++		get_mac(mac);
12
++		if ((mac[0]+mac[1]+mac[2]+mac[3]+mac[4]+mac[5]) != 0) {
13
++			break;
14
++		}
15
++	}while(wait_timeout > gettime_ms());
16
++}
17
++
18
+ int main(int argc, char **argv) {
19
+ 	char *server = NULL;
20
+ 	char *output_device = "default";
21
+@@ -240,7 +251,8 @@ int main(int argc, char **argv) {
22
+ #define MAXCMDLINE 512
23
+ 	char cmdline[MAXCMDLINE] = "";
24
+ 
25
+-	get_mac(mac);
26
++	// Waits for nonzero MAC
27
++	get_nonzero_mac(mac,10000);
28
+ 
29
+ 	for (i = 0; i < argc && (strlen(argv[i]) + strlen(cmdline) + 2 < MAXCMDLINE); i++) {
30
+ 		strcat(cmdline, argv[i]);

+ 83
- 0
sound/squeezelite/patches/020-no_mpg123.patch Zobrazit soubor

@@ -0,0 +1,83 @@
1
+--- a/Makefile
2
++++ b/Makefile
3
+@@ -15,7 +15,7 @@ OPT_IR      = -DIR
4
+ SOURCES = \
5
+ 	main.c slimproto.c buffer.c stream.c utils.c \
6
+ 	output.c output_alsa.c output_pa.c output_stdout.c output_pack.c decode.c \
7
+-	flac.c pcm.c mad.c vorbis.c faad.c mpg.c
8
++	flac.c pcm.c mad.c vorbis.c faad.c
9
+ 
10
+ SOURCES_DSD      = dsd.c dop.c dsd2pcm/dsd2pcm.c
11
+ SOURCES_FF       = ffmpeg.c
12
+@@ -25,7 +25,7 @@ SOURCES_IR       = ir.c
13
+ 
14
+ LINK_LINUX       = -ldl
15
+ 
16
+-LINKALL          = -lFLAC -lmad -lvorbisfile -lfaad -lmpg123
17
++LINKALL          = -lFLAC -lmad -lvorbisfile -lfaad
18
+ LINKALL_FF       = -lavcodec -lavformat -lavutil
19
+ LINKALL_RESAMPLE = -lsoxr
20
+ LINKALL_IR       = -llirc_client
21
+--- a/decode.c
22
++++ b/decode.c
23
+@@ -146,8 +146,8 @@ void decode_init(log_level level, const
24
+ 	// try mad then mpg for mp3 unless command line option passed
25
+ 	if (!(strstr(exclude_codecs, "mp3") || strstr(exclude_codecs, "mad")) &&
26
+ 		(!include_codecs || strstr(include_codecs, "mp3") || strstr(include_codecs, "mad")))	codecs[i] = register_mad();
27
+-	if (!(strstr(exclude_codecs, "mp3") || strstr(exclude_codecs, "mpg")) && !codecs[i] &&
28
+-		(!include_codecs || strstr(include_codecs, "mp3") || strstr(include_codecs, "mpg")))    codecs[i] = register_mpg();
29
++//	if (!(strstr(exclude_codecs, "mp3") || strstr(exclude_codecs, "mpg")) && !codecs[i] &&
30
++//		(!include_codecs || strstr(include_codecs, "mp3") || strstr(include_codecs, "mpg")))    codecs[i] = register_mpg();
31
+ 
32
+ 	mutex_create(decode.mutex);
33
+ 
34
+--- a/main.c
35
++++ b/main.c
36
+@@ -35,7 +35,8 @@
37
+ #else
38
+ #define CODECS_DSD  ""
39
+ #endif
40
+-#define CODECS_MP3  " (mad,mpg for specific mp3 codec)"
41
++//#define CODECS_MP3  " (mad,mpg for specific mp3 codec)"
42
++#define CODECS_MP3  " (mad for specific mp3 codec)"
43
+ 
44
+ #define CODECS CODECS_BASE CODECS_FF CODECS_DSD CODECS_MP3
45
+ 
46
+--- a/squeezelite.h
47
++++ b/squeezelite.h
48
+@@ -140,7 +140,7 @@
49
+ #if LINUX
50
+ #define LIBFLAC "libFLAC.so.8"
51
+ #define LIBMAD  "libmad.so.0"
52
+-#define LIBMPG "libmpg123.so.0"
53
++//#define LIBMPG "libmpg123.so.0"
54
+ #define LIBVORBIS "libvorbisfile.so.3"
55
+ #define LIBTREMOR "libvorbisidec.so.1"
56
+ #define LIBFAAD "libfaad.so.2"
57
+@@ -154,7 +154,7 @@
58
+ #if OSX
59
+ #define LIBFLAC "libFLAC.8.dylib"
60
+ #define LIBMAD  "libmad.0.dylib"
61
+-#define LIBMPG "libmpg123.0.dylib"
62
++//#define LIBMPG "libmpg123.0.dylib"
63
+ #define LIBVORBIS "libvorbisfile.3.dylib"
64
+ #define LIBTREMOR "libvorbisidec.1.dylib"
65
+ #define LIBFAAD "libfaad.2.dylib"
66
+@@ -167,7 +167,7 @@
67
+ #if WIN
68
+ #define LIBFLAC "libFLAC.dll"
69
+ #define LIBMAD  "libmad-0.dll"
70
+-#define LIBMPG "libmpg123-0.dll"
71
++//#define LIBMPG "libmpg123-0.dll"
72
+ #define LIBVORBIS "libvorbisfile.dll"
73
+ #define LIBTREMOR "libvorbisidec.dll"
74
+ #define LIBFAAD "libfaad2.dll"
75
+@@ -180,7 +180,7 @@
76
+ #if FREEBSD
77
+ #define LIBFLAC "libFLAC.so.11"
78
+ #define LIBMAD  "libmad.so.2"
79
+-#define LIBMPG "libmpg123.so.0"
80
++//#define LIBMPG "libmpg123.so.0"
81
+ #define LIBVORBIS "libvorbisfile.so.6"
82
+ #define LIBTREMOR "libvorbisidec.so.1"
83
+ #define LIBFAAD "libfaad.so.2"

+ 14
- 0
sound/squeezelite/patches/030-fix_musl_compatibilty.patch Zobrazit soubor

@@ -0,0 +1,14 @@
1
+--- a/output_alsa.c
2
++++ b/output_alsa.c
3
+@@ -862,8 +862,11 @@ void output_init_alsa(log_level level, c
4
+ 		LOG_INFO("memory locked");
5
+ 	}
6
+ 
7
++#ifdef M_TRIM_THRESHOLD
8
++	// mallopt is not defined in musl libc
9
+ 	mallopt(M_TRIM_THRESHOLD, -1);
10
+ 	mallopt(M_MMAP_MAX, 0);
11
++#endif
12
+ 
13
+ 	touch_memory(silencebuf, MAX_SILENCE_FRAMES * BYTES_PER_FRAME);
14
+ 	touch_memory(outputbuf->buf, outputbuf->size);

+ 105
- 0
sound/squeezelite/patches/040-clear_dynlink_errors.patch Zobrazit soubor

@@ -0,0 +1,105 @@
1
+--- a/faad.c
2
++++ b/faad.c
3
+@@ -593,6 +593,8 @@ static bool load_faad() {
4
+ 		return false;
5
+ 	}
6
+ 
7
++	err = dlerror();	// Reset previous dynamic linking error string (if there was)
8
++
9
+ 	a->NeAACDecGetCurrentConfiguration = dlsym(handle, "NeAACDecGetCurrentConfiguration");
10
+ 	a->NeAACDecSetConfiguration = dlsym(handle, "NeAACDecSetConfiguration");
11
+ 	a->NeAACDecOpen = dlsym(handle, "NeAACDecOpen");
12
+--- a/ffmpeg.c
13
++++ b/ffmpeg.c
14
+@@ -590,6 +590,8 @@ static bool load_ff() {
15
+ 		return false;
16
+ 	}
17
+ 
18
++	err = dlerror();	// Reset previous dynamic linking error string (if there was)
19
++
20
+ 	sprintf(name, LIBAVFORMAT, LIBAVFORMAT_VERSION_MAJOR);
21
+ 	handle_format = dlopen(name, RTLD_NOW);
22
+ 	if (!handle_format) {
23
+--- a/flac.c
24
++++ b/flac.c
25
+@@ -241,6 +241,8 @@ static bool load_flac() {
26
+ 		return false;
27
+ 	}
28
+ 
29
++	err = dlerror();	// Reset previous dynamic linking error string (if there was)
30
++
31
+ 	f->FLAC__StreamDecoderErrorStatusString = dlsym(handle, "FLAC__StreamDecoderErrorStatusString");
32
+ 	f->FLAC__StreamDecoderStateString = dlsym(handle, "FLAC__StreamDecoderStateString");
33
+ 	f->FLAC__stream_decoder_new = dlsym(handle, "FLAC__stream_decoder_new");
34
+--- a/ir.c
35
++++ b/ir.c
36
+@@ -167,10 +167,10 @@ static void *ir_thread() {
37
+ 			UNLOCK_I;
38
+ 			wake_controller();
39
+ 		}
40
+-		
41
++
42
+ 		free(code);
43
+ 	}
44
+-	
45
++
46
+ 	return 0;
47
+ }
48
+ 
49
+@@ -184,6 +184,8 @@ static bool load_lirc() {
50
+ 		return false;
51
+ 	}
52
+ 
53
++	err = dlerror();	// Reset previous dynamic linking error string (if there was)
54
++
55
+ 	i->lirc_init = dlsym(handle, "lirc_init");
56
+ 	i->lirc_deinit = dlsym(handle, "lirc_deinit");
57
+ 	i->lirc_readconfig = dlsym(handle, "lirc_readconfig");
58
+--- a/mad.c
59
++++ b/mad.c
60
+@@ -364,7 +364,9 @@ static bool load_mad() {
61
+ 		LOG_INFO("dlerror: %s", dlerror());
62
+ 		return false;
63
+ 	}
64
+-	
65
++
66
++	err = dlerror();	// Reset previous dynamic linking error string (if there was)
67
++
68
+ 	m->mad_stream_init = dlsym(handle, "mad_stream_init");
69
+ 	m->mad_frame_init = dlsym(handle, "mad_frame_init");
70
+ 	m->mad_synth_init = dlsym(handle, "mad_synth_init");
71
+--- a/mpg.c
72
++++ b/mpg.c
73
+@@ -221,7 +221,9 @@ static bool load_mpg() {
74
+ 		LOG_INFO("dlerror: %s", dlerror());
75
+ 		return false;
76
+ 	}
77
+-	
78
++
79
++	err = dlerror();	// Reset previous dynamic linking error string (if there was)
80
++
81
+ 	m->mpg123_init = dlsym(handle, "mpg123_init");
82
+ 	m->mpg123_feature = dlsym(handle, "mpg123_feature");
83
+ 	m->mpg123_rates = dlsym(handle, "mpg123_rates");
84
+--- a/resample.c
85
++++ b/resample.c
86
+@@ -250,6 +250,8 @@ static bool load_soxr(void) {
87
+ 		return false;
88
+ 	}
89
+ 
90
++	err = dlerror();	// Reset previous dynamic linking error string (if there was)
91
++
92
+ 	r->soxr_io_spec = dlsym(handle, "soxr_io_spec");
93
+ 	r->soxr_quality_spec = dlsym(handle, "soxr_quality_spec");
94
+ 	r->soxr_create = dlsym(handle, "soxr_create");
95
+--- a/vorbis.c
96
++++ b/vorbis.c
97
+@@ -286,6 +286,8 @@ static bool load_vorbis() {
98
+ 		}
99
+ 	}
100
+ 
101
++	err = dlerror();	// Reset previous dynamic linking error string (if there was)
102
++
103
+ 	v->ov_read = tremor ? NULL : dlsym(handle, "ov_read");
104
+ 	v->ov_read_tremor = tremor ? dlsym(handle, "ov_read") : NULL;
105
+ 	v->ov_info = dlsym(handle, "ov_info");