Changeset 1148

Show
Ignore:
Timestamp:
09/13/09 01:59:21 (11 months ago)
Author:
astrange
Message:

Revert r1145.

Instead parse it in FFission so it gets picked up
by FormatInfo?.

Not actually tested since I realized MKV+MS ACM
codecs don't even work in the first place, but
it might fix some WMA2 AVI where we didn't
set bit_rate properly before.

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/CodecIDs.h

    r1119 r1148  
    105105 
    106106#ifndef REZ 
     107struct WaveFormatEx { 
     108        uint16_t wFormatTag; 
     109        uint16_t nChannels; 
     110        uint32_t nSamplesPerSec; 
     111        uint32_t nAvgBytesPerSec; 
     112        uint16_t nBlockAlign; 
     113        uint16_t wBitsPerSample; 
     114        uint16_t cbSize; 
     115} __attribute__((packed)); 
     116 
     117typedef struct WaveFormatEx WaveFormatEx; 
     118 
    107119int getCodecID(OSType componentType); 
    108120#endif 
  • trunk/FFissionCodec/FFissionDecoder.cpp

    r1144 r1148  
    5050        { kAudioFormatMPEGLayer2, CODEC_ID_MP2 }, 
    5151        { kAudioFormatMPEGLayer1, CODEC_ID_MP1 }, 
    52         { 0x6d730050, CODEC_ID_MP2 }, 
    53         { kAudioFormatTTA, CODEC_ID_TTA }, 
     52        { 'ms\0\0' + 0x50, CODEC_ID_MP2 }, 
    5453        { kAudioFormatDTS, CODEC_ID_DTS }, 
    5554        { kAudioFormatNellymoser, CODEC_ID_NELLYMOSER }, 
     55        { kAudioFormatTTA, CODEC_ID_TTA}, 
    5656        { 0, CODEC_ID_NONE } 
    5757}; 
     
    8080         
    8181        return false; 
     82} 
     83 
     84// parse waveformatex in extradata back into the AVCodecContext 
     85// block_align is then put into the ASBD when clients call FormatInfo (well, hopefully) 
     86static void ParseWaveFormat(const WaveFormatEx *wEx, AVCodecContext *avContext) 
     87{ 
     88        avContext->block_align = wEx->nBlockAlign; 
     89        avContext->bit_rate = wEx->nAvgBytesPerSec * 8; 
    8290} 
    8391 
     
    135143        if (inMagicCookieByteSize > 0) 
    136144                SetMagicCookie(inMagicCookie, inMagicCookieByteSize); 
    137          
     145                 
    138146        FFissionCodec::Initialize(inInputFormat, inOutputFormat, inMagicCookie, inMagicCookieByteSize); 
    139147         
     
    178186{ 
    179187        if (!magicCookie) return; 
    180          
     188                 
    181189        switch (formatID) { 
    182190                case kAudioFormatWMA1MS: 
     
    186194                                return; 
    187195                         
     196                        ParseWaveFormat((WaveFormatEx*)(magicCookie + 12 + 8), avContext); 
     197                                                 
    188198                        avContext->extradata = magicCookie + 12 + 18 + 8; 
    189199                        avContext->extradata_size = magicCookieSize - 12 - 18 - 8 - 8; 
     
    304314        // check to make sure the input format is legal 
    305315        if (avcodec_find_decoder(codecID) == NULL) { 
    306                 Codecprintf(NULL, "Unsupported input format id %4.4s\n", &inInputFormat.mFormatID); 
     316                Codecprintf(NULL, "Unsupported input format id %s\n", FourCCString(inInputFormat.mFormatID)); 
    307317                CODEC_THROW(kAudioCodecUnsupportedFormatError); 
    308318        } 
  • trunk/MatroskaCodecIDs.cpp

    r1146 r1148  
    585585} 
    586586 
    587 struct WAVEFORMATEX { 
    588         uint16_t wFormatTag; 
    589         uint16_t nChannels; 
    590         uint32_t nSamplesPerSec; 
    591         uint32_t nAvgBytesPerSec; 
    592         uint16_t nBlockAlign; 
    593         uint16_t wBitsPerSample; 
    594         uint16_t cbSize; 
    595 } __attribute__((packed)); 
    596  
    597 ComponentResult ASBDExt_MSACM(KaxTrackEntry *tr_entry, AudioStreamBasicDescription *asbd) 
    598 { 
    599         if (!tr_entry || !asbd) return paramErr; 
    600         KaxCodecPrivate *codecPrivate = FindChild<KaxCodecPrivate>(*tr_entry); 
    601         if (!codecPrivate || codecPrivate->GetSize() < sizeof(WAVEFORMATEX)) return noErr; 
    602         WAVEFORMATEX *wEx = (WAVEFORMATEX*)codecPrivate->GetBuffer(); 
    603          
    604         asbd->mBytesPerPacket = EndianU16_LtoN(wEx->nBlockAlign); 
    605          
    606         return noErr; 
    607 } 
    608  
    609587ComponentResult MkvFinishSampleDescription(KaxTrackEntry *tr_entry, SampleDescriptionHandle desc, DescExtDirection dir) 
    610588{ 
     
    771749        if (codecString == MKV_A_MS) { 
    772750                PtrToHand(codecPrivate.GetBuffer(), cookie, codecPrivate.GetSize()); 
    773                 ASBDExt_MSACM(tr_entry, asbd); 
    774751        } 
    775752