Changeset 1181
- Timestamp:
- 10/24/09 01:59:31 (10 months ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
MatroskaImport.h (modified) (1 diff)
-
MatroskaImportPrivate.cpp (modified) (2 diffs)
-
ff_private.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/MatroskaImport.h
r887 r1181 161 161 int displayOffsetSum; 162 162 SInt64 durationSinceZeroSum; 163 164 // the timestamp of the first block, used to set delay for the track 165 TimeValue64 lowestPTS; 163 166 }; 164 167 -
trunk/MatroskaImportPrivate.cpp
r1170 r1181 1027 1027 bool replaceSoundDesc = false; 1028 1028 1029 lowestPTS = block.GlobalTimecode(); 1030 1029 1031 if (desc) { 1030 1032 switch ((*desc)->dataFormat) { … … 1233 1235 if (err) 1234 1236 Codecprintf(NULL, "MKV: error inserting media into track %d\n", err); 1235 else 1237 1238 if (!err) { 1239 if (!maxLoadedTime && lowestPTS) 1240 SetTrackOffset(theTrack, lowestPTS / timecodeScale); 1241 1236 1242 maxLoadedTime += durationToAdd; 1243 } 1237 1244 1238 1245 durationToAdd = 0; -
trunk/ff_private.c
r1170 r1181 910 910 TimeScale mediaTimeScale; 911 911 TimeScale movieTimeScale; 912 int startTime = map[j].str->index_entries[0].timestamp; 912 913 913 914 mediaDuration = GetMediaDuration(media); … … 927 928 result = InsertMediaIntoTrack(track, time.value.lo, 0, mediaDuration, fixed1); 928 929 930 // set audio/video start delay 931 // note str.start_time exists but is always 0 for AVI 932 if (startTime) { 933 TimeRecord startTimeRec; 934 startTimeRec.value.hi = 0; 935 startTimeRec.value.lo = startTime * map[j].str->time_base.num; 936 startTimeRec.scale = map[j].str->time_base.den; 937 startTimeRec.base = NULL; 938 ConvertTimeScale(&startTimeRec, movieTimeScale); 939 SetTrackOffset(track, startTimeRec.value.lo); 940 } 941 929 942 if(result != noErr) 930 943 goto bail; … … 961 974 ComponentResult result; 962 975 TimeValue minLoadedTime; 976 TimeValue movieTimeScale = GetMovieTimeScale(storage->movie); 963 977 int64_t availableSize, margin; 964 978 long idling; 965 979 int readResult, framesProcessed, i; 980 int firstPts[storage->map_count]; 966 981 short flags; 967 982 … … 991 1006 } 992 1007 1008 for(i = 0; i < storage->map_count; i++) 1009 firstPts[i] = -1; 1010 993 1011 // record stream durations before we add any samples so that we know what to tell InsertMediaIntoTrack later 994 1012 for(i = 0; i < storage->map_count; i++) { … … 1018 1036 sampleRec.dataSize = packet.size; 1019 1037 sampleRec.sampleFlags = flags; 1038 1039 if(firstPts[packet.stream_index] < 0) 1040 firstPts[packet.stream_index] = packet.pts; 1020 1041 1021 1042 if(packet.size > storage->largestPacketSize) … … 1107 1128 result = InsertMediaIntoTrack(track, -1, prevDuration, addedDuration, fixed1); 1108 1129 } 1130 1131 if (!prevDuration && firstPts[i] > 0) { 1132 TimeRecord startTimeRec; 1133 startTimeRec.value.hi = 0; 1134 startTimeRec.value.lo = firstPts[i] * formatContext->streams[i]->time_base.num; 1135 startTimeRec.scale = formatContext->streams[i]->time_base.den; 1136 startTimeRec.base = NULL; 1137 ConvertTimeScale(&startTimeRec, movieTimeScale); 1138 SetTrackOffset(track, startTimeRec.value.lo); 1139 } 1109 1140 ncstream->duration = -1; 1110 1141 }
