Changeset 397
- Timestamp:
- 04/01/07 14:00:38 (2 years ago)
- Files:
-
- trunk/MatroskaImport.h (modified) (2 diffs)
- trunk/MatroskaImportPrivate.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/MatroskaImport.h
r393 r397 87 87 // adds the all the frames in the block group to the sample table if it exists, 88 88 // the media otherwise. If this track type is subtitle, also inserts it into the track. 89 void AddBlock(Kax BlockGroup &blockGroup);89 void AddBlock(KaxInternalBlock &block, uint32 duration, short flags); 90 90 91 91 // this adds all the samples added through AddBlock() to the track that aren't already … … 115 115 // parses the first frame of a supported data format to determine codec parameters, 116 116 // which can be more correct than the codec headers. 117 void ParseFirstBlock(Kax Block &block);117 void ParseFirstBlock(KaxInternalBlock &block); 118 118 119 119 // Since the duration in Matroska files is generally rather unreliable, rely only on trunk/MatroskaImportPrivate.cpp
r393 r397 703 703 cluster.InitTimecode(uint64(clusterTime), timecodeScale); 704 704 705 KaxBlockGroup *blockGroup = FindChild<KaxBlockGroup>(cluster); 706 while (blockGroup && blockGroup->GetSize() > 0) { 707 KaxBlock & block = GetChild<KaxBlock>(*blockGroup); 708 block.SetParent(cluster); 709 710 for (int i = 0; i < tracks.size(); i++) { 711 if (tracks[i].number == block.TrackNum()) { 712 tracks[i].AddBlock(*blockGroup); 713 break; 705 for (int i = 0; i < cluster.ListSize(); i++) { 706 const EbmlId & elementID = EbmlId(*cluster[i]); 707 KaxInternalBlock *block = NULL; 708 uint32_t duration = 0; 709 short flags = 0; 710 711 if (elementID == KaxBlockGroup::ClassInfos.GlobalId) { 712 KaxBlockGroup & blockGroup = *static_cast<KaxBlockGroup *>(cluster[i]); 713 block = &GetChild<KaxBlock>(blockGroup); 714 duration = uint32(GetChild<KaxBlockDuration>(blockGroup)); 715 flags = blockGroup.ReferenceCount() > 0 ? mediaSampleNotSync : 0; 716 717 } else if (elementID == KaxSimpleBlock::ClassInfos.GlobalId) { 718 KaxSimpleBlock & simpleBlock = *static_cast<KaxSimpleBlock *>(cluster[i]); 719 block = &simpleBlock; 720 if (!simpleBlock.IsKeyframe()) 721 flags |= mediaSampleNotSync; 722 if (simpleBlock.IsDiscardable()) 723 flags |= mediaSampleDroppable; 724 } 725 726 if (block) { 727 block->SetParent(cluster); 728 729 for (int i = 0; i < tracks.size(); i++) { 730 if (tracks[i].number == block->TrackNum()) { 731 tracks[i].AddBlock(*block, duration, flags); 732 break; 733 } 714 734 } 715 735 } 716 717 blockGroup = &GetNextChild<KaxBlockGroup>(cluster, *blockGroup);718 736 } 719 737 … … 812 830 } 813 831 814 void MatroskaTrack::ParseFirstBlock(Kax Block &block)832 void MatroskaTrack::ParseFirstBlock(KaxInternalBlock &block) 815 833 { 816 834 AudioStreamBasicDescription asbd = {0}; … … 838 856 } 839 857 840 void MatroskaTrack::AddBlock(KaxBlockGroup &blockGroup) 841 { 842 KaxBlock & block = GetChild<KaxBlock>(blockGroup); 843 KaxBlockDuration & blockDuration = GetChild<KaxBlockDuration>(blockGroup); 844 858 void MatroskaTrack::AddBlock(KaxInternalBlock &block, uint32 duration, short flags) 859 { 845 860 if (!seenFirstBlock) { 846 861 ParseFirstBlock(block); … … 865 880 MatroskaFrame newFrame; 866 881 newFrame.timecode = block.GlobalTimecode() / timecodeScale; 867 newFrame.duration = uint32(blockDuration);882 newFrame.duration = duration; 868 883 newFrame.offset = block.GetDataPosition(i); 869 884 newFrame.size = block.GetFrameSize(i); 870 newFrame.flags = blockGroup.ReferenceCount() > 0 ? mediaSampleNotSync : 0;885 newFrame.flags = flags; 871 886 872 887 if (type == track_subtitle) {
