Changeset 261
- Timestamp:
- 01/06/07 22:12:17 (2 years ago)
- Files:
-
- trunk/MatroskaImport.h (modified) (1 diff)
- trunk/MatroskaImportPrivate.cpp (modified) (4 diffs)
- trunk/bitstream_info.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/MatroskaImport.h
r242 r261 73 73 QTSampleDescriptionID qtSampleDesc; 74 74 SInt64 timecodeScale; 75 bool seenFirstFrame; 75 76 76 77 private: trunk/MatroskaImportPrivate.cpp
r245 r261 45 45 #include "CommonUtils.h" 46 46 #include "Codecprintf.h" 47 #include "bitstream_info.h" 47 48 48 49 using namespace std; … … 559 560 qtSampleDesc = 0; 560 561 timecodeScale = 1000000; 562 seenFirstFrame = false; 561 563 } 562 564 … … 580 582 qtSampleDesc = copy.qtSampleDesc; 581 583 timecodeScale = copy.timecodeScale; 584 seenFirstFrame = copy.seenFirstFrame; 582 585 583 586 for (int i = 0; i < copy.lastFrames.size(); i++) … … 598 601 KaxBlock & block = GetChild<KaxBlock>(blockGroup); 599 602 KaxBlockDuration & blockDuration = GetChild<KaxBlockDuration>(blockGroup); 603 604 if (!seenFirstFrame) { 605 // we want to parse the first ac3 frame so that we can get a more correct channel layout 606 if ((*desc)->dataFormat == kAudioFormatAC3) { 607 AudioStreamBasicDescription asbd = {0}; 608 AudioChannelLayout acl = {0}; 609 610 if (parse_ac3_bitstream(&asbd, &acl, block.GetBuffer(0).Buffer(), block.GetFrameSize(0))) { 611 // successful in parsing, so the acl and asbd are more correct than what we generated in 612 // AddAudioTrack() so replace our sound description 613 SoundDescriptionHandle sndDesc = NULL; 614 asbd.mFormatID = kAudioFormatAC3; 615 616 OSStatus err = QTSoundDescriptionCreate(&asbd, &acl, sizeof(AudioChannelLayout), NULL, 0, 617 kQTSoundDescriptionKind_Movie_AnyVersion, &sndDesc); 618 if (err == noErr) { 619 DisposeHandle((Handle) desc); 620 desc = (SampleDescriptionHandle) sndDesc; 621 } 622 } 623 } 624 seenFirstFrame = true; 625 } 600 626 601 627 for (int i = 0; i < lastFrames.size(); i++) { trunk/bitstream_info.h
r256 r261 11 11 #include <QuickTime/QuickTime.h> 12 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 13 17 int parse_ac3_bitstream(AudioStreamBasicDescription *asbd, AudioChannelLayout *acl, uint8_t *buffer, int buff_size); 18 19 #ifdef __cplusplus 20 } 21 #endif
