Changeset 444

Show
Ignore:
Timestamp:
04/19/07 16:22:46 (1 year ago)
Author:
dconrad
Message:

Don't add cached blocks until we get a block with a new timecode. This fixes importing some Real Audio tracks.

Files:

Legend:

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

    r425 r444  
    875875        // tracks w/ lacing can't have b-frames, and neither can any known audio codec 
    876876        if (usesLacing || type != track_video) { 
    877                 for (int i = 0; i < lastFrames.size(); i++) { 
    878                         // all the frames in the vector should have the same timecode at the moment 
    879                         TimeValue64 duration = block.GlobalTimecode() / timecodeScale - lastFrames[i].pts; 
    880                          
    881                         // since there can be multiple frames in one block, split the duration evenly between them 
    882                         // giving the remainder to the latter blocks 
    883                         int remainder = duration % lastFrames.size() >= lastFrames.size() - i ? 1 : 0; 
    884                          
    885                         lastFrames[i].duration = duration / lastFrames.size() + remainder; 
    886                          
    887                         AddFrame(lastFrames[i]); 
    888                 } 
    889                 lastFrames.clear(); 
     877                // don't add the blocks until we get one with a new timecode 
     878                TimeValue64 duration = 0; 
     879                if (lastFrames.size() > 0) 
     880                        duration = block.GlobalTimecode() / timecodeScale - lastFrames[0].pts; 
     881                 
     882                if (duration > 0) { 
     883                        for (int i = 0; i < lastFrames.size(); i++) { 
     884                                // since there can be multiple frames in one block, split the duration evenly between them 
     885                                // giving the remainder to the latter blocks 
     886                                int remainder = duration % lastFrames.size() >= lastFrames.size() - i ? 1 : 0; 
     887                                 
     888                                lastFrames[i].duration = duration / lastFrames.size() + remainder; 
     889                                 
     890                                AddFrame(lastFrames[i]); 
     891                        } 
     892                        lastFrames.clear(); 
     893                } 
    890894        } else if (ptsReorder.size() > 1) { 
    891895