From 7b58491d41ddbc147729c6523d1d68afc21ac68c Mon Sep 17 00:00:00 2001 From: Simon CORSIN Date: Wed, 18 Mar 2015 12:18:31 -0700 Subject: [PATCH] Changed currentRecordDuration to duration. --- Examples/Sources/SCAudioRecordViewController.m | 2 +- Examples/Sources/SCRecorderViewController.m | 2 +- Library/Sources/SCRecordSession.h | 6 +++--- Library/Sources/SCRecordSession.m | 2 +- Library/Sources/SCRecorder.h | 7 +++++-- Library/Sources/SCRecorder.m | 6 +++--- XamarinBindings/SCRecorderBindings/ApiDefinition.cs | 4 ++-- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Examples/Sources/SCAudioRecordViewController.m b/Examples/Sources/SCAudioRecordViewController.m index 3ddcd9ec..f130a190 100644 --- a/Examples/Sources/SCAudioRecordViewController.m +++ b/Examples/Sources/SCAudioRecordViewController.m @@ -103,7 +103,7 @@ - (void)showPlayControl:(BOOL)animated { } - (void)recorder:(SCRecorder *)recorder didAppendAudioSampleBuffer:(SCRecordSession *)recordSession { - [self updateRecordTimeLabel:recordSession.currentRecordDuration]; + [self updateRecordTimeLabel:recordSession.duration]; } - (void)deleteRecordSession { diff --git a/Examples/Sources/SCRecorderViewController.m b/Examples/Sources/SCRecorderViewController.m index ba98da22..61c18097 100644 --- a/Examples/Sources/SCRecorderViewController.m +++ b/Examples/Sources/SCRecorderViewController.m @@ -334,7 +334,7 @@ - (void)updateTimeRecordedLabel { CMTime currentTime = kCMTimeZero; if (_recorder.session != nil) { - currentTime = _recorder.session.currentRecordDuration; + currentTime = _recorder.session.duration; } self.timeRecordedLabel.text = [NSString stringWithFormat:@"Recorded - %.2f sec", CMTimeGetSeconds(currentTime)]; diff --git a/Library/Sources/SCRecordSession.h b/Library/Sources/SCRecordSession.h index 0def0feb..17c6f4d4 100644 --- a/Library/Sources/SCRecordSession.h +++ b/Library/Sources/SCRecordSession.h @@ -75,10 +75,10 @@ extern const NSString *SCRecordSessionCacheDirectory; @property (readonly, nonatomic) NSArray *segments; /** - The current record duration including the duration of - the current recording segment, if any. + The duration of the whole recordSession including the current recording segment + and the previously added record segments. */ -@property (readonly, nonatomic) CMTime currentRecordDuration; +@property (readonly, nonatomic) CMTime duration; /** The duration of the recorded record segments. diff --git a/Library/Sources/SCRecordSession.m b/Library/Sources/SCRecordSession.m index 40caefe5..97c91266 100644 --- a/Library/Sources/SCRecordSession.m +++ b/Library/Sources/SCRecordSession.m @@ -835,7 +835,7 @@ - (CMTime)currentSegmentDuration { return _movieFileOutput.isRecording ? _movieFileOutput.recordedDuration : _currentSegmentDuration; } -- (CMTime)currentRecordDuration { +- (CMTime)duration { return CMTimeAdd(_segmentsDuration, [self currentSegmentDuration]); } diff --git a/Library/Sources/SCRecorder.h b/Library/Sources/SCRecorder.h index 722dbbe4..ac74bfd8 100644 --- a/Library/Sources/SCRecorder.h +++ b/Library/Sources/SCRecorder.h @@ -193,12 +193,15 @@ */ @property (readonly, nonatomic) BOOL focusSupported; - /** The current focus point of interest */ @property (readonly, nonatomic) CGPoint focusPointOfInterest; +/** + Will contains an error if an error occured while reconfiguring + the underlying AVCaptureSession. + */ @property (readonly, nonatomic) NSError *error; /** @@ -218,7 +221,7 @@ /** The dispatch queue that the SCRecorder uses for sending messages to the attached - SCSession. + SCRecordSession. */ @property (readonly, nonatomic) dispatch_queue_t sessionQueue; diff --git a/Library/Sources/SCRecorder.m b/Library/Sources/SCRecorder.m index 2cf3146f..2c6a45d6 100644 --- a/Library/Sources/SCRecorder.m +++ b/Library/Sources/SCRecorder.m @@ -531,7 +531,7 @@ - (void)beginRecordSegmentIfNeeded:(SCRecordSession *)recordSession { } - (void)checkRecordSessionDuration:(SCRecordSession *)recordSession { - CMTime currentRecordDuration = recordSession.currentRecordDuration; + CMTime currentRecordDuration = recordSession.duration; CMTime suggestedMaxRecordDuration = _maxRecordDuration; if (CMTIME_IS_VALID(suggestedMaxRecordDuration)) { @@ -661,7 +661,7 @@ - (void)captureOutput:(AVCaptureFileOutput *)captureOutput didFinishRecordingToO [delegate recorder:self didCompleteSegment:segment inSession:recordSession error:error]; } - if (hasComplete || (CMTIME_IS_VALID(_maxRecordDuration) && CMTIME_COMPARE_INLINE(recordSession.currentRecordDuration, >=, _maxRecordDuration))) { + if (hasComplete || (CMTIME_IS_VALID(_maxRecordDuration) && CMTIME_COMPARE_INLINE(recordSession.duration, >=, _maxRecordDuration))) { if ([delegate respondsToSelector:@selector(recorder:didCompleteSession:)]) { [delegate recorder:self didCompleteSession:recordSession]; } @@ -1492,7 +1492,7 @@ - (CGFloat)ratioRecorded { if (CMTIME_IS_VALID(_maxRecordDuration)) { Float64 maxRecordDuration = CMTimeGetSeconds(_maxRecordDuration); - Float64 recordedTime = CMTimeGetSeconds(_session.currentRecordDuration); + Float64 recordedTime = CMTimeGetSeconds(_session.duration); ratio = (CGFloat)(recordedTime / maxRecordDuration); } diff --git a/XamarinBindings/SCRecorderBindings/ApiDefinition.cs b/XamarinBindings/SCRecorderBindings/ApiDefinition.cs index c002f475..52abc2b7 100644 --- a/XamarinBindings/SCRecorderBindings/ApiDefinition.cs +++ b/XamarinBindings/SCRecorderBindings/ApiDefinition.cs @@ -174,8 +174,8 @@ interface SCRecordSession { [Export("segments")] SCRecordSessionSegment[] Segments { get; } - [Export("currentRecordDuration")] - CMTime CurrentRecordDuration { get; } + [Export("duration")] + CMTime Duration { get; } [Export("segmentsDuration")] CMTime SegmentsDuration { get; }