Skip to content

Commit

Permalink
Changed currentRecordDuration to duration.
Browse files Browse the repository at this point in the history
  • Loading branch information
rFlex committed Mar 18, 2015
1 parent cc0adad commit 7b58491
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Examples/Sources/SCAudioRecordViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Examples/Sources/SCRecorderViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)];
Expand Down
6 changes: 3 additions & 3 deletions Library/Sources/SCRecordSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Library/Sources/SCRecordSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ - (CMTime)currentSegmentDuration {
return _movieFileOutput.isRecording ? _movieFileOutput.recordedDuration : _currentSegmentDuration;
}

- (CMTime)currentRecordDuration {
- (CMTime)duration {
return CMTimeAdd(_segmentsDuration, [self currentSegmentDuration]);
}

Expand Down
7 changes: 5 additions & 2 deletions Library/Sources/SCRecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions Library/Sources/SCRecorder.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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];
}
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions XamarinBindings/SCRecorderBindings/ApiDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down

0 comments on commit 7b58491

Please sign in to comment.