Changeset 254

Show
Ignore:
Timestamp:
01/06/07 15:51:14 (2 years ago)
Author:
gbooker
Message:

There seems to be nothing wrong with kQTSoundDescriptionKind_Movie_Version2, so let's use it.
Added the exception for ac-3 audio in 5.1 to have the correct audio layout. We should add these for others as well.
*sniff* so wish we had parsers here to sort this out.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ff_private.c

    r223 r254  
    240240        } 
    241241         
    242         /* here use a version1, because version2 will fail! (no idea why) 
    243                * and as we are using version1, we may not have more than 2 channels. 
    244                * perhaps we should go to version2 some day. */ 
     242        AudioChannelLayout acl; 
     243        int aclSize = 0;  //Set this if you intend to use it 
     244        memset(&acl, 0, sizeof(AudioChannelLayout)); 
    245245        if(asbd.mChannelsPerFrame > 2) 
    246                 asbd.mChannelsPerFrame = 2; 
    247         err = QTSoundDescriptionCreate(&asbd, NULL, 0, NULL, 0, kQTSoundDescriptionKind_Movie_LowestPossibleVersion, &sndHdl); 
     246        { 
     247                /* We have to just guess what layout to use.  People, add them here: */ 
     248                if((asbd.mFormatID == 'ac-3' || asbd.mFormatID == 'ms \0') && asbd.mChannelsPerFrame == 5) 
     249                { 
     250                        /* likely really 5.1, but not absolutely sure.  guess it is, can't do any better */ 
     251                        asbd.mChannelsPerFrame++; 
     252                        acl.mChannelLayoutTag = kAudioChannelLayoutTag_ITU_3_2_1; 
     253                        aclSize = sizeof(AudioChannelLayout); 
     254                } 
     255        } 
     256        err = QTSoundDescriptionCreate(&asbd, aclSize == 0 ? NULL : &acl, aclSize, NULL, 0, kQTSoundDescriptionKind_Movie_Version2, &sndHdl); 
    248257        if(err) fprintf(stderr, "AVI IMPORTER: Error creating the sound description\n"); 
    249258