More cosmetics changes.

This commit is contained in:
Damiano Galassi committed 2014-03-27 10:47:47 +01:00
1 parent ba273bc261
commit d1fbdb19d5
1 file changed
+16 -15
+16 -15
View File
@@ -315,6 +315,10 @@
return self;
}
/**
* Converts the AVAsset metadata to the MP42File format
*/
- (void)convertMetadata {
NSArray *items = nil;
NSDictionary *commonItemsDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Name", AVMetadataCommonKeyTitle,
@@ -544,9 +548,12 @@
}
- (NSSize)sizeForTrack:(MP42Track *)track {
if ([track isKindOfClass:[MP42VideoTrack class]]) {
MP42VideoTrack *currentTrack = (MP42VideoTrack *)track;
return NSMakeSize([currentTrack width], [currentTrack height]);
return NSMakeSize(currentTrack.width, currentTrack.height);
} else {
return NSMakeSize(0, 0);
}
}
- (NSData *)magicCookieForTrack:(MP42Track *)track {
@@ -676,9 +683,8 @@
time.value -= helper->edits[helper->editsCount].start.value;
helper->edits[helper->editsCount].duration = time;
if (type) {
if (type)
helper->edits[helper->editsCount].start.value = -1;
}
helper->editsCount++;
helper->editOpen = NO;
@@ -702,7 +708,8 @@
success = (assetReader != nil);
if (success) {
for (MP42Track *track in _inputTracks) {
AVAssetReaderOutput *assetReaderOutput = [AVAssetReaderTrackOutput assetReaderTrackOutputWithTrack:[_localAsset trackWithTrackID:track.sourceId] outputSettings:nil];
AVAssetReaderOutput *assetReaderOutput = [AVAssetReaderTrackOutput assetReaderTrackOutputWithTrack:[_localAsset trackWithTrackID:track.sourceId]
outputSettings:nil];
if (![assetReader canAddOutput: assetReaderOutput])
NSLog(@"Unable to add the output to assetReader!");
@@ -843,9 +850,6 @@
CMBlockBufferRef buffer = CMSampleBufferGetDataBuffer(sampleBuffer);
size_t bufferSize = CMBlockBufferGetDataLength(buffer);
#ifdef SB_AVF_DEBUG
#endif
// Check if we have to trim the start or end of a sample
// If so it means we need to start/end an edit
CFTypeRef trimStart = CMGetAttachment(sampleBuffer, kCMSampleBufferAttachmentKey_TrimDurationAtStart, kCMAttachmentMode_ShouldNotPropagate);
@@ -987,10 +991,10 @@
MP4Duration trackDuration = 0;
MP42Track *inputTrack = [self inputTrackWithTrackID:track.sourceId];
AVFDemuxHelper *demuxHelper = inputTrack.muxer_helper->demuxer_context;
AVFDemuxHelper *helper = inputTrack.muxer_helper->demuxer_context;
for (int i = 0; i < demuxHelper->editsCount; i++) {
CMTimeRange timeRange = demuxHelper->edits[i];
for (int i = 0; i < helper->editsCount; i++) {
CMTimeRange timeRange = helper->edits[i];
CMTime duration = CMTimeConvertScale(timeRange.duration, timescale, kCMTimeRoundingMethod_Default);
trackDuration += duration.value;
@@ -998,15 +1002,12 @@
MP4AddTrackEdit(fileHandle, track.Id, MP4_INVALID_EDIT_ID, timeRange.start.value,
duration.value, 0);
#ifdef SB_AVF_DEBUG
NSLog(@"Edit start: %lld, duration: %lld", timeRange.start.value, duration.value);
#endif
}
if (trackDuration)
MP4SetTrackIntegerProperty(fileHandle, track.Id, "tkhd.duration", trackDuration);
free(demuxHelper->edits);
free(helper->edits);
}
return YES;