Browse Source

Merge pull request #11237 from neheb/sq

squeezelite: update to 1.9.6-1206
lilik-openwrt-22.03
Rosen Penev 5 years ago
committed by GitHub
parent
commit
afefd75620
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 140 additions and 142 deletions
  1. +10
    -14
      sound/squeezelite/Makefile
  2. +32
    -14
      sound/squeezelite/files/squeezelite.init
  3. +71
    -79
      sound/squeezelite/patches/010-select_broadcast_interface.patch
  4. +27
    -35
      sound/squeezelite/patches/020-no_libmad.patch

+ 10
- 14
sound/squeezelite/Makefile View File

@ -6,19 +6,19 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=squeezelite PKG_NAME:=squeezelite
PKG_VERSION:=1.9.1-1130
PKG_RELEASE:=2
PKG_VERSION:=1.9.6-1210
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/ralph-irving/squeezelite
PKG_SOURCE_VERSION:=1b7a17616cd2bbd9935c710dc33cda11cd0de45e
PKG_MIRROR_HASH:=5993fa5fcacd1640962bc60f88a93faa4fcac74a767fbf820b40a27c338a9062
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=LICENSE.txt
PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net> PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
PKG_LICENSE:=GPL-3.0-or-later
PKG_LICENSE_FILES:=LICENSE.txt
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/ralph-irving/squeezelite.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=451cad8da651073d18118fb9ca39faef550825ff
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=e6082b486e364c8cbd7db96fc06dc5243242a3ac786113e42e3061c06ea8889e
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
@ -119,10 +119,6 @@ endif
MAKE_FLAGS+=OPTS="$(opts)" MAKE_FLAGS+=OPTS="$(opts)"
# Squeezelite uses functions which are deprecated in recent ffmpeg versions.
# See https://github.com/ralph-irving/squeezelite/issues/60
TARGET_CFLAGS+=-Wno-deprecated-declarations
define Package/squeezelite/install define Package/squeezelite/install
$(INSTALL_DIR) $(1)/usr/bin $(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/squeezelite $(1)/usr/bin $(INSTALL_BIN) $(PKG_BUILD_DIR)/squeezelite $(1)/usr/bin


+ 32
- 14
sound/squeezelite/files/squeezelite.init View File

@ -9,9 +9,10 @@ PROG=/usr/bin/squeezelite
# Check if a codec is disabled in the configuration (ie "decode_<codec> 0") # Check if a codec is disabled in the configuration (ie "decode_<codec> 0")
checkcodec() { checkcodec() {
local codec
config_get_bool codec options "$1" 1 config_get_bool codec options "$1" 1
if [ $codec -eq 0 ] ; then
if [ "$codec" -eq 0 ] ; then
if [ -z "$3" ] ; then if [ -z "$3" ] ; then
echo "-e $2" echo "-e $2"
else else
@ -25,55 +26,70 @@ checkcodec() {
make_cmdline() { make_cmdline() {
cmdline="" cmdline=""
local name
config_get name options name "SqueezeWrt" config_get name options name "SqueezeWrt"
cmdline="$cmdline -n $name" cmdline="$cmdline -n $name"
local model_name
config_get model_name options model_name "SqueezeLite" config_get model_name options model_name "SqueezeLite"
cmdline="$cmdline -M $model_name" cmdline="$cmdline -M $model_name"
local interface
config_get interface options interface "" config_get interface options interface ""
[ -n "$interface" ] && cmdline="$cmdline -I $interface" [ -n "$interface" ] && cmdline="$cmdline -I $interface"
local device
config_get device options device "" config_get device options device ""
[ -n "$device" ] && cmdline="$cmdline -o $device" [ -n "$device" ] && cmdline="$cmdline -o $device"
local alsa_buffer
config_get alsa_buffer options alsa_buffer 200 config_get alsa_buffer options alsa_buffer 200
[ $alsa_buffer -eq 0 ] && alsa_buffer="200"
[ "$alsa_buffer" -eq 0 ] && alsa_buffer="200"
local alsa_period
config_get alsa_period options alsa_period 4 config_get alsa_period options alsa_period 4
[ $alsa_period -eq 0 ] && alsa_period="4"
[ "$alsa_period" -eq 0 ] && alsa_period="4"
local alsa_format
config_get alsa_format options alsa_format 16 config_get alsa_format options alsa_format 16
[ $alsa_format = "0" ] && alsa_format="16"
[ "$alsa_format" = "0" ] && alsa_format="16"
local alsa_mmap
config_get alsa_mmap options alsa_mmap 0 config_get alsa_mmap options alsa_mmap 0
cmdline="$cmdline -a $alsa_buffer:$alsa_period:$alsa_format:$alsa_mmap" cmdline="$cmdline -a $alsa_buffer:$alsa_period:$alsa_format:$alsa_mmap"
local stream_bufsiz
local out_bufsiz
config_get stream_bufsiz options stream_bufsiz 2048 config_get stream_bufsiz options stream_bufsiz 2048
config_get out_bufsiz options out_bufsiz 3763 config_get out_bufsiz options out_bufsiz 3763
cmdline="$cmdline -b $stream_bufsiz:$out_bufsiz" cmdline="$cmdline -b $stream_bufsiz:$out_bufsiz"
local max_sr
config_get max_sr options max_sr 0 config_get max_sr options max_sr 0
if [ $max_sr -ne 0 ] ; then
[ "$max_sr" -ne 0 ] && {
max_sr="-r $max_sr" max_sr="-r $max_sr"
local sr_delay
config_get sr_delay options sr_delay 0 config_get sr_delay options sr_delay 0
[ $sr_delay -ne 0 ] && max_sr="$max_sr:$sr_delay"
[ "$sr_delay" -ne 0 ] && max_sr="$max_sr:$sr_delay"
cmdline="$cmdline $max_sr" cmdline="$cmdline $max_sr"
fi
}
local close_delay
config_get close_delay options close_delay 0 config_get close_delay options close_delay 0
[ $close_delay -ne 0 ] && cmdline="$cmdline -C $close_delay"
[ "$close_delay" -ne 0 ] && cmdline="$cmdline -C $close_delay"
local server_addr
config_get server_addr options server_addr "" config_get server_addr options server_addr ""
if [ -n "$server_addr" ] ; then
[ -n "$server_addr" ] && {
local server_port
config_get server_port options server_port 3483 config_get server_port options server_port 3483
cmdline="$cmdline -s $server_addr:$server_port" cmdline="$cmdline -s $server_addr:$server_port"
fi
}
local priority
config_get priority options priority 0 config_get priority options priority 0
[ $priority -ne 0 ] && cmdline="$cmdline -p $priority"
[ "$priority" -ne 0 ] && cmdline="$cmdline -p $priority"
local excl_codecs="" local excl_codecs=""
excl_codecs=$(checkcodec decode_flac flac "$excl_codecs") excl_codecs=$(checkcodec decode_flac flac "$excl_codecs")
@ -83,15 +99,17 @@ make_cmdline() {
excl_codecs=$(checkcodec decode_wma_alac wma,alac "$excl_codecs") excl_codecs=$(checkcodec decode_wma_alac wma,alac "$excl_codecs")
cmdline="$cmdline $excl_codecs" cmdline="$cmdline $excl_codecs"
local dop
config_get dop options dsd_over_pcm 0 config_get dop options dsd_over_pcm 0
[ $dop -eq 1 ] && cmdline="$cmdline -D"
[ "$dop" -eq 1 ] && cmdline="$cmdline -D"
} }
start_service() { start_service() {
config_load squeezelite config_load squeezelite
local enabled
config_get_bool enabled options 'enabled' 0 config_get_bool enabled options 'enabled' 0
[ $enabled -eq 0 ] && return
[ "$enabled" -eq 0 ] && return
# Build command params # Build command params
make_cmdline make_cmdline


+ 71
- 79
sound/squeezelite/patches/010-select_broadcast_interface.patch View File

@ -1,8 +1,6 @@
Index: squeezelite-1.9.1-1130/main.c
===================================================================
--- squeezelite-1.9.1-1130.orig/main.c
+++ squeezelite-1.9.1-1130/main.c
@@ -84,6 +84,7 @@ static void usage(const char *argv0) {
--- a/main.c
+++ b/main.c
@@ -93,6 +93,7 @@ static void usage(const char *argv0) {
#if IR #if IR
" -i [<filename>]\tEnable lirc remote control support (lirc config file ~/.lircrc used if filename not specified)\n" " -i [<filename>]\tEnable lirc remote control support (lirc config file ~/.lircrc used if filename not specified)\n"
#endif #endif
@ -10,7 +8,7 @@ Index: squeezelite-1.9.1-1130/main.c
" -m <mac addr>\t\tSet mac address, format: ab:cd:ef:12:34:56\n" " -m <mac addr>\t\tSet mac address, format: ab:cd:ef:12:34:56\n"
" -M <modelname>\tSet the squeezelite player model name sent to the server (default: " MODEL_NAME_STRING ")\n" " -M <modelname>\tSet the squeezelite player model name sent to the server (default: " MODEL_NAME_STRING ")\n"
" -n <name>\t\tSet the player name\n" " -n <name>\t\tSet the player name\n"
@@ -267,6 +268,8 @@ int main(int argc, char **argv) {
@@ -285,6 +286,8 @@ int main(int argc, char **argv) {
extern bool user_rates; extern bool user_rates;
char *logfile = NULL; char *logfile = NULL;
u8_t mac[6]; u8_t mac[6];
@ -19,7 +17,7 @@ Index: squeezelite-1.9.1-1130/main.c
unsigned stream_buf_size = STREAMBUF_SIZE; unsigned stream_buf_size = STREAMBUF_SIZE;
unsigned output_buf_size = 0; // set later unsigned output_buf_size = 0; // set later
unsigned rates[MAX_SUPPORTED_SAMPLERATES] = { 0 }; unsigned rates[MAX_SUPPORTED_SAMPLERATES] = { 0 };
@@ -307,6 +310,7 @@ int main(int argc, char **argv) {
@@ -325,6 +328,7 @@ int main(int argc, char **argv) {
int maxSampleRate = 0; int maxSampleRate = 0;
@ -27,7 +25,7 @@ Index: squeezelite-1.9.1-1130/main.c
char *optarg = NULL; char *optarg = NULL;
int optind = 1; int optind = 1;
int i; int i;
@@ -314,8 +318,6 @@ int main(int argc, char **argv) {
@@ -332,8 +336,6 @@ int main(int argc, char **argv) {
#define MAXCMDLINE 512 #define MAXCMDLINE 512
char cmdline[MAXCMDLINE] = ""; char cmdline[MAXCMDLINE] = "";
@ -36,7 +34,7 @@ Index: squeezelite-1.9.1-1130/main.c
for (i = 0; i < argc && (strlen(argv[i]) + strlen(cmdline) + 2 < MAXCMDLINE); i++) { for (i = 0; i < argc && (strlen(argv[i]) + strlen(cmdline) + 2 < MAXCMDLINE); i++) {
strcat(cmdline, argv[i]); strcat(cmdline, argv[i]);
strcat(cmdline, " "); strcat(cmdline, " ");
@@ -323,7 +325,7 @@ int main(int argc, char **argv) {
@@ -341,7 +343,7 @@ int main(int argc, char **argv) {
while (optind < argc && strlen(argv[optind]) >= 2 && argv[optind][0] == '-') { while (optind < argc && strlen(argv[optind]) >= 2 && argv[optind][0] == '-') {
char *opt = argv[optind] + 1; char *opt = argv[optind] + 1;
@ -45,7 +43,7 @@ Index: squeezelite-1.9.1-1130/main.c
#if ALSA #if ALSA
"UVO" "UVO"
#endif #endif
@@ -424,6 +426,9 @@ int main(int argc, char **argv) {
@@ -442,6 +444,9 @@ int main(int argc, char **argv) {
case 'f': case 'f':
logfile = optarg; logfile = optarg;
break; break;
@ -55,7 +53,7 @@ Index: squeezelite-1.9.1-1130/main.c
case 'm': case 'm':
{ {
int byte = 0; int byte = 0;
@@ -733,6 +738,11 @@ int main(int argc, char **argv) {
@@ -755,6 +760,11 @@ int main(int argc, char **argv) {
winsock_init(); winsock_init();
#endif #endif
@ -67,7 +65,7 @@ Index: squeezelite-1.9.1-1130/main.c
stream_init(log_stream, stream_buf_size); stream_init(log_stream, stream_buf_size);
if (!strcmp(output_device, "-")) { if (!strcmp(output_device, "-")) {
@@ -776,7 +786,7 @@ int main(int argc, char **argv) {
@@ -798,7 +808,7 @@ int main(int argc, char **argv) {
exit(1); exit(1);
} }
@ -76,42 +74,18 @@ Index: squeezelite-1.9.1-1130/main.c
decode_close(); decode_close();
stream_close(); stream_close();
Index: squeezelite-1.9.1-1130/squeezelite.h
===================================================================
--- squeezelite-1.9.1-1130.orig/squeezelite.h
+++ squeezelite-1.9.1-1130/squeezelite.h
@@ -414,7 +414,7 @@ typedef enum { EVENT_TIMEOUT = 0, EVENT_
char *next_param(char *src, char c);
u32_t gettime_ms(void);
-void get_mac(u8_t *mac);
+in_addr_t get_iface_info(log_level level, char *iface, u8_t *mac);
void set_nonblock(sockfd s);
int connect_timeout(sockfd sock, const struct sockaddr *addr, socklen_t addrlen, int timeout);
void server_addr(char *server, in_addr_t *ip_ptr, unsigned *port_ptr);
@@ -470,7 +470,7 @@ void buf_init(struct buffer *buf, size_t
void buf_destroy(struct buffer *buf);
// slimproto.c
-void slimproto(log_level level, char *server, u8_t mac[6], const char *name, const char *namefile, const char *modelname, int maxSampleRate);
+void slimproto(log_level level, char *server, in_addr_t bcast_addr, u8_t mac[6], const char *name, const char *namefile, const char *modelname, int maxSampleRate);
void slimproto_stop(void);
void wake_controller(void);
Index: squeezelite-1.9.1-1130/slimproto.c
===================================================================
--- squeezelite-1.9.1-1130.orig/slimproto.c
+++ squeezelite-1.9.1-1130/slimproto.c
@@ -113,7 +113,7 @@ void send_packet(u8_t *packet, size_t le
--- a/slimproto.c
+++ b/slimproto.c
@@ -113,7 +113,7 @@ void send_packet(u8_t *packet, size_t len) {
} }
} }
-static void sendHELO(bool reconnect, const char *fixed_cap, const char *var_cap, u8_t mac[6]) { -static void sendHELO(bool reconnect, const char *fixed_cap, const char *var_cap, u8_t mac[6]) {
+static void sendHELO(bool reconnect, const char *fixed_cap, const char *var_cap, u8_t *mac) { +static void sendHELO(bool reconnect, const char *fixed_cap, const char *var_cap, u8_t *mac) {
const char *base_cap = "Model=squeezelite,AccuratePlayPoints=1,HasDigitalOut=1,HasPolarityInversion=1,Firmware=" VERSION;
struct HELO_packet pkt;
@@ -757,7 +757,7 @@ void wake_controller(void) {
#define BASE_CAP "Model=squeezelite,AccuratePlayPoints=1,HasDigitalOut=1,HasPolarityInversion=1,Firmware=" VERSION
#define SSL_CAP "CanHTTPS=1"
const char *base_cap;
@@ -761,7 +761,7 @@ void wake_controller(void) {
wake_signal(wake_e); wake_signal(wake_e);
} }
@ -120,7 +94,7 @@ Index: squeezelite-1.9.1-1130/slimproto.c
struct sockaddr_in d; struct sockaddr_in d;
struct sockaddr_in s; struct sockaddr_in s;
char *buf; char *buf;
@@ -774,7 +774,7 @@ in_addr_t discover_server(char *default_
@@ -778,7 +778,7 @@ in_addr_t discover_server(char *default_server) {
memset(&d, 0, sizeof(d)); memset(&d, 0, sizeof(d));
d.sin_family = AF_INET; d.sin_family = AF_INET;
d.sin_port = htons(PORT); d.sin_port = htons(PORT);
@ -129,7 +103,7 @@ Index: squeezelite-1.9.1-1130/slimproto.c
pollinfo.fd = disc_sock; pollinfo.fd = disc_sock;
pollinfo.events = POLLIN; pollinfo.events = POLLIN;
@@ -809,7 +809,7 @@ in_addr_t discover_server(char *default_
@@ -813,7 +813,7 @@ in_addr_t discover_server(char *default_server) {
#define FIXED_CAP_LEN 256 #define FIXED_CAP_LEN 256
#define VAR_CAP_LEN 128 #define VAR_CAP_LEN 128
@ -138,7 +112,7 @@ Index: squeezelite-1.9.1-1130/slimproto.c
struct sockaddr_in serv_addr; struct sockaddr_in serv_addr;
static char fixed_cap[FIXED_CAP_LEN], var_cap[VAR_CAP_LEN] = ""; static char fixed_cap[FIXED_CAP_LEN], var_cap[VAR_CAP_LEN] = "";
bool reconnect = false; bool reconnect = false;
@@ -830,7 +830,7 @@ void slimproto(log_level level, char *se
@@ -834,7 +834,7 @@ void slimproto(log_level level, char *server, u8_t mac[6], const char *name, con
} }
if (!slimproto_ip) { if (!slimproto_ip) {
@ -147,7 +121,7 @@ Index: squeezelite-1.9.1-1130/slimproto.c
} }
if (!slimproto_port) { if (!slimproto_port) {
@@ -911,7 +911,7 @@ void slimproto(log_level level, char *se
@@ -915,7 +915,7 @@ void slimproto(log_level level, char *server, u8_t mac[6], const char *name, con
// rediscover server if it was not set at startup // rediscover server if it was not set at startup
if (!server && ++failed_connect > 5) { if (!server && ++failed_connect > 5) {
@ -156,10 +130,28 @@ Index: squeezelite-1.9.1-1130/slimproto.c
} }
} else { } else {
Index: squeezelite-1.9.1-1130/utils.c
===================================================================
--- squeezelite-1.9.1-1130.orig/utils.c
+++ squeezelite-1.9.1-1130/utils.c
--- a/squeezelite.h
+++ b/squeezelite.h
@@ -455,7 +455,7 @@ char* strcasestr(const char *haystack, const char *needle);
char *next_param(char *src, char c);
u32_t gettime_ms(void);
-void get_mac(u8_t *mac);
+in_addr_t get_iface_info(log_level level, char *iface, u8_t *mac);
void set_nonblock(sockfd s);
int connect_timeout(sockfd sock, const struct sockaddr *addr, socklen_t addrlen, int timeout);
void server_addr(char *server, in_addr_t *ip_ptr, unsigned *port_ptr);
@@ -511,7 +511,7 @@ void buf_init(struct buffer *buf, size_t size);
void buf_destroy(struct buffer *buf);
// slimproto.c
-void slimproto(log_level level, char *server, u8_t mac[6], const char *name, const char *namefile, const char *modelname, int maxSampleRate);
+void slimproto(log_level level, char *server, in_addr_t bcast_addr, u8_t mac[6], const char *name, const char *namefile, const char *modelname, int maxSampleRate);
void slimproto_stop(void);
void wake_controller(void);
--- a/utils.c
+++ b/utils.c
@@ -22,11 +22,11 @@ @@ -22,11 +22,11 @@
#include "squeezelite.h" #include "squeezelite.h"
@ -175,9 +167,9 @@ Index: squeezelite-1.9.1-1130/utils.c
#include <net/if_dl.h> #include <net/if_dl.h>
#include <net/if_types.h> #include <net/if_types.h>
#endif #endif
@@ -44,15 +44,11 @@
#if WIN
#include <iphlpapi.h>
@@ -49,15 +49,11 @@
#include <ctype.h>
#endif
#endif #endif
-#if OSX -#if OSX
-#include <net/if_dl.h> -#include <net/if_dl.h>
@ -193,7 +185,7 @@ Index: squeezelite-1.9.1-1130/utils.c
// logging functions // logging functions
const char *logtime(void) { const char *logtime(void) {
static char buf[100]; static char buf[100];
@@ -114,58 +110,94 @@ u32_t gettime_ms(void) {
@@ -119,58 +115,94 @@ u32_t gettime_ms(void) {
#endif #endif
} }
@ -228,23 +220,29 @@ Index: squeezelite-1.9.1-1130/utils.c
+ unsigned char *ptr; + unsigned char *ptr;
+ in_addr_t bcast_addr = 0; + in_addr_t bcast_addr = 0;
+ int have_mac = 0, have_ifname = 0; + int have_mac = 0, have_ifname = 0;
+
- }
+ loglevel = level; + loglevel = level;
+
- mac[0] = mac[1] = mac[2] = mac[3] = mac[4] = mac[5] = 0;
+ // Check for non-zero MAC + // Check for non-zero MAC
+ if (mac[0] | mac[1] | mac[2] != 0) + if (mac[0] | mac[1] | mac[2] != 0)
+ have_mac = 1; + have_mac = 1;
+
- int s = socket(AF_INET, SOCK_DGRAM, 0);
+ // Copy interface name, if it was provided. + // Copy interface name, if it was provided.
+ if (iface != NULL) { + if (iface != NULL) {
+ if (strlen(iface) > sizeof(ifname)) + if (strlen(iface) > sizeof(ifname))
+ return -1; + return -1;
+ strncpy(ifname, iface, sizeof(ifname));
- ifc.ifc_len = sizeof(ifs);
- ifc.ifc_req = ifs;
+ strncpy(ifname, iface, sizeof(ifname) - 1);
+ have_ifname = 1; + have_ifname = 1;
}
+ }
- mac[0] = mac[1] = mac[2] = mac[3] = mac[4] = mac[5] = 0;
- if (ioctl(s, SIOCGIFCONF, &ifc) == 0) {
- ifend = ifs + (ifc.ifc_len / sizeof(struct ifreq));
+ if (getifaddrs(&addrs) == 0) { + if (getifaddrs(&addrs) == 0) {
+ //iterate to find corresponding ethernet address + //iterate to find corresponding ethernet address
+ for (ifa = addrs; ifa; ifa = ifa->ifa_next) { + for (ifa = addrs; ifa; ifa = ifa->ifa_next) {
@ -255,11 +253,10 @@ Index: squeezelite-1.9.1-1130/utils.c
+ || !ifa->ifa_flags & IFF_BROADCAST) { + || !ifa->ifa_flags & IFF_BROADCAST) {
+ continue; + continue;
+ } + }
- int s = socket(AF_INET, SOCK_DGRAM, 0);
+
+ if (!have_ifname) { + if (!have_ifname) {
+ // We have found a valid interface name. Keep it. + // We have found a valid interface name. Keep it.
+ strncpy(ifname, ifa->ifa_name, sizeof(ifname));
+ strncpy(ifname, ifa->ifa_name, sizeof(ifname) - 1);
+ have_ifname = 1; + have_ifname = 1;
+ } else { + } else {
+ if (strncmp(ifname, ifa->ifa_name, sizeof(ifname)) != 0) { + if (strncmp(ifname, ifa->ifa_name, sizeof(ifname)) != 0) {
@ -268,11 +265,15 @@ Index: squeezelite-1.9.1-1130/utils.c
+ } + }
+ } + }
- ifc.ifc_len = sizeof(ifs);
- ifc.ifc_req = ifs;
- for (ifr = ifc.ifc_req; ifr < ifend; ifr++) {
- if (ifr->ifr_addr.sa_family == AF_INET) {
- if (ioctl(s, SIOCGIFCONF, &ifc) == 0) {
- ifend = ifs + (ifc.ifc_len / sizeof(struct ifreq));
- strncpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name) - 1);
- if (ioctl (s, SIOCGIFHWADDR, &ifreq) == 0) {
- memcpy(mac, ifreq.ifr_hwaddr.sa_data, 6);
- if (mac[0]+mac[1]+mac[2] != 0) {
- break;
- }
+ // Check address family. + // Check address family.
+ if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET && + if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET &&
+ ((struct sockaddr_in *)ifa->ifa_broadaddr)->sin_addr.s_addr != 0) { + ((struct sockaddr_in *)ifa->ifa_broadaddr)->sin_addr.s_addr != 0) {
@ -286,16 +287,7 @@ Index: squeezelite-1.9.1-1130/utils.c
+ have_ifname = 0; + have_ifname = 0;
+ } + }
+ } + }
- for (ifr = ifc.ifc_req; ifr < ifend; ifr++) {
- if (ifr->ifr_addr.sa_family == AF_INET) {
-
- strncpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name));
- if (ioctl (s, SIOCGIFHWADDR, &ifreq) == 0) {
- memcpy(mac, ifreq.ifr_hwaddr.sa_data, 6);
- if (mac[0]+mac[1]+mac[2] != 0) {
- break;
- }
+
+ // Find MAC address matching interface + // Find MAC address matching interface
+ if (!have_mac && bcast_addr != 0) { + if (!have_mac && bcast_addr != 0) {
+ for (ifa = addrs; ifa; ifa = ifa->ifa_next) { + for (ifa = addrs; ifa; ifa = ifa->ifa_next) {
@ -324,7 +316,7 @@ Index: squeezelite-1.9.1-1130/utils.c
#if SUN #if SUN
void get_mac(u8_t mac[]) { void get_mac(u8_t mac[]) {
struct arpreq parpreq; struct arpreq parpreq;
@@ -232,30 +264,6 @@ void get_mac(u8_t mac[]) {
@@ -237,30 +269,6 @@ void get_mac(u8_t mac[]) {
} }
#endif #endif


+ 27
- 35
sound/squeezelite/patches/020-no_libmad.patch View File

@ -1,8 +1,6 @@
Index: squeezelite-1.9.1-1130/Makefile
===================================================================
--- squeezelite-1.9.1-1130.orig/Makefile
+++ squeezelite-1.9.1-1130/Makefile
@@ -17,7 +17,7 @@ OPT_NO_FAAD = -DNO_FAAD
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ OPT_OPUS = -DOPUS
SOURCES = \ SOURCES = \
main.c slimproto.c buffer.c stream.c utils.c \ main.c slimproto.c buffer.c stream.c utils.c \
output.c output_alsa.c output_pa.c output_stdout.c output_pack.c decode.c \ output.c output_alsa.c output_pa.c output_stdout.c output_pack.c decode.c \
@ -11,20 +9,18 @@ Index: squeezelite-1.9.1-1130/Makefile
SOURCES_DSD = dsd.c dop.c dsd2pcm/dsd2pcm.c SOURCES_DSD = dsd.c dop.c dsd2pcm/dsd2pcm.c
SOURCES_FF = ffmpeg.c SOURCES_FF = ffmpeg.c
@@ -30,7 +30,7 @@ SOURCES_FAAD = faad.c
LINK_LINUX = -ldl
LINK_RPI = -lwiringPi
@@ -40,7 +40,7 @@ LINK_LINUX = -ldl
LINK_SSL = -lssl -lcrypto
LINK_ALAC = -lalac
-LINKALL = -lFLAC -lmad -lvorbisfile -lmpg123
+LINKALL = -lFLAC -lvorbisfile -lmpg123
LINKALL_FF = -lavcodec -lavformat -lavutil
-LINKALL = -lmad -lmpg123 -lFLAC -lvorbisfile -lvorbis -logg
+LINKALL = -lmpg123 -lFLAC -lvorbisfile -lvorbis -logg
LINKALL_FF = -lavformat -lavcodec -lavutil
LINKALL_RESAMPLE = -lsoxr LINKALL_RESAMPLE = -lsoxr
LINKALL_IR = -llirc_client LINKALL_IR = -llirc_client
Index: squeezelite-1.9.1-1130/decode.c
===================================================================
--- squeezelite-1.9.1-1130.orig/decode.c
+++ squeezelite-1.9.1-1130/decode.c
@@ -176,11 +176,7 @@ void decode_init(log_level level, const
--- a/decode.c
+++ b/decode.c
@@ -184,11 +184,7 @@ void decode_init(log_level level, const char *include_codecs, const char *exclud
if (!strstr(exclude_codecs, "pcm") && (!include_codecs || (order_codecs = strstr(include_codecs, "pcm")))) if (!strstr(exclude_codecs, "pcm") && (!include_codecs || (order_codecs = strstr(include_codecs, "pcm"))))
sort_codecs((include_codecs ? order_codecs - include_codecs : i), register_pcm()); sort_codecs((include_codecs ? order_codecs - include_codecs : i), register_pcm());
@ -37,32 +33,28 @@ Index: squeezelite-1.9.1-1130/decode.c
(!include_codecs || (order_codecs = strstr(include_codecs, "mp3")) || (order_codecs = strstr(include_codecs, "mpg")))) (!include_codecs || (order_codecs = strstr(include_codecs, "mp3")) || (order_codecs = strstr(include_codecs, "mpg"))))
sort_codecs((include_codecs ? order_codecs - include_codecs : i), register_mpg()); sort_codecs((include_codecs ? order_codecs - include_codecs : i), register_mpg());
Index: squeezelite-1.9.1-1130/main.c
===================================================================
--- squeezelite-1.9.1-1130.orig/main.c
+++ squeezelite-1.9.1-1130/main.c
@@ -44,7 +44,7 @@
--- a/main.c
+++ b/main.c
@@ -51,7 +51,7 @@
#else #else
#define CODECS_DSD "" #define CODECS_DSD ""
#endif #endif
-#define CODECS_MP3 " (mad,mpg for specific mp3 codec)" -#define CODECS_MP3 " (mad,mpg for specific mp3 codec)"
+#define CODECS_MP3 "" +#define CODECS_MP3 ""
#define CODECS CODECS_BASE CODECS_AAC CODECS_FF CODECS_DSD CODECS_MP3
#define CODECS CODECS_BASE CODECS_AAC CODECS_FF CODECS_OPUS CODECS_DSD CODECS_MP3
Index: squeezelite-1.9.1-1130/squeezelite.h
===================================================================
--- squeezelite-1.9.1-1130.orig/squeezelite.h
+++ squeezelite-1.9.1-1130/squeezelite.h
@@ -163,7 +163,6 @@
--- a/squeezelite.h
+++ b/squeezelite.h
@@ -190,7 +190,6 @@
#if LINUX #if LINUX
#define LIBFLAC "libFLAC.so.8" #define LIBFLAC "libFLAC.so.8"
-#define LIBMAD "libmad.so.0" -#define LIBMAD "libmad.so.0"
#define LIBMPG "libmpg123.so.0" #define LIBMPG "libmpg123.so.0"
#define LIBVORBIS "libvorbisfile.so.3" #define LIBVORBIS "libvorbisfile.so.3"
#define LIBTREMOR "libvorbisidec.so.1"
@@ -177,7 +176,6 @@
#define LIBOPUS "libopusfile.so.0"
@@ -205,7 +204,6 @@
#if OSX #if OSX
#define LIBFLAC "libFLAC.8.dylib" #define LIBFLAC "libFLAC.8.dylib"
@ -70,19 +62,19 @@ Index: squeezelite-1.9.1-1130/squeezelite.h
#define LIBMPG "libmpg123.0.dylib" #define LIBMPG "libmpg123.0.dylib"
#define LIBVORBIS "libvorbisfile.3.dylib" #define LIBVORBIS "libvorbisfile.3.dylib"
#define LIBTREMOR "libvorbisidec.1.dylib" #define LIBTREMOR "libvorbisidec.1.dylib"
@@ -190,7 +188,6 @@
@@ -219,7 +217,6 @@
#if WIN #if WIN
#define LIBFLAC "libFLAC.dll" #define LIBFLAC "libFLAC.dll"
-#define LIBMAD "libmad-0.dll" -#define LIBMAD "libmad-0.dll"
#define LIBMPG "libmpg123-0.dll" #define LIBMPG "libmpg123-0.dll"
#define LIBVORBIS "libvorbisfile.dll" #define LIBVORBIS "libvorbisfile.dll"
#define LIBTREMOR "libvorbisidec.dll"
@@ -203,7 +200,6 @@
#define LIBOPUS "libopusfile-0.dll"
@@ -233,7 +230,6 @@
#if FREEBSD #if FREEBSD
#define LIBFLAC "libFLAC.so.11"
-#define LIBMAD "libmad.so.2"
#define LIBFLAC "libFLAC.so.8"
-#define LIBMAD "libmad.so.0"
#define LIBMPG "libmpg123.so.0" #define LIBMPG "libmpg123.so.0"
#define LIBVORBIS "libvorbisfile.so.6"
#define LIBVORBIS "libvorbisfile.so.3"
#define LIBTREMOR "libvorbisidec.so.1" #define LIBTREMOR "libvorbisidec.so.1"

Loading…
Cancel
Save