Edit AllPages

I am trying to extract the metadata tags (name, artist, album, etc) from an M4P file using QuickTimes carbon UserData functions. However unlike MP3’s which return a nice bunch of tags it M4P’s return a massive blob of data with no obvious use,. Does anyone have any idea what this blob of data is and how to interpret it? The code i am using is as follows

Thanks in advance.


If you’re developing for 10.4+, try using the Spotlight APIs to get this info.

Note that Spotlight won’t work for files that aren’t indexed, such as files on remote drives, or anything in an exclusion directory.

I don’t know the answer but I spotted one error in your code, which may have some bearing on the “blob of data” effect. [NSData dataWithBytes:(const void )handle length:GetHandleSize(handle)]; - dataWithBytes: expects a pointer to some data. A handle is a *pointer to a pointer to some data, so you have to dereference it at least once. So I suspect this should be [NSData dataWithBytes:(const void *) *handle length:GetHandleSize(handle)];. At present your NSData will contain bytes copied from the Carbon-style memory manager master pointer list, which is probably not what you wanted. In OSX, these tables are still maintained for compatibility - i.e. handles are still handles, and don’t become ordinary pointers on OSX. Also, not that it matters, but HLock and HUnlock do nothing on OSX, so you don’t need them (and this code can’t run on <OSX because it contains Cocoa code). However they are harmless. –GrahamCox