Monday, December 25, 2006

Static Libraries dependent upon static libraries in XCode

Just a helpful hint to try and prevent your wasting time like we did at my day job. We have a large C++ application which has several different levels (Standard, Pro, Ultra....). So to speed compilation and linking, we put large chunks of code common to all the levels into separately compiled static libraries. Thus, we only have to compile that code once every time we build all the applications, resulting in a massive time savings.

Unfortunately, this was not working under XCode as when we linked in our libraries, there was always some symbol or other which was not available, and we ended up putting large amounts of code into the main project and compiling it for each application level (making our build process at least twice as long as it should have been).

My boss finally got so sick of this he spent a couple days tracking down the problem, and it was that our static libraries were dependent upon other static libraries, but those libraries were not linked in until the application as a whole was linked. Somehow, this confused the XCode linker (ld) and it ended up missing symbols. The trick was to link the other sub-dependent libraries into the libraries static libraries and not directly from the main project.

I know the above is confusing. Here's a more graphical description.
(Before)

  • Main Project

    • Static Library 1 Project (needs Static Library 2 & 3)

    • Static Library 2 Project

    • Static Library 3 Project


(Now)
  • Main Project

    • Static Library 1 Project (needs Static Library 2 & 3)

      • Static Library 2 Project

      • Static Library 3 Project

Saturday, December 02, 2006

HDHomeRun - Networked HDTV Tuner

[Update: check out Signal GH, an iPhone utility for monitoring the signal quality of an HDHomerun].

I have a PCHDTV 3000 PCI card in the Dell Dimension which serves as my MythTV. Since DVB drivers became part of the standard Fedora install, it has been problem-free. But, it doesn't meet all of my needs.

First, there are occasions when the broadcast networks show 2 or even 3 good shows at once. I'd like to be able to catch these rare alignments, but my PCHDTV can only record one show at once. I could buy another, but that would be the last open PCI slot in the Dimension, and what if I wanted to expand internal storage later with an SATA card? Second, the MythTV was banished to the basement for excessive noise, which means it is about 80 feet of RG6 cable from the main antenna splitter in the second bedroom, meaning it is getting less signal, and noisier signal than an upstairs device. Third, to be useful, the MythTV has to be on all the time, which means draining a minimum of $9/month of electricity. Fourth, I've never been able to figure how to access a PCHDTV card with non-root level privileges; I'm sure it's possible, I just can't figure it out, which means I run the mythtv backend as root. This is frowned upon.

Then, I came across the HDHomeRun networked digital TV tuner (both ATSC and QAM). This simultaneously overcomes all 4 problems with the PCHDTV.
  • It has 2 tuners.
  • It doesn't use up a PCI slot.
  • It can be located as close to the antenna as I like.
  • It can be accessed via any user account with network access.
  • I can access the data stream directly from my MacBook, albeit kludgily, even when my MythTV is off. [Update: It is no longer cludgy on the Mac. You can buy an HDHomerun bundled with El Gato's slick EyeTV application.]



It does cost more than a PCHDTV, but less than two.

I held out for a while, but I finally ordered one. It came Wednesday. I've been happy.

MythTV 0.20 has built in support for this device. However, be warned that you have to open your firewall to its traffic. If you try to run mythtv-setup and you can't get it to scan for channels. Maybe it's your firewall.

I was amazed by how well my MythTV box pumped massive amounts of data. At one time, I simultaneously recorded 3 HD programs over the air--2 over Ethernet from the HDHomeRun, and 1 via the PCHDTV--while watching a recording of Day Break from the night before, and it was smooth as silk. There have been a lot of improvements in MythTV over the last year; I don't think it could have taken all this back then on my aging hardware.

Lately, whenever I buy new hardware, I measure it's electrical usage. There is a hidden cost to every gadget we buy. According to my Kill-A-Watt, my HDHomeRun draws 6 Watts at all times, whether capturing or not [Update: I've heard that subsequent revisions (those you would buy new today) use less power] . A low power mode while awaiting network commands would be nice, but the usage isn't bad compared to the 90 Watts the MythTV box draws. So it's less than a dollar a month to power it. However low the power, it does get a little warm, and I worry about it's life span, but time will tell.

In order to control the device from my Mac, I downloaded the hdhomerun_config source code from the Silicon Dust Forum. It was a simple matter to create an XCode project and compile the command line tool for Mac OS X, and I could then use the instructions for using VLC to watch TV directly from the device on my MacBook. Entering a series of obscure command line commands is much too klunky, and I hope VLC will absorb these functions, but it did work and looked great on the 13.3 inch screen.
 
Google+