Thoughts and Ramblings

General things I find of interest.

Working With Core Data

When I redesigned Sapphire, I decided that the metadata back end would be best served by Apple’s Core Data Framework. While the framework has a lot of power, several shortcomings in the implementation hindered its potential.

First, I should start with the many things that Apple did correctly in Core Data.

  • The whole data model with relationships and properties is quite powerful. With this data model, one can represent many data sets in a simple manner, such as the example below:
    core-data-model
    core-data-model
    This example shows part of the data model within Sapphire pertaining to TV shows, where a TV shows contains multiple seasons, each of which contains multiple episodes. Additionally, an episode contains one or more sub-episodes, to handle the case where a single file or DVD contains multiple episodes. Lastly, the show and season objects extend from a superclass CategoryDirectory, which contains some common properties to all collections.
  • Since the relationships are defined, they can be automatically maintained. In the above example, if an episode’s show relationship is set to a particular TVShow object, that show’s object will automatically have the episode added to its episodes relationship.
  • Delete rules can be set such that if an object is removed, the delete can cascade to remove other objects as well. This is useful in the case of removing a directory, and all the files and directories contained within it.
  • Saving to a file is easy since the details of reading and writing a file are handled by Core Data
  • While I didn’t use it, undo management is also built into the system.

So, with all these advantages, why is Core Data not used more often. The answer is that it contains numerous short comings.


AC3 Passthrough Compatibility Matrix

Since some parts of AC3 passthrough work, and others do not, I decided to create a bit of a compatibility matrix to summarize it. I’ve added the related bug id’s I’ve reported, which have gone unanswered, in parentheses.

The latest version of perian (to be released soon), will choose between using the hack method for passthrough, and Apple’s method. Anywhere labeled “Hack” will never work with Apple’s method, so it is bypassed to avoid their broken code. The hack does not work with all 5.1 receivers. Taking a file format which is not properly framed, and making it into a .mov file will not correct the framing. Likewise, it will not destroy the framing of a properly framed file format.


Java in Xcode

Well, I have had reason with my research to do some Java development. No biggie, Xcode supports Java too, right? Wrong! well mostly. This all came to a head when I downloaded the latest beta of Xcode (which I am only using because these fix a serious performance issue with the non-beta releases). After the last download, I found 4 distinct bugs in 2 hours, and I’m still finding them. Two of these are Java related, so I gave up, and looked for alternatives.


Limited Real AC3 Passthrough

Well, I got to fiddling around with the existing passthrough on the AppleTV. I found where it works, and where it doesn’t. AC3 passthrough does work in .mov files with 48KHz files, of any bit rate. I did this with importing a .ac3 file into .mov, and adding a video track (ATV doesn’t like playing audio only files). I still need to test 44.1KHz, and 32KHz, but they are a bit harder to find. I have still to come across one of them.


The Correct Way to Enable AC3 Passthrough with Quicktime

I have seen a few people post methods about enabling AC3 passthrough, and many of them are overly complicated or in some cases even wrong. This also serves as the first place to describe how to enable DTS passthrough. Since I designed the code that actually does this, I’ll list the steps here:
Note: This does not work with all receivers. If these instructions fail for you, most likely your receiver will not work with this. Passthrough is still a hack, and thus this hack is still outside of the specs.
Note 2: Apple broke AC3 rather seriously in QT 7.3 (bug id 5594478, go tell them to fix it). If have a .mov file, open it, and it says that it is stereo audio rather than 5.1, this is a symptom of that bug. You will need to have at least Perian 1.1 and re-open the original file that made the .mov file. This bug has been fixed in 7.4.5, but any .mov files created with QT 7.3 or 7.4 are still affected by this bug.
Note 3: Perian 1.1.4 contains a bug in which DTS passthrough fails to work. This will be fixed in the next version. This has been fixed in Perian 1.2, released Dec 17, 2009.