Archive for October, 2006

Native FLAC in iTunes/QuickTime

October 12th, 2006

I feel a bit guilty about not publishing this before. But, you know, it was kind-of working, I had some time so I thought I’d re-write it in a way similar to OggImporter. Then I stopped having time. Thus, I accept those e-mails asking about native FLAC support as a deserved punishment.

The FLACImporter.component I’m writing about is actually a slightly modified importer component from Damien Drix’s QuickTime FLAC Plugin. Basically I removed the decoder part (which stopped working properly in QuickTime 7), changed codec IDs to match those found in XiphQT and made a Universal build. As it is, it parses and imports native FLAC files and then the decoding part is done by CAFLAC component, part of XiphQT.

You can find the binary files and source patch here. But read on, because it’s not all that rosy…

The component used to work when I first played with it, and it still does - in QuickTime Player (and a number of other QuickTime-based apps) that is. It doesn’t have all the functionality of the OggImporter, and performance could be better, too. But it works, it plays the FLAC files.

But… you guessed it right: iTunes. iTunes is something else. On my machine iTunes plays native FLAC files fine, yes, but they need to be in iTunes Library already. That is - it won’t (easily) accept new files with the .flac extension.

During my tests I discovered, however, that iTunes will accept .flac files if you set their FSTypeCode to something popular and openable with QuickTime, like ‘MooV’ (original FSType of .mov QuickTime Movie files) or… ‘OggS’! Which is the FSType used by OggImporter component to denote .ogg files. And that’s quite an intriguing discovery, since both components use nearly perfectly identical steps to register with the OS! How come?! To test, I created a copy of OggImporter that only uses different FSType and file extensions - and it doesn’t work. So, how’s that? Does iTunes have the ‘.ogg’ and ‘OggS’ hardcoded somewhere? Is my machine’s OS going slightly crazy? Am I missing something? I’ll try to investigate that…

But for now, the summary. The FLACImporter should work in QuickTime (you’ll need the XiphQT package, as well). It should work in iTunes, but there may be problems with adding .flac files to your library. If you can’t add them, and don’t mind a bit of cheating, you can set the FSType of you FLAC files to ‘OggS’ (or ‘MooV’, but ‘OggS’ should work). You can set it with SetFile tool from the developer packages (/Developer/Tools/SetFile). On the FLACImporter page you can also find a simple python script I wrote that should work on a machine without dev packages installed. Setting slightly-not-true FSType should be harmless and is reversible (set FSType to 0). In case I/someone finds a better solution…

Note on the Intel part of the binary: it’s untested. Let me know if doesn’t work. No Win32 binaries either, since I don’t have a machine to compile it at the moment.

So, is it working for you? How about the strange iTunes behaviour - anybody able to shed some light on the puzzle?

On One

October 12th, 2006

I guess it’s rather impossible to write ‘First post!’ in the second post or any other one. So, here: This is my first post in my new blog!


I think I should also say that not everything here is in its final shape. But at least (and at last!) it’s a start. And significant improvement, too, over the “gathering material” notice being on display on the index page for almost a year.

So, let’s see if I can make things even better…