diff --git a/MP42/MP42File.h b/MP42/MP42File.h index 0f00a3d..4ced26b 100644 --- a/MP42/MP42File.h +++ b/MP42/MP42File.h @@ -148,13 +148,11 @@ typedef enum MP42Status : NSInteger { /** * Add a track to the mp4 file. - * The track will be copied, the new track instance will be returned. * * @param track A MP42Track instance. * - * @return the copied track */ -- (MP42Track *)addTrack:(MP42Track *)track; +- (void)addTrack:(MP42Track *)track; /** * Removes a track at the index. diff --git a/MP42/MP42File.m b/MP42/MP42File.m index 110e758..32e7e1c 100644 --- a/MP42/MP42File.m +++ b/MP42/MP42File.m @@ -365,12 +365,10 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) { #pragma mark - Editing -- (MP42Track *)addTrack:(MP42Track *)track { +- (void)addTrack:(MP42Track *)track { NSAssert(self.status != MP42StatusWriting, @"Unsupported operation: trying to add a track while the file is open for writing"); NSAssert(![self.itracks containsObject:track], @"Unsupported operation: trying to add a track that is already present."); - track = [track copy]; - track.sourceId = track.Id; track.Id = 0; track.muxed = NO; @@ -393,26 +391,25 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) { MP42AudioTrack *audioTrack = (MP42AudioTrack *)track; track.format = MP42AudioFormatAAC; audioTrack.sourceChannels = audioTrack.channels; - if ([audioTrack.mixdownType isEqualToString:SBMonoMixdown] || audioTrack.sourceChannels == 1) + if ([audioTrack.mixdownType isEqualToString:SBMonoMixdown] || audioTrack.sourceChannels == 1) { audioTrack.channels = 1; - else if (audioTrack.mixdownType) + } else if (audioTrack.mixdownType) { audioTrack.channels = 2; - } - else if ([track isMemberOfClass:[MP42SubtitleTrack class]]) + } + } else if ([track isMemberOfClass:[MP42SubtitleTrack class]]) { track.format = MP42SubtitleFormatTx3g; + } } if (track.muxer_helper->importer && track.sourceURL) { - if ([self.importers objectForKey:[[track sourceURL] path]]) + if ([self.importers objectForKey:[[track sourceURL] path]]) { track.muxer_helper->importer = [_importers objectForKey:[[track sourceURL] path]]; - else + } else { [self.importers setObject:track.muxer_helper->importer forKey:[[track sourceURL] path]]; + } } [self.itracks addObject:track]; - [track release]; - - return track; } - (void)removeTrackAtIndex:(NSUInteger)index { diff --git a/MP42/MP42MediaFormat.m b/MP42/MP42MediaFormat.m index d8998b6..dfc1b85 100644 --- a/MP42/MP42MediaFormat.m +++ b/MP42/MP42MediaFormat.m @@ -76,4 +76,4 @@ NSString *const MP42TimeCodeFormat = @"TimeCode"; NSString * const SBMonoMixdown = @"SBMonoMixdown"; NSString * const SBStereoMixdown = @"SBStereoMixdown"; NSString * const SBDolbyMixdown = @"SBDolbyMixdown"; -NSString * const SBDolbyPlIIMixdown = @"SBDolbyPlIIMixdown"; \ No newline at end of file +NSString * const SBDolbyPlIIMixdown = @"SBDolbyPlIIMixdown";