summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/VideoModule.java
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2014-02-18 00:41:46 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2014-02-18 00:41:46 -0800
commit8dae61552cc2e492dabd2a37d2bddea36cf7c1c3 (patch)
treecda71d61f98ec2da0ced6fde2e670a4b3767dfdc /src/com/android/camera/VideoModule.java
parentb27a87ba55b9dc6ec271ff62057087c392d45e4c (diff)
parentae019674d5331e750230fd92d8138d02b751f0f1 (diff)
downloadandroid_packages_apps_Snap-8dae61552cc2e492dabd2a37d2bddea36cf7c1c3.tar.gz
android_packages_apps_Snap-8dae61552cc2e492dabd2a37d2bddea36cf7c1c3.tar.bz2
android_packages_apps_Snap-8dae61552cc2e492dabd2a37d2bddea36cf7c1c3.zip
Merge "Camera2: Added pause button in Camcorder"
Diffstat (limited to 'src/com/android/camera/VideoModule.java')
-rw-r--r--src/com/android/camera/VideoModule.java42
1 files changed, 39 insertions, 3 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 24ea37376..f8db15bec 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -129,7 +129,9 @@ public class VideoModule implements CameraModule,
private boolean mSwitchingCamera;
private boolean mMediaRecorderRecording = false;
+ private boolean mMediaRecorderPausing = false;
private long mRecordingStartTime;
+ private long mRecordingTotalTime;
private boolean mRecordingTimeCountsDown = false;
private long mOnResumeTime;
// The video file that the hardware camera is about to record into
@@ -459,6 +461,7 @@ public class VideoModule implements CameraModule,
// Preview area is touched. Take a picture.
@Override
public void onSingleTapUp(View view, int x, int y) {
+ if (mMediaRecorderPausing) return;
takeASnapshot();
}
@@ -1329,7 +1332,7 @@ public class VideoModule implements CameraModule,
private void saveVideo() {
if (mVideoFileDescriptor == null) {
- long duration = SystemClock.uptimeMillis() - mRecordingStartTime;
+ long duration = SystemClock.uptimeMillis() - mRecordingStartTime + mRecordingTotalTime;
if (duration > 0) {
if (mCaptureTimeLapse) {
duration = getTimeLapseVideoLength(duration);
@@ -1498,7 +1501,10 @@ public class VideoModule implements CameraModule,
mUI.enableCameraControls(false);
mMediaRecorderRecording = true;
+ mMediaRecorderPausing = false;
+ mUI.resetPauseButton();
mOrientationManager.lockOrientation();
+ mRecordingTotalTime = 0L;
mRecordingStartTime = SystemClock.uptimeMillis();
mUI.showRecordingUI(true);
@@ -1546,6 +1552,21 @@ public class VideoModule implements CameraModule,
mUI.showTimeLapseUI(false);
}
+ private void pauseVideoRecording() {
+ Log.v(TAG, "pauseVideoRecording");
+ mMediaRecorderPausing = true;
+ mRecordingTotalTime += SystemClock.uptimeMillis() - mRecordingStartTime;
+ mMediaRecorder.pause();
+ }
+
+ private void resumeVideoRecording() {
+ Log.v(TAG, "resumeVideoRecording");
+ mMediaRecorderPausing = false;
+ mRecordingStartTime = SystemClock.uptimeMillis();
+ updateRecordingTime();
+ mMediaRecorder.start();
+ }
+
private boolean stopVideoRecording() {
Log.v(TAG, "stopVideoRecording");
mStopRecPending = true;
@@ -1623,7 +1644,7 @@ public class VideoModule implements CameraModule,
UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
fail ? UsageStatistics.ACTION_CAPTURE_FAIL :
UsageStatistics.ACTION_CAPTURE_DONE, "Video",
- SystemClock.uptimeMillis() - mRecordingStartTime);
+ SystemClock.uptimeMillis() - mRecordingStartTime + mRecordingTotalTime);
mStopRecPending = false;
return fail;
}
@@ -1700,8 +1721,12 @@ public class VideoModule implements CameraModule,
if (!mMediaRecorderRecording) {
return;
}
+ if (mMediaRecorderPausing) {
+ return;
+ }
+
long now = SystemClock.uptimeMillis();
- long delta = now - mRecordingStartTime;
+ long delta = now - mRecordingStartTime + mRecordingTotalTime;
// Starting a minute before reaching the max duration
// limit, we'll countdown the remaining time instead.
@@ -2271,4 +2296,15 @@ public class VideoModule implements CameraModule,
public void onPreviewUIDestroyed() {
stopPreview();
}
+
+ @Override
+ public void onButtonPause() {
+ pauseVideoRecording();
+ }
+
+ @Override
+ public void onButtonContinue() {
+ resumeVideoRecording();
+ }
+
}