Information and Links
Detecting protected AAC files in QuickTime
Recently, I needed to be able to check if AAC files passed to my application were Protected AACs from the iTunes Music Store or not.
Here’s the C code I used to do this:
extern Boolean FirstSoundTrackIsAProtectedAAC (Movie theMovie)
{
OSStatus osErr;
Track theTrack;
Media theMedia;
Boolean isProtected = false;
// get the first enabled sound track
theTrack = GetMovieIndTrackType(theMovie, 1, AudioMediaCharacteristic, movieTrackCharacteristic | movieTrackEnabledOnly);
if (theTrack != NULL) {
// get the sound track media
theMedia = GetTrackMedia(theTrack);
if (theMedia != NULL) {
SampleDescriptionHandle sourceSoundDescription;
sourceSoundDescription = (SampleDescriptionHandle)NewHandle(0);
// get the description of the sample data
GetMediaSampleDescription(theMedia, 1, sourceSoundDescription);
osErr = GetMoviesError();
// printf("dataFormat is %.4s\n", &(*sourceSoundDescription)->dataFormat);
if ((*sourceSoundDescription)->dataFormat == 'drms') {
isProtected = true;
}
DisposeHandle((Handle)sourceSoundDescription);
}
}
return isProtected;
}
This specifically checks the first soundtrack of a movie. More generally, you might want to check every track for protected content if you are to export any movie given to you.



thank you!
Very helpful indeed. Didn’t need the AAC functionality.
But a working code snippet helps ALLOT!
If the rest of QuickTime would be covered equally well then we might have something. Well, if it would be open source, then that would be great!
Andreas, who is happy that he saved 10 minutes via google and this website and who will look for the paypal button here now …