Commit Graph
270 Commits
Author SHA1 Message Date
James Laird efe7d2c63c ao: add option parsing 2013-04-01 21:44:30 +11:00
James Laird f39ff3a44e main: add option parsing 2013-04-01 21:44:14 +11:00
James Laird 9b33878c59 audio: output selection functionality 2013-04-01 21:43:24 +11:00
James Laird 86e94064c0 fix potential deadlock while shutting down 2013-04-01 20:08:28 +11:00
James Laird 04b142dbe3 rewrite: add mDNS registration 2013-04-01 20:08:05 +11:00
James Laird a2fb5d219d Refactor and rewrite.
Perl script is removed in favour of C. Stale documentation and initfiles
are removed for now also.

C interface works, but still needs work (for example, mDNS is missing) -
see TODO.
2013-04-01 18:57:08 +11:00
James Laird 98a86371d0 Revert "Merge pull request #181 from ffainelli/master"
Reverting due to reported failures (see #189).

This reverts commit 617cbf5b23, reversing
changes made to eb8dad5317.
2013-03-27 12:02:16 +11:00
Albert Zeyer 2ac00a002a readme: some cleanup 2013-03-16 14:10:07 +01:00
Alfred Perlstein e6eb98b10a Merge pull request #184 from alfredperlstein/master
Fixes for ipv4 networks and building on FreeBSD

This was tested on 32bit Ubuntu 12.10.
2013-03-13 14:33:46 -07:00
Florian Fainelli 617cbf5b23 Merge pull request #181 from ffainelli/master
socketlib: properly fix the IPv6 to IPv4 fallback code.
2013-03-12 14:51:36 -07:00
Albert Zeyer eb8dad5317 Merge pull request #167 from mcoms/master
Verbose mode logs incorrect IP / fix for paths with spaces in
2013-03-12 10:57:44 -07:00
Florian Fainelli 0847706597 socketlib: properly fix the IPv6 to IPv4 fallback code.
With the current code, we do have the following on a system where IPv6
is completely disabled:

socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = -1 EAFNOSUPPORT (Address
family not supported by protocol)
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(3, {sa_family=AF_INET6, sin6_port=htons(5002), inet_pton(AF_INET6,
"::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1
EAFNOSUPPORT (Address family not supported by protocol)

The correct fix is to make a new call to getAddr() to ensure that the
entire struct addrinfo will be correctly filled out again with AF_INET
this time. This patch fixes.
2013-02-22 15:52:26 +01:00
Alfred Perlstein 01405e92de tell FreeBSD people to force ipv4. 2012-12-23 14:36:57 -08:00
Alfred Perlstein 0621464a95 Add FreeBSD install instructions. 2012-12-23 14:20:15 -08:00
Alfred Perlstein 2e097b670f Pass ipv4_only to hairtunes when -4 is given as an arg. 2012-12-23 14:17:08 -08:00
Alfred Perlstein 220250cbe0 Add ipv4 only support to hairtunes.c. 2012-12-23 14:16:36 -08:00
Alfred Perlstein f42a026731 Handle FreeBSD having openssl in base. 2012-12-23 12:22:31 -08:00
Alfred Perlstein 376b3a53c8 allow users to force ipv4 only.
add flag '-4' to commands to force ipv4.
this doesn't work yet because hairtunes unconditionally
uses ipv6 if available.
2012-12-23 12:15:44 -08:00
Nick Malyon f2b52ea9db Quote the path to hairtunes (required if the path contains spaces). 2012-10-20 00:45:09 +01:00
Nick Malyon 0f5822d1f7 New connection verbose logs were displaying the local IP not the remote one. Fixed. 2012-10-19 23:51:11 +01:00
Albert Zeyer 4746bb1139 Merge pull request #166 from r10r/master
Simple fix for passing the name in the init script
2012-10-02 03:43:50 -07:00
Albert Zeyer b58f156156 Merge pull request #165 from jcheng5/patch-1
Add Net::SDP dependency to INSTALL.md
2012-09-28 13:59:04 -07:00
Joe Cheng a7a8354eee Add Net::SDP dependency to INSTALL.md 2012-09-28 13:10:32 -07:00
Albert Zeyer 151b50f5be Merge pull request #152 from hendrikw82/master
ios6 airplay announce message parsing bugfix  - Using Net:SDP
2012-09-26 23:18:42 -07:00
Ruben Jenster 3d6b913517 Pass name from init script to daemon 2012-09-02 13:13:39 +02:00
JH Laird 7df1fa7885 Merge pull request #154 from grefab/master
Fixes issue #147.
2012-07-15 21:11:51 -07:00
Gregor Fabritius 643f57d52b Initiating resync when receiving strange packet
The packet type 0x56, sequence number 0, containing 4 bytes (the first two are the sequence number of the previously requested packet) initiates a resync. Not sure what this packet is supposed to do, but it occurs after heavy requesting resending of packets. Seems to be an out of sync situation, so resyncing is not the worst idea.

Signed-off-by: Gregor Fabritius <gre@g0r.de>
2012-07-16 01:27:08 +02:00
Gregor Fabritius c4ec84d398 Fixed Issue #147: Segfaults on ShairPort version 0.05 C port
When requesting resend of packets a lot, iOS sometimes sends a packet with type 0x56 (Reply to resend request), but with sequence number 0 and length == 4. This short length leads to memory corruption later on when processing the packet: alac_decode() expects at least 16 bytes for AES IV. Therefore the segfault.

This fix ignores packets with length < 16, as seen in another implementation here:
http://fossies.org/dox/mythtv-0.25.1/mythraopconnection_8cpp_source.html#l00555

Please be aware that this just fixes the segfault. The suspicious packet seems to be an information of an out of sync situation, so it may deserve further attention.

Signed-off-by: Gregor Fabritius <gre@g0r.de>
2012-07-15 23:10:28 +02:00
hendrikw82 8b247119fd Makeing it iOS 6 compatibel using Net:SDP 2012-07-08 22:56:09 +03:00
Albert Zeyer f1fd87fe69 Merge pull request #145 from choongng/master
Play silence while audio is paused.
2012-06-03 05:40:18 -07:00
Choong Ng 5eee657bac Play silence while stream is paused to avoid audio glitches when used with JACK. 2012-04-14 23:46:50 -07:00
JH Laird 58a6ab8818 Merge pull request #140 from timdoug/howl-support
Add support for mDNSPublish, from the howl zeroconf implementation.
2012-02-27 00:28:08 -08:00
Tim Douglas ebe637f0ca Add support for mDNSPublish, from the howl zeroconf implementation.
Howl hasn't been actively developed for some years now; their website 404s,
and the Wayback Machine archive of 2008 says it's dead.[1] Yet it's still
functional and is much smaller than dbus and avahi, which makes it useful
for embedded systems. In fact, OpenWrt has not dropped support for the howl
tools, and it's because of howl that I can fit a functional shairport and
supporting libraries and kernel onto the 4MB of flash in a TP-LINK
TL-WR703N.[2]

[1] http://web.archive.org/web/20080917182117/http://www.porchdogsoft.com/products/howl/
[2] http://embeddedtimes.blogspot.com/2011/09/tp-link-tl-wr703n-tiny-linux-capable.html
2012-02-26 23:30:59 -08:00
JH Laird ceb2fbcd68 Merge pull request #139 from toofishes/math
hairtunes: math and dithering optimisations
2012-02-25 23:00:48 -08:00
Dan McGee db8b181038 hairtunes: implement a simple LCG-based RNG for dithering
We are calling out to libc's rand() function, which has significant
overhead, especially since we are calling it 88200 times per second
(2 channels * 44100 samples).

Implement a very simple linear congruential generator in our code that
is plenty good enough for dithering purposes, and small enough for the
compiler to optimize and inline.
2012-02-25 13:57:46 -06:00
Dan McGee fa95439b98 hairtunes: simplify and reorganize some floating point operations
The math operations are all equivalent, but are simplified a bit for the
benefit of processors with slower floating point performance.

* Don't use float casts when we need to eventually convert to double
  precision anyway.
* Use multiplication instead of division when possible.
2012-02-25 13:55:38 -06:00
Albert Zeyer f12f7a753b Merge pull request #138 from toofishes/cleanup
Cleanup, optimization, and bug fixes
2012-02-24 14:59:44 -08:00
Dan McGee b5a91cbebd Tabs to spaces conversion 2012-02-24 16:15:21 -06:00
Dan McGee 59d26d3a7c Use static where appropriate in shairport.c
Most functions don't need to be public outside of this file, so move all
the forward declarations out of shairport.h.
2012-02-24 16:14:43 -06:00
Dan McGee 435a866816 Add static to some functions in alac.c 2012-02-24 16:02:47 -06:00
Dan McGee 0b4c7ad4be hairplay: various small code cleanups 2012-02-24 15:53:30 -06:00
Dan McGee cd957048cb Use the audio buffer mutex appropriately
We need to use this any time we write to or access any of the
audio-buffer related variables. This also removes the need to use
'volatile', which cripples the compiler optimizations.
2012-02-24 15:53:28 -06:00
Dan McGee 8b1728d946 Use a pthread mutex around the volume settings
Using the `volatile` qualifier in multithreading code is never the right
answer. Mutexes should be used as was attempted with the audio buffer
code. Here, we implement a new mutex for the volume and fix_volume
globals, and grab a lock on it when necessary, which is for both reads
and writes.
2012-02-24 15:52:54 -06:00
Dan McGee 0a446a421d Return the correct value from biquad_filt()
If you turned set `debug = 1` in hairtunes, you'd quickly get a mess of
debug messages that showed bf_est_drift in bf_est_update() going quicky
out of range toward a float NaN value (usually negative). Clearly the
presence of this `out` variable in biquad_filt was meant to be used, not
marked as unused.
2012-02-24 15:52:54 -06:00
Dan McGee 74ed9c6fa2 hairtunes: use static keyword appropriately
This allows the compiler to do a much better job on this file, as it
currently can't inline most of the functions because they are
technically visible outside the file. Mark most functions and variables
static to let the compiler work.
2012-02-24 15:52:53 -06:00
Dan McGee 565b223bb0 Don't require extern usage of frame buffering value
This makes things a bit cleaner and easier to grasp.
2012-02-24 14:33:05 -06:00
Dan McGee 82e7cf8490 Fix dependency issue in Makefile
Make the dependency and compile command match in the resources used.
2012-02-24 14:24:10 -06:00
B. van BerkumandDan McGee be145fa704 Removed typo in Makefile 2012-02-24 14:20:06 -06:00
Stef SimoensandDan McGee d9964383e6 Improve resending of frames (and avoid missed frames)
- when requesting a packet, do not request an already received packet
- move the last-chance resend to buffer_get_frame
- check more often for missing frames
  own checks show that some frames need to be requested up to 4 times
  on bad connections
2012-02-24 14:18:52 -06:00
Dan McGee 7fcfd3ddac Small socketlib static and return value tweaks 2012-02-24 14:17:30 -06:00