Changeset 1128

Show
Ignore:
Timestamp:
08/27/09 12:04:50 (6 months ago)
Author:
astrange
Message:

Fake some 96khz SBR AAC as 48khz LC AAC.

They tend to play silence or weird noises in QT
when other decoders work fine. Might be our fault
or theirs, not quite sure yet.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/MatroskaCodecIDs.cpp

    r1088 r1128  
    379379}; 
    380380 
     381static bool ShouldWriteSBRExt(unsigned output_freq_index) 
     382{ 
     383        if (output_freq_index == 0) 
     384                return CFPreferencesGetAppBooleanValue(CFSTR("Allow96kSBR"), PERIAN_PREF_DOMAIN, NULL); 
     385         
     386        return true; 
     387} 
     388 
    381389static int FindAACFreqIndex(double freq) 
    382390{ 
     
    415423        if (outputFreq) { 
    416424                unsigned output_freq_index = FindAACFreqIndex(*outputFreq); 
    417                  
    418                 //SBR extension 
    419                 //not sure why we still use object type 2 (LC) instead of 5 (HE) 
    420                 *vosBuf++ = 0x56
    421                 *vosBuf++ = 0xE5
    422                 *vosBuf++ = 0x80 | (output_freq_index << 3); 
     425                                
     426                if (ShouldWriteSBRExt(output_freq_index)) { 
     427                       *vosBuf++ = 0x56; 
     428                       *vosBuf++ = 0xE5
     429                       *vosBuf++ = 0x80 | (output_freq_index << 3)
     430                } 
    423431        } 
    424432         
     
    526534        size_t esdsLen; 
    527535         
    528         if (audio && !vosBuf) { 
     536        // vosLen > 2 means SBR; some of those must be rewritten to avoid QT bugs(?) 
     537        // FIXME remove when QT works with them 
     538        if (audio && (!vosBuf || vosLen > 2)) { 
    529539                RecreateAACVOS(tr_entry, aacBuf, &vosLen); 
    530540                vosBuf = aacBuf;