HDHomeRun streaming to XBMC (and Boxee) on the Mac

Background


Silicon Dust's HDHomeRun network devices incorporate tuners for over-the-air and unencrypted cable HDTV broadcasts.

XBMC has supported streaming from these devices since around March 2007.  I don't know when this stopped working in the Mac port -- or if it ever worked -- but it didn't work when I first tried it in early January, 2009.  

I thought it would cool if it worked, so I came up with a quick'n'dirty, temporary hack to get it working.  Skip to "The Quick Fix" at the end of this page if you want to download it and try it.

Making Channel Files

Starting with December 27, 2008's beta release, Silicon Dust's HDHomeRun Setup utility will auto-generate create ".strm" channel files with correctly-constructed "hgdhomerun:" URLs and channel labels from the broadcast metadata.  This currently only works on the PC version.

The "7.1 WHDH-HD.strm" file creates this URL for Boston's WHDH Channel "7": 

hdhomerun://1011610B/tuner0?channel=8vsb:641000000&program=3

Problem 1: A missing library

As far as I can tell, the problem is as simple as a missing library.  Neither XBMC 8.10 'Atlantis' nor Boxee Alpha 0.9.7.4825 ship with the "hdhomerun-osx.so" library required to communicate with HDHomeRun devices.

Here's what XBMC logs when you it tries to launch an "hdhomerun:" url:

21:30:34 T:2961051648 M:109535232 DEBUG: Running thread 2961051648
21:30:34 T:2691958560 M:109535232 WARNING: CDVDMessageQueue::Put MSGQ_NOT_INITIALIZED
21:30:34 T:2961051648 M:109514752 DEBUG: thread start, auto delete: 1
21:30:34 T:2961858560 M:109510656 DEBUG: Running thread 2961858560
21:30:34 T:2961858560 M:109510656 DEBUG: thread start, auto delete: 0
21:30:34 T:2961858560 M:109498368 NOTICE: Creating InputStream
21:30:34 T:2961858560 M:109449216 DEBUG: Loading: /Applications/XBMC.app/Contents/Resources/XBMC/system/hdhomerun-osx.so
21:30:34 T:2961858560 M:109457408 
ERROR: Unable to load /Applications/XBMC.app/Contents/Resources/XBMC/system/hdhomerun-osx.so, reason: dlopen(/Applications/XBMC.app/Contents/Resources/XBMC/system/hdhomerun-osx.so, 1): image not found
21:30:34 T:2961858560 M:109449216 ERROR: CDVDPlayer::OpenInputStream - error opening [hdhomerun://1011610B/tuner0?channel=8vsb:641000000&program=3]
[...]
21:30:34 T:2691958560 M:108322816 ERROR: Playlist Player: skipping unplayable item: 0, path [hdhomerun://1011610B/tuner0?channel=8vsb:641000000&program=3
]


Problem 2: API change in libhdhomerun


I didn't really think that simply downloading the latest release of libhdhomerun, compiling it, and copying into the XBMC.app "directory" would work.


And it didn't, but not for the reason I thought.

According to Silicon Dust's jafa, the function which XBMC uses to discover HDHomeRun devices on the network, hdhomerun_discover_find_devices(), has been replaced with hdhomerun_discover_find_devices_custom().

I have a lot of respect for jafa and all that he's done with HDHomeRun and Tivo hardware upgrades before that (my DirecTV Series 1 Tivo has an ethernet jack thanks to his hacker wizardry), but such an API change seems unwise, especially if a high-profile project like XBMC is relying on the original function to be there.

The two functions did co-exist in the version of the libhdhomerun source which was incorporated into the XBMC SVN repository in 2007.  What's really odd is that they both appear to be convenience functions which just call 
hdhomerun_discover_find_devices_internal() with only one parameter different (a target IP for the _custom flavor, or 0 for the missing version).


The Quick Fix

I'm a linux hacker and a Mac user (for now), so I still haven't been able to get XCode and all the MacPort stuff set up so I can even compile the XBMC on the Mac.  So instead, I just downloaded the "20081231" snapshot of libhdhomerun from Silicon Dust's download page and re-added the necessary function based on what was in the XBMC SVN.  

Download the attached "libhdhomerun.so" binary or build it from the attached TAR file.  Then, just rename it and move it to where XBMC expects to see it:

$ cp libhdhomerun.so /Applications/XBMC.app/Contents/Resources/XBMC/system/hdhomerun-osx.so 

for Boxee:

$ cp libhdhomerun.so /Applications/Boxee.app/Contents/Resources/Boxee/system/hdhomerun-osx.so 


The Real Fix 

  • Fix the XBMC's build to include the libhdhomerun code. 
then
  • Update libhdhomerun to restore the missing function
or 
  • Update XBMC code to use the new "_custom" discovery function.

Reference



XBMC forum thread "HDHomeRun not working in XBMC for Mac?" Jan 4, 2009 by grywaslr 


Silicon Dust forum thread "what happened to hdhomerun_discover_find_devices() ?" Jan 5, 2009 by me

ċ
libhdhomerun.so
(95k)
Jeffrey Breen,
Jan 10, 2009, 2:46 PM
ċ
libhdhomerun_20081231_hacked.tar.gz
(99k)
Jeffrey Breen,
Jan 10, 2009, 2:46 PM
Comments