From b353574a03955d2d5f6c615eb15affbbb9c4f858 Mon Sep 17 00:00:00 2001 From: Brian Jordan Date: Mon, 16 Apr 2012 20:15:09 -0400 Subject: clean up unused variables --- Video Tuneup/SimpleEditor.h | 9 ++------- Video Tuneup/SimpleEditor.m | 15 +++++++++------ Video Tuneup/ViewController.m | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Video Tuneup/SimpleEditor.h b/Video Tuneup/SimpleEditor.h index dc9d8d3..8e5a597 100644 --- a/Video Tuneup/SimpleEditor.h +++ b/Video Tuneup/SimpleEditor.h @@ -65,7 +65,7 @@ // Composition objects AVComposition *_composition; - AVComposition *_videoComposition; + AVVideoComposition *_videoComposition; AVAudioMix *_audioMix; AVPlayerItem *_playerItem; // Reference to player of work-in-progress @@ -83,18 +83,13 @@ // If the composition is being built for playback then a player item is also constructed. // All of these objects can be retrieved all of these objects with the accessors below. // Calling buildCompositionObjectsForPlayback: will get rid of any previously created composition objects. -- (void)buildCompositionObjectsForPlayback:(BOOL)forPlayback; +- (void)buildNewCompositionForPlayback:(BOOL)forPlayback; @property (nonatomic, retain) AVComposition *composition; @property (nonatomic, readwrite, retain) AVVideoComposition *videoComposition; @property (nonatomic, readwrite, retain) AVAudioMix *audioMix; @property (nonatomic, readwrite, retain) AVPlayerItem *playerItem; - -- (void)getPlayerItem:(AVPlayerItem**)playerItemOut andSynchronizedLayer:(AVSynchronizedLayer**)synchronizedLayerOut; -// The synchronized layer contains a layer tree which is synchronized with the provided player item. -// Inside the layer tree there is a playerLayer along with other layers related to titling. - - (AVAssetExportSession*)assetExportSessionWithPreset:(NSString*)presetName; @end diff --git a/Video Tuneup/SimpleEditor.m b/Video Tuneup/SimpleEditor.m index 6c869e6..dbbe2d3 100644 --- a/Video Tuneup/SimpleEditor.m +++ b/Video Tuneup/SimpleEditor.m @@ -67,6 +67,7 @@ @synthesize video = _video, videoStartTime = _videoStartTime; @synthesize song = _song, songStartTime = _songStartTime; +@synthesize videoComposition = _videoComposition; // Composition objects. @@ -75,10 +76,7 @@ @synthesize playerItem = _playerItem; - (void)addSongTrackToComposition:(AVMutableComposition *)composition withAudioMix:(AVMutableAudioMix *)audioMix -{ - NSInteger i; - NSArray *tracksToDuck = [composition tracksWithMediaType:AVMediaTypeAudio]; // before we add the song - +{ // Clip song duration to composition duration. CMTimeRange songTimeRange = CMTimeRangeMake(self.songStartTime, self.song.duration); if (CMTIME_COMPARE_INLINE(CMTimeRangeGetEnd(songTimeRange), >, [composition duration])) @@ -125,12 +123,17 @@ [compositionAudioTrack insertTimeRange:audioTimeRange ofTrack:audioTrack atTime:audioTimeRange.start error:nil]; } -- (void)buildCompositionObjectsForPlayback:(BOOL)forPlayback +// Combines self.video and self.song (if available) into a video composition +// If parameter forPlayback is true, also builds player self.playeritem +- (void)buildNewCompositionForPlayback:(BOOL)forPlayback { AVMutableComposition *composition = [[AVMutableComposition alloc]init]; AVMutableAudioMix *audioMix = nil; - CGSize videoSize = [self.video naturalSize]; + + // to suppress warning, get size of specific track instead + CGSize videoSize = [[[self.video tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] naturalSize]; + composition.naturalSize = videoSize; if (self.video) { diff --git a/Video Tuneup/ViewController.m b/Video Tuneup/ViewController.m index 60efc1f..4fc5a99 100644 --- a/Video Tuneup/ViewController.m +++ b/Video Tuneup/ViewController.m @@ -42,7 +42,7 @@ static const NSString *ItemStatusContext; self.editor.song = songAsset; // Begin export - [self.editor buildCompositionObjectsForPlayback:YES]; + [self.editor buildNewCompositionForPlayback:YES]; // Initialize editor's player self.playerItem = self.editor.playerItem; -- cgit v1.2.3