Changeset 1148
- Timestamp:
- 09/13/09 01:59:21 (11 months ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
CodecIDs.h (modified) (1 diff)
-
FFissionCodec/FFissionDecoder.cpp (modified) (6 diffs)
-
MatroskaCodecIDs.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/CodecIDs.h
r1119 r1148 105 105 106 106 #ifndef REZ 107 struct 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 117 typedef struct WaveFormatEx WaveFormatEx; 118 107 119 int getCodecID(OSType componentType); 108 120 #endif -
trunk/FFissionCodec/FFissionDecoder.cpp
r1144 r1148 50 50 { kAudioFormatMPEGLayer2, CODEC_ID_MP2 }, 51 51 { kAudioFormatMPEGLayer1, CODEC_ID_MP1 }, 52 { 0x6d730050, CODEC_ID_MP2 }, 53 { kAudioFormatTTA, CODEC_ID_TTA }, 52 { 'ms\0\0' + 0x50, CODEC_ID_MP2 }, 54 53 { kAudioFormatDTS, CODEC_ID_DTS }, 55 54 { kAudioFormatNellymoser, CODEC_ID_NELLYMOSER }, 55 { kAudioFormatTTA, CODEC_ID_TTA}, 56 56 { 0, CODEC_ID_NONE } 57 57 }; … … 80 80 81 81 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) 86 static void ParseWaveFormat(const WaveFormatEx *wEx, AVCodecContext *avContext) 87 { 88 avContext->block_align = wEx->nBlockAlign; 89 avContext->bit_rate = wEx->nAvgBytesPerSec * 8; 82 90 } 83 91 … … 135 143 if (inMagicCookieByteSize > 0) 136 144 SetMagicCookie(inMagicCookie, inMagicCookieByteSize); 137 145 138 146 FFissionCodec::Initialize(inInputFormat, inOutputFormat, inMagicCookie, inMagicCookieByteSize); 139 147 … … 178 186 { 179 187 if (!magicCookie) return; 180 188 181 189 switch (formatID) { 182 190 case kAudioFormatWMA1MS: … … 186 194 return; 187 195 196 ParseWaveFormat((WaveFormatEx*)(magicCookie + 12 + 8), avContext); 197 188 198 avContext->extradata = magicCookie + 12 + 18 + 8; 189 199 avContext->extradata_size = magicCookieSize - 12 - 18 - 8 - 8; … … 304 314 // check to make sure the input format is legal 305 315 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)); 307 317 CODEC_THROW(kAudioCodecUnsupportedFormatError); 308 318 } -
trunk/MatroskaCodecIDs.cpp
r1146 r1148 585 585 } 586 586 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 609 587 ComponentResult MkvFinishSampleDescription(KaxTrackEntry *tr_entry, SampleDescriptionHandle desc, DescExtDirection dir) 610 588 { … … 771 749 if (codecString == MKV_A_MS) { 772 750 PtrToHand(codecPrivate.GetBuffer(), cookie, codecPrivate.GetSize()); 773 ASBDExt_MSACM(tr_entry, asbd);774 751 } 775 752
