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.