ok got it working!!! and actually is smooth without any problems!! 
OK, requirements are as per the pervious post.
I'm running it using alsa (libao.conf)
Details:
Makefile:
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=shairport
PKG_VERSION:=0.05
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://mafipulation.org/static/
PKG_MD5SUM:=8225347a80f1b83e430782a255ff5a32
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/shairport
SECTION:=sound
CATEGORY:=Sound
TITLE:=AirPlay speakers
URL:=http://mafipulation.org/blagoblig
DEPENDS:=libao
endef
define Build/Configure
$(call Build/Configure/Default)
endef
define Build/Compile
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS) \
CFLAGS="$(TARGET_CFLAGS)"
mkdir -p $(PKG_INSTALL_DIR)
endef
define Package/shairport/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_BUILD_DIR)/{hairtunes,shairport.pl} $(1)/usr/bin/
endef
$(eval $(call BuildPackage,shairport))
100-fixes.patch
diff -c shairport-0.05-orig/alac.c shairport-0.05.b/alac.c
*** shairport-0.05-orig/alac.c 2011-04-13 05:38:16.000000000 +0100
--- shairport-0.05.b/alac.c 2011-04-15 18:44:30.000000000 +0100
***************
*** 219,225 ****
return i;
}
#elif defined(__GNUC__)
! static int count_leading_zeros(int input)
{
return __builtin_clz(input);
}
--- 219,225 ----
return i;
}
#elif defined(__GNUC__)
! inline static int count_leading_zeros(int input)
{
return __builtin_clz(input);
}
***************
*** 239,245 ****
return output;
}
#else
! #warning using generic count leading zeroes. You may wish to write one for your CPU / compiler
static int count_leading_zeros(int input)
{
int output = 0;
--- 239,245 ----
return output;
}
#else
! #warning GENERIC using generic count leading zeroes. You may wish to write one for your CPU / compiler
static int count_leading_zeros(int input)
{
int output = 0;
diff -c shairport-0.05-orig/hairtunes.c shairport-0.05.b/hairtunes.c
*** shairport-0.05-orig/hairtunes.c 2011-04-11 15:37:08.000000000 +0100
--- shairport-0.05.b/hairtunes.c 2011-04-15 18:45:52.000000000 +0100
***************
*** 73,79 ****
--- 73,81 ----
#endif
void rtp_request_resend(seq_t first, seq_t last);
+ int init_rtp(void);
void init_buffer(void);
+ int init_output(void);
void ab_resync(void);
// interthread variables
***************
*** 306,313 ****
abuf->ready = 1;
}
! if (ab_buffering && buf_fill >= START_FILL)
pthread_cond_signal(&ab_buffer_ready);
if (!ab_buffering) {
// check if the t+10th packet has arrived... last-chance resend
read = ab_read + 10;
--- 308,317 ----
abuf->ready = 1;
}
! if (ab_buffering && buf_fill >= START_FILL) {
pthread_cond_signal(&ab_buffer_ready);
+ //pthread_mutex_unlock(&ab_mutex);
+ }
if (!ab_buffering) {
// check if the t+10th packet has arrived... last-chance resend
read = ab_read + 10;
***************
*** 414,420 ****
si.sin6_flowinfo = 0;
#else
si.sin_family = AF_INET;
! si.sin_len = sizeof(si);
si.sin_addr.s_addr = htonl(INADDR_ANY);
#endif
--- 418,427 ----
si.sin6_flowinfo = 0;
#else
si.sin_family = AF_INET;
! //si.sin_len = sizeof(si);
! #ifdef SIN_LEN
! si.sin_len = sizeof(si);
! #endif
si.sin_addr.s_addr = htonl(INADDR_ANY);
#endif
***************
*** 607,612 ****
--- 614,621 ----
*outptr++ = dithered_vol(*inptr++);
}
}
+
+ return frame_size + stuff;
}
void *audio_thread_func(void *arg) {
***************
*** 655,660 ****
--- 664,670 ----
ao_play(dev, (char *)outbuf, play_samples*4);
}
+ return 0;
}
int init_output(void) {
***************
*** 673,679 ****
int err;
#ifdef FANCY_RESAMPLING
! if (fancy_resampling)
src = src_new(SRC_SINC_MEDIUM_QUALITY, 2, &err);
else
src = 0;
--- 683,689 ----
int err;
#ifdef FANCY_RESAMPLING
! if (fancy_resampling)
src = src_new(SRC_SINC_MEDIUM_QUALITY, 2, &err);
else
src = 0;
***************
*** 681,684 ****
--- 691,695 ----
pthread_t audio_thread;
pthread_create(&audio_thread, NULL, audio_thread_func, dev);
+
}
diff -c shairport-0.05-orig/Makefile shairport-0.05.b/Makefile
*** shairport-0.05-orig/Makefile 2011-04-13 05:39:59.000000000 +0100
--- shairport-0.05.b/Makefile 2011-04-15 18:50:31.000000000 +0100
***************
*** 1,4 ****
CFLAGS = `pkg-config --cflags --libs ao openssl`
hairtunes: hairtunes.c alac.c
! gcc hairtunes.c alac.c -lm $(CFLAGS) -o hairtunes
--- 1,7 ----
CFLAGS = `pkg-config --cflags --libs ao openssl`
+ AO_LIBS = /home/kiwi//openwrt/trunk.26126/build_dir/target-mipsel_uClibc-0.9.32/libao-0.8.8/ipkg-install/usr/lib
+ OPENSSL_LIBS = /home/kiwi//openwrt/trunk.26126/build_dir/target-mipsel_uClibc-0.9.32/openssl-1.0.0d/ipkg-install/usr/lib
+ INCLUDES = /home/kiwi/openwrt/trunk.26126/staging_dir/target-mipsel_uClibc-0.9.32/usr/include
hairtunes: hairtunes.c alac.c
! mipsel-openwrt-linux-uclibc-gcc hairtunes.c alac.c -lao -lcrypto -lpthread -L$(AO_LIBS) -L$(OPENSSL_LIBS) -I$(INCLUDES) -lm $(CFLAGS) -O3 -o hairtunes
Please note that the above includes my personal path... needs updated!
Also, it looks with -O3 I'm on around 36-40% CPU utilization. Depending on the actual platform might be useful to edit file alac.c and rewriting function 'count_leading_zeros()'. Once example my be:
static int count_leading_zeros(int input)
{
int output;
//asm("clz %0, %1" : "=r" (output) : "r" (input));
__asm
{
mov r9, input
clz r8, r9
mov output, r8
}
return output;
}
Hope this help!
I would really like to see someone to rewrite the whole perl script in a compilable language! This would save a lot of space!
Thanks,
Gregory Dymarek
(Last edited by gregd72002 on 15 Apr 2011, 21:10)