Apply the same changes to the other demuxed part.
This commit is contained in:
1 parent
b7668b0fc8
commit
43903a4590
1 file changed
+19
-4
+19
-4
@@ -797,13 +797,27 @@
|
|||||||
|
|
||||||
#ifdef SB_AVF_DEBUG
|
#ifdef SB_AVF_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CFTypeRef trimStart = CMGetAttachment(sampleBuffer, kCMSampleBufferAttachmentKey_TrimDurationAtStart, kCMAttachmentMode_ShouldNotPropagate);
|
CFTypeRef trimStart = CMGetAttachment(sampleBuffer, kCMSampleBufferAttachmentKey_TrimDurationAtStart, kCMAttachmentMode_ShouldNotPropagate);
|
||||||
if (trimStart) {
|
if (trimStart) {
|
||||||
CMTime trimStartTime = CMTimeMakeFromDictionary(trimStart);
|
CMTime trimStartTime = CMTimeMakeFromDictionary(trimStart);
|
||||||
|
trimStartTime = CMTimeConvertScale(trimStartTime, timingArrayOut[0].duration.timescale, kCMTimeRoundingMethod_Default);
|
||||||
|
|
||||||
|
CMTime editStart = CMTimeMake(demuxHelper->currentTime, timingArrayOut[0].duration.timescale);
|
||||||
|
editStart.value += trimStartTime.value;
|
||||||
|
|
||||||
|
[self startEditListAtTime:editStart helper:demuxHelper];
|
||||||
}
|
}
|
||||||
CFTypeRef trimEnd = CMGetAttachment(sampleBuffer, kCMSampleBufferAttachmentKey_TrimDurationAtEnd, kCMAttachmentMode_ShouldNotPropagate);
|
CFTypeRef trimEnd = CMGetAttachment(sampleBuffer, kCMSampleBufferAttachmentKey_TrimDurationAtEnd, kCMAttachmentMode_ShouldNotPropagate);
|
||||||
if (trimEnd) {
|
if (trimEnd) {
|
||||||
CMTime trimEndTime = CMTimeMakeFromDictionary(trimStart);
|
CMTime trimEndTime = CMTimeMakeFromDictionary(trimEnd);
|
||||||
|
trimEndTime = CMTimeConvertScale(trimEndTime, timingArrayOut[0].duration.timescale, kCMTimeRoundingMethod_Default);
|
||||||
|
|
||||||
|
CMTime editEnd = CMTimeMake(demuxHelper->currentTime, timingArrayOut[0].duration.timescale);
|
||||||
|
editEnd.value += timingArrayOut[0].duration.value * samplesNum - trimEndTime.value;
|
||||||
|
|
||||||
|
[self endEditListAtTime:editEnd helper:demuxHelper];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
@@ -823,14 +837,14 @@
|
|||||||
|
|
||||||
presentationTimeStamp = sampleTimingInfo.presentationTimeStamp;
|
presentationTimeStamp = sampleTimingInfo.presentationTimeStamp;
|
||||||
presentationTimeStamp.value = presentationTimeStamp.value + ( sampleTimingInfo.duration.value * i);
|
presentationTimeStamp.value = presentationTimeStamp.value + ( sampleTimingInfo.duration.value * i);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sampleTimingInfo = timingArrayOut[i];
|
sampleTimingInfo = timingArrayOut[i];
|
||||||
decodeTimeStamp = sampleTimingInfo.decodeTimeStamp;
|
decodeTimeStamp = sampleTimingInfo.decodeTimeStamp;
|
||||||
presentationTimeStamp = sampleTimingInfo.presentationTimeStamp;
|
presentationTimeStamp = sampleTimingInfo.presentationTimeStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
presentationOutputTimeStamp.value = presentationOutputTimeStamp.value + ( sampleTimingInfo.duration.value * i / ( (double) sampleTimingInfo.duration.timescale / presentationOutputTimeStamp.timescale));
|
presentationOutputTimeStamp.value = presentationOutputTimeStamp.value + (sampleTimingInfo.duration.value * i /
|
||||||
|
((double) sampleTimingInfo.duration.timescale / presentationOutputTimeStamp.timescale));
|
||||||
|
|
||||||
// If the size of sample size array is equal to 1, it means every sample has got the same size
|
// If the size of sample size array is equal to 1, it means every sample has got the same size
|
||||||
if (sizeArrayEntries == 1) {
|
if (sizeArrayEntries == 1) {
|
||||||
@@ -862,7 +876,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SB_AVF_DEBUG
|
#ifdef SB_AVF_DEBUG
|
||||||
NSLog(@"D: %lld, P: %lld, PO: %lld", decodeTimeStamp.value, presentationTimeStamp.value, presentationOutputTimeStamp.value);
|
//NSLog(@"D: %lld, P: %lld, PO: %lld", decodeTimeStamp.value, presentationTimeStamp.value, presentationOutputTimeStamp.value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MP42SampleBuffer *sample = [[MP42SampleBuffer alloc] init];
|
MP42SampleBuffer *sample = [[MP42SampleBuffer alloc] init];
|
||||||
@@ -877,6 +891,7 @@
|
|||||||
[self enqueue:sample];
|
[self enqueue:sample];
|
||||||
[sample release];
|
[sample release];
|
||||||
|
|
||||||
|
demuxHelper->currentTime += sampleTimingInfo.duration.value;
|
||||||
currentDataLength += sampleSize;
|
currentDataLength += sampleSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user