summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorChih-Chung Chang <chihchung@google.com>2009-05-20 14:24:25 +0800
committerChih-Chung Chang <chihchung@google.com>2009-05-20 16:59:00 +0800
commit82ded2070a47fff16e1de1c78b516eb25888b91e (patch)
treeb90d6c1e4595f7bb8d5d0d0d6c45bd9aed9256da /src/com/android
parentacdd1d7d819d17f9690d9bfddb7a9aec9dd2210d (diff)
downloadLegacyCamera-82ded2070a47fff16e1de1c78b516eb25888b91e.zip
LegacyCamera-82ded2070a47fff16e1de1c78b516eb25888b91e.tar.gz
LegacyCamera-82ded2070a47fff16e1de1c78b516eb25888b91e.tar.bz2
Implement 1746508: add duration limit settings to camcorder.
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/camera/CameraSettings.java12
-rw-r--r--src/com/android/camera/VideoCamera.java16
2 files changed, 23 insertions, 5 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index 48c1e2b..aae30ba 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -33,6 +33,8 @@ public class CameraSettings extends PreferenceActivity implements
OnSharedPreferenceChangeListener {
public static final String KEY_VIDEO_QUALITY =
"pref_camera_videoquality_key";
+ public static final String KEY_VIDEO_DURATION =
+ "pref_camera_video_duration_key";
public static final String KEY_WHITE_BALANCE =
"pref_camera_whitebalance_key";
public static final String KEY_EFFECT = "pref_camera_effect_key";
@@ -42,8 +44,10 @@ public class CameraSettings extends PreferenceActivity implements
public static final String KEY_FOCUS_MODE = "pref_camera_focusmode_key";
public static final String KEY_ISO = "pref_camera_iso_key";
public static final boolean DEFAULT_VIDEO_QUALITY_VALUE = true;
+ public static final int DEFAULT_VIDEO_DURATION_VALUE = 1; // 1 minute
private ListPreference mVideoQuality;
+ private ListPreference mVideoDuration;
private ListPreference mWhiteBalance;
private ListPreference mEffect;
private ListPreference mBrightness;
@@ -66,6 +70,7 @@ public class CameraSettings extends PreferenceActivity implements
super.onResume();
updateVideoQualitySummary();
+ updateVideoDurationSummary();
updateWhiteBalanceSummary();
updateEffectSummary();
updateBrightnessSummary();
@@ -77,6 +82,7 @@ public class CameraSettings extends PreferenceActivity implements
private void initUI() {
mVideoQuality = (ListPreference) findPreference(KEY_VIDEO_QUALITY);
+ mVideoDuration = (ListPreference) findPreference(KEY_VIDEO_DURATION);
mWhiteBalance = (ListPreference) findPreference(KEY_WHITE_BALANCE);
mEffect = (ListPreference) findPreference(KEY_EFFECT);
mBrightness = (ListPreference) findPreference(KEY_BRIGHTNESS);
@@ -179,6 +185,10 @@ public class CameraSettings extends PreferenceActivity implements
mVideoQuality.setSummary(mVideoQuality.getEntry());
}
+ private void updateVideoDurationSummary() {
+ mVideoDuration.setSummary(mVideoDuration.getEntry());
+ }
+
private void updateWhiteBalanceSummary() {
mWhiteBalance.setSummary(mWhiteBalance.getEntry());
}
@@ -211,6 +221,8 @@ public class CameraSettings extends PreferenceActivity implements
String key) {
if (key.equals(KEY_VIDEO_QUALITY)) {
updateVideoQualitySummary();
+ } else if (key.equals(KEY_VIDEO_DURATION)) {
+ updateVideoDurationSummary();
} else if (key.equals(KEY_WHITE_BALANCE)) {
updateWhiteBalanceSummary();
} else if (key.equals(KEY_EFFECT)) {
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 1ba9ec0..7f40026 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -109,8 +109,6 @@ public class VideoCamera extends Activity implements View.OnClickListener,
private ImageView mLastPictureButton;
private ThumbnailController mThumbController;
- private static final int MAX_RECORDING_DURATION_MS = 600 * 60 * 1000;
-
private int mStorageStatus = STORAGE_STATUS_OK;
private MediaRecorder mMediaRecorder;
@@ -131,6 +129,9 @@ public class VideoCamera extends Activity implements View.OnClickListener,
// The video frame size we will record (like 352x288).
private int mVideoWidth, mVideoHeight;
+ // The video duration limit.
+ private int mMaxVideoDurationInMs;
+
boolean mPausing = false;
boolean mPreviewing = false; // True if preview is started.
@@ -417,6 +418,11 @@ public class VideoCamera extends Activity implements View.OnClickListener,
CameraSettings.KEY_VIDEO_QUALITY,
CameraSettings.DEFAULT_VIDEO_QUALITY_VALUE);
+ // 1 minute = 60000ms
+ mMaxVideoDurationInMs = 60000 * getIntPreference(
+ CameraSettings.KEY_VIDEO_DURATION,
+ CameraSettings.DEFAULT_VIDEO_DURATION_VALUE);
+
Intent intent = getIntent();
if (intent.hasExtra(MediaStore.EXTRA_VIDEO_QUALITY)) {
int extraVideoQuality = intent.getIntExtra(
@@ -794,7 +800,7 @@ public class VideoCamera extends Activity implements View.OnClickListener,
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
- mMediaRecorder.setMaxDuration(MAX_RECORDING_DURATION_MS);
+ mMediaRecorder.setMaxDuration(mMaxVideoDurationInMs);
if (mStorageStatus != STORAGE_STATUS_OK) {
mMediaRecorder.setOutputFile("/dev/null");
@@ -1274,10 +1280,10 @@ public class VideoCamera extends Activity implements View.OnClickListener,
// Starting a minute before reaching the max duration
// limit, we'll countdown the remaining time instead.
boolean countdownRemainingTime =
- (delta >= MAX_RECORDING_DURATION_MS - 60000);
+ (delta >= mMaxVideoDurationInMs - 60000);
if (countdownRemainingTime) {
- delta = Math.max(0, MAX_RECORDING_DURATION_MS - delta);
+ delta = Math.max(0, mMaxVideoDurationInMs - delta);
}
long seconds = (delta + 500) / 1000; // round to nearest