summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngus Kong <shkong@google.com>2011-09-23 18:08:00 +0800
committerAngus Kong <shkong@google.com>2011-09-23 20:25:41 +0800
commit05999715cc38365aa4751a2a355eb1af284573ab (patch)
tree8fbafe767f4d64bfb57f62feec5b72eaf8b21295
parent022d6d7e809fcd47ebc751deaea84e2d3639069a (diff)
downloadLegacyCamera-05999715cc38365aa4751a2a355eb1af284573ab.zip
LegacyCamera-05999715cc38365aa4751a2a355eb1af284573ab.tar.gz
LegacyCamera-05999715cc38365aa4751a2a355eb1af284573ab.tar.bz2
Show the real resolution for quality settings.
1. Change the assets. 2. Change the strings from high/low/mms to 1080p/720p/480p. 3. Change the preference from customized string to the real values of CamcorderProfile.QUALITY_[1080|720|480]P bug:5141068 Change-Id: I294799bda8e873f828bbf4bd21330591f0859632
-rw-r--r--res/drawable-hdpi/ic_viewfinder_video_quality_1080p.pngbin0 -> 561 bytes
-rw-r--r--res/drawable-hdpi/ic_viewfinder_video_quality_480p.pngbin0 -> 659 bytes
-rw-r--r--res/drawable-hdpi/ic_viewfinder_video_quality_720p.pngbin0 -> 553 bytes
-rw-r--r--res/drawable-hdpi/ic_viewfinder_video_quality_high.pngbin1464 -> 0 bytes
-rw-r--r--res/drawable-hdpi/ic_viewfinder_video_quality_low.pngbin1318 -> 0 bytes
-rw-r--r--res/drawable-hdpi/ic_viewfinder_video_quality_mms.pngbin1449 -> 0 bytes
-rw-r--r--res/drawable-hdpi/ic_viewfinder_video_quality_youtube.pngbin2289 -> 0 bytes
-rw-r--r--res/drawable-mdpi/ic_viewfinder_video_quality_1080p.pngbin0 -> 871 bytes
-rw-r--r--res/drawable-mdpi/ic_viewfinder_video_quality_480p.pngbin0 -> 981 bytes
-rw-r--r--res/drawable-mdpi/ic_viewfinder_video_quality_720p.pngbin0 -> 972 bytes
-rw-r--r--res/drawable-mdpi/ic_viewfinder_video_quality_high.pngbin988 -> 0 bytes
-rw-r--r--res/drawable-mdpi/ic_viewfinder_video_quality_low.pngbin842 -> 0 bytes
-rw-r--r--res/drawable-mdpi/ic_viewfinder_video_quality_mms.pngbin741 -> 0 bytes
-rw-r--r--res/drawable-mdpi/ic_viewfinder_video_quality_youtube.pngbin1415 -> 0 bytes
-rw-r--r--res/drawable-w1024dp-mdpi/ic_viewfinder_video_quality_high.pngbin629 -> 0 bytes
-rw-r--r--res/drawable-w1024dp-mdpi/ic_viewfinder_video_quality_low.pngbin793 -> 0 bytes
-rw-r--r--res/drawable-w1024dp-mdpi/ic_viewfinder_video_quality_youtube.pngbin1435 -> 0 bytes
-rw-r--r--res/drawable-xhdpi/ic_viewfinder_video_quality_1080p.pngbin0 -> 1132 bytes
-rw-r--r--res/drawable-xhdpi/ic_viewfinder_video_quality_480p.pngbin0 -> 1324 bytes
-rw-r--r--res/drawable-xhdpi/ic_viewfinder_video_quality_720p.pngbin0 -> 1224 bytes
-rw-r--r--res/values/arrays.xml21
-rw-r--r--res/values/strings.xml22
-rw-r--r--src/com/android/camera/CameraSettings.java88
-rw-r--r--src/com/android/camera/ListPreference.java2
-rw-r--r--src/com/android/camera/VideoCamera.java100
25 files changed, 80 insertions, 153 deletions
diff --git a/res/drawable-hdpi/ic_viewfinder_video_quality_1080p.png b/res/drawable-hdpi/ic_viewfinder_video_quality_1080p.png
new file mode 100644
index 0000000..d2a39e4
--- /dev/null
+++ b/res/drawable-hdpi/ic_viewfinder_video_quality_1080p.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_viewfinder_video_quality_480p.png b/res/drawable-hdpi/ic_viewfinder_video_quality_480p.png
new file mode 100644
index 0000000..398a4b9
--- /dev/null
+++ b/res/drawable-hdpi/ic_viewfinder_video_quality_480p.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_viewfinder_video_quality_720p.png b/res/drawable-hdpi/ic_viewfinder_video_quality_720p.png
new file mode 100644
index 0000000..5567eb0
--- /dev/null
+++ b/res/drawable-hdpi/ic_viewfinder_video_quality_720p.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_viewfinder_video_quality_high.png b/res/drawable-hdpi/ic_viewfinder_video_quality_high.png
deleted file mode 100644
index 432cb4a..0000000
--- a/res/drawable-hdpi/ic_viewfinder_video_quality_high.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_viewfinder_video_quality_low.png b/res/drawable-hdpi/ic_viewfinder_video_quality_low.png
deleted file mode 100644
index 45ada04..0000000
--- a/res/drawable-hdpi/ic_viewfinder_video_quality_low.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_viewfinder_video_quality_mms.png b/res/drawable-hdpi/ic_viewfinder_video_quality_mms.png
deleted file mode 100644
index 9e517df..0000000
--- a/res/drawable-hdpi/ic_viewfinder_video_quality_mms.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_viewfinder_video_quality_youtube.png b/res/drawable-hdpi/ic_viewfinder_video_quality_youtube.png
deleted file mode 100644
index 296ee75..0000000
--- a/res/drawable-hdpi/ic_viewfinder_video_quality_youtube.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_viewfinder_video_quality_1080p.png b/res/drawable-mdpi/ic_viewfinder_video_quality_1080p.png
new file mode 100644
index 0000000..199e0ef
--- /dev/null
+++ b/res/drawable-mdpi/ic_viewfinder_video_quality_1080p.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_viewfinder_video_quality_480p.png b/res/drawable-mdpi/ic_viewfinder_video_quality_480p.png
new file mode 100644
index 0000000..e0b4974
--- /dev/null
+++ b/res/drawable-mdpi/ic_viewfinder_video_quality_480p.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_viewfinder_video_quality_720p.png b/res/drawable-mdpi/ic_viewfinder_video_quality_720p.png
new file mode 100644
index 0000000..1104ce5
--- /dev/null
+++ b/res/drawable-mdpi/ic_viewfinder_video_quality_720p.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_viewfinder_video_quality_high.png b/res/drawable-mdpi/ic_viewfinder_video_quality_high.png
deleted file mode 100644
index 2841baa..0000000
--- a/res/drawable-mdpi/ic_viewfinder_video_quality_high.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_viewfinder_video_quality_low.png b/res/drawable-mdpi/ic_viewfinder_video_quality_low.png
deleted file mode 100644
index ca67404..0000000
--- a/res/drawable-mdpi/ic_viewfinder_video_quality_low.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_viewfinder_video_quality_mms.png b/res/drawable-mdpi/ic_viewfinder_video_quality_mms.png
deleted file mode 100644
index 437e412..0000000
--- a/res/drawable-mdpi/ic_viewfinder_video_quality_mms.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_viewfinder_video_quality_youtube.png b/res/drawable-mdpi/ic_viewfinder_video_quality_youtube.png
deleted file mode 100644
index c29a444..0000000
--- a/res/drawable-mdpi/ic_viewfinder_video_quality_youtube.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-w1024dp-mdpi/ic_viewfinder_video_quality_high.png b/res/drawable-w1024dp-mdpi/ic_viewfinder_video_quality_high.png
deleted file mode 100644
index 2fcbd8b..0000000
--- a/res/drawable-w1024dp-mdpi/ic_viewfinder_video_quality_high.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-w1024dp-mdpi/ic_viewfinder_video_quality_low.png b/res/drawable-w1024dp-mdpi/ic_viewfinder_video_quality_low.png
deleted file mode 100644
index 9158059..0000000
--- a/res/drawable-w1024dp-mdpi/ic_viewfinder_video_quality_low.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-w1024dp-mdpi/ic_viewfinder_video_quality_youtube.png b/res/drawable-w1024dp-mdpi/ic_viewfinder_video_quality_youtube.png
deleted file mode 100644
index 7d279af..0000000
--- a/res/drawable-w1024dp-mdpi/ic_viewfinder_video_quality_youtube.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_viewfinder_video_quality_1080p.png b/res/drawable-xhdpi/ic_viewfinder_video_quality_1080p.png
new file mode 100644
index 0000000..606e66d
--- /dev/null
+++ b/res/drawable-xhdpi/ic_viewfinder_video_quality_1080p.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_viewfinder_video_quality_480p.png b/res/drawable-xhdpi/ic_viewfinder_video_quality_480p.png
new file mode 100644
index 0000000..3dd4fb2
--- /dev/null
+++ b/res/drawable-xhdpi/ic_viewfinder_video_quality_480p.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_viewfinder_video_quality_720p.png b/res/drawable-xhdpi/ic_viewfinder_video_quality_720p.png
new file mode 100644
index 0000000..c4e08d9
--- /dev/null
+++ b/res/drawable-xhdpi/ic_viewfinder_video_quality_720p.png
Binary files differ
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 8ad433e..854bc22 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -18,21 +18,24 @@
<resources>
<!-- Camera Preferences Video Quality entries -->
<string-array name="pref_video_quality_entries" translatable="false">
- <item>@string/pref_video_quality_entry_high</item>
- <item>@string/pref_video_quality_entry_low</item>
- <item>@string/pref_video_quality_entry_youtube</item>
+ <item>@string/pref_video_quality_entry_1080p</item>
+ <item>@string/pref_video_quality_entry_720p</item>
+ <item>@string/pref_video_quality_entry_480p</item>
</string-array>
<string-array name="pref_video_quality_entryvalues" translatable="false">
- <item>@string/pref_video_quality_high</item>
- <item>@string/pref_video_quality_low</item>
- <item>@string/pref_video_quality_youtube</item>
+ <!-- The integer value of CamcorderProfile.QUALITY_1080P -->
+ <item>6</item>
+ <!-- The integer value of CamcorderProfile.QUALITY_720P -->
+ <item>@string/pref_video_quality_default</item>
+ <!-- The integer value of CamcorderProfile.QUALITY_480P -->
+ <item>4</item>
</string-array>
<array name="video_quality_largeicons" translatable="false">
- <item>@drawable/ic_viewfinder_video_quality_high</item>
- <item>@drawable/ic_viewfinder_video_quality_low</item>
- <item>@drawable/ic_viewfinder_video_quality_youtube</item>
+ <item>@drawable/ic_viewfinder_video_quality_1080p</item>
+ <item>@drawable/ic_viewfinder_video_quality_720p</item>
+ <item>@drawable/ic_viewfinder_video_quality_480p</item>
</array>
<!-- Camera Preferences Time Lapse Frame Interval entries -->
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9ec1baf..4db1938 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -106,20 +106,14 @@
<!-- The Video quality settings in preference [CHAR LIMIT=21] -->
<string name="pref_video_quality_title">Video quality</string>
- <string name="pref_video_quality_default" translatable="false">high</string>
- <!-- Video quality setting entry. Videos will be recorded in high quality. [CHAR LIMIT=24] -->
- <string name="pref_video_quality_entry_high">High</string>
- <!-- Video quality setting entry. Videos will be recorded in low quality. [CHAR LIMIT=24] -->
- <string name="pref_video_quality_entry_low">Low</string>
- <!-- Video quality setting entry. Videos will be recorded in low quality and the length is at most 30 seconds. [CHAR LIMIT=24] -->
- <string name="pref_video_quality_entry_mms">MMS (Low, 30s)</string>
- <!-- Video quality setting entry. Videos will be recorded in high quality and the length is at most 15 minutes. [CHAR LIMIT=24] -->
- <string name="pref_video_quality_entry_youtube">YouTube (High, 15m)</string>
-
- <string name="pref_video_quality_high" translatable="false">high</string>
- <string name="pref_video_quality_low" translatable="false">low</string>
- <string name="pref_video_quality_mms" translatable="false">mms</string>
- <string name="pref_video_quality_youtube" translatable="false">youtube</string>
+ <!-- The default quality value is 5 (720p) -->
+ <string name="pref_video_quality_default" translatable="false">5</string>
+ <!-- Video quality setting entry. Videos will be recorded in 1080p quality. [CHAR LIMIT=24] -->
+ <string name="pref_video_quality_entry_1080p" translatable="false">HD</string>
+ <!-- Video quality setting entry. Videos will be recorded in 720p quality. [CHAR LIMIT=24] -->
+ <string name="pref_video_quality_entry_720p" translatable="false">HD</string>
+ <!-- Video quality setting entry. Videos will be recorded in 480p quality. [CHAR LIMIT=24] -->
+ <string name="pref_video_quality_entry_480p" translatable="false">SD</string>
<!-- Describes the preference dialog for choosing interval between frame capture for
time lapse recording. Appears at top of the dialog. [CHAR LIMIT=30] -->
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index a465a19..eb0161a 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -54,14 +54,10 @@ public class CameraSettings {
public static final String EXPOSURE_DEFAULT_VALUE = "0";
- public static final int CURRENT_VERSION = 4;
+ public static final int CURRENT_VERSION = 5;
public static final int CURRENT_LOCAL_VERSION = 1;
- // max video duration in seconds for youtube.
- private static final int YOUTUBE_VIDEO_DURATION = 15 * 60; // 15 mins
- private static final int DEFAULT_VIDEO_DURATION = 0; // no limit
-
- public static final String DEFAULT_VIDEO_QUALITY_VALUE = "high";
+ public static final int DEFAULT_VIDEO_DURATION = 0; // no limit
private static final String TAG = "CameraSettings";
@@ -86,6 +82,14 @@ public class CameraSettings {
return group;
}
+ public String getDefaultVideoQuality(String defaultQuality) {
+ int quality = Integer.valueOf(defaultQuality);
+ if (CamcorderProfile.hasProfile(mCameraId, quality)) {
+ return defaultQuality;
+ }
+ return Integer.toString(CamcorderProfile.QUALITY_HIGH);
+ }
+
public static void initialCameraPictureSize(
Context context, Parameters parameters) {
// When launching the camera app first time, we will set the picture
@@ -117,7 +121,7 @@ public class CameraSettings {
if (index == NOT_FOUND) return false;
int width = Integer.parseInt(candidate.substring(0, index));
int height = Integer.parseInt(candidate.substring(index + 1));
- for (Size size: supported) {
+ for (Size size : supported) {
if (size.width == width && size.height == height) {
parameters.setPictureSize(width, height);
return true;
@@ -136,7 +140,7 @@ public class CameraSettings {
ListPreference focusMode = group.findPreference(KEY_FOCUS_MODE);
ListPreference exposure = group.findPreference(KEY_EXPOSURE);
IconListPreference cameraIdPref =
- (IconListPreference)group.findPreference(KEY_CAMERA_ID);
+ (IconListPreference) group.findPreference(KEY_CAMERA_ID);
ListPreference videoFlashMode =
group.findPreference(KEY_VIDEOCAMERA_FLASH_MODE);
ListPreference videoEffect = group.findPreference(KEY_VIDEO_EFFECT);
@@ -144,7 +148,7 @@ public class CameraSettings {
// Since the screen could be loaded from different resources, we need
// to check if the preference is available here
if (videoQuality != null) {
- initVideoQuality(videoQuality);
+ filterUnsupportedOptions(group, videoQuality, getSupportedVideoQuality());
}
if (pictureSize != null) {
@@ -220,7 +224,7 @@ public class CameraSettings {
}
CharSequence[] entryValues = new CharSequence[2];
- for (int i = 0 ; i < mCameraInfo.length ; ++i) {
+ for (int i = 0; i < mCameraInfo.length; ++i) {
int index =
(mCameraInfo[i].facing == CameraInfo.CAMERA_FACING_FRONT)
? CameraInfo.CAMERA_FACING_FRONT
@@ -338,27 +342,18 @@ public class CameraSettings {
// ignore the current settings.
editor.remove("pref_camera_videoquality_key");
editor.remove("pref_camera_video_duration_key");
+ version = 4;
+ }
+ if (version == 4) {
+ // We use numbers to represent the quality now. The quality definition is identical to
+ // that of CamcorderProfile.java.
+ editor.remove("pref_video_quality_key");
}
+
editor.putInt(KEY_VERSION, CURRENT_VERSION);
editor.apply();
}
- public static boolean getVideoQuality(Context context, String quality) {
- return context.getString(R.string.pref_video_quality_youtube).equals(quality)
- || context.getString(R.string.pref_video_quality_high).equals(quality);
- }
-
- public static int getVideoDurationInMillis(Context context, String quality, int cameraId) {
- if (context.getString(R.string.pref_video_quality_mms).equals(quality)) {
- int mmsVideoDuration = CamcorderProfile.get(cameraId,
- CamcorderProfile.QUALITY_LOW).duration;
- return mmsVideoDuration * 1000;
- } else if (context.getString(R.string.pref_video_quality_youtube).equals(quality)) {
- return YOUTUBE_VIDEO_DURATION * 1000;
- }
- return DEFAULT_VIDEO_DURATION;
- }
-
public static int readPreferredCameraId(SharedPreferences pref) {
return Integer.parseInt(pref.getString(KEY_CAMERA_ID, "0"));
}
@@ -462,38 +457,27 @@ public class CameraSettings {
writePreferredCameraId(preferences, currentCameraId);
}
- private void initVideoQuality(ListPreference videoQuality) {
- CharSequence[] entries = videoQuality.getEntries();
- CharSequence[] values = videoQuality.getEntryValues();
- if (Util.isMmsCapable(mContext)) {
- int mmsVideoDuration = CamcorderProfile.get(mCameraId,
- CamcorderProfile.QUALITY_LOW).duration;
- // We need to fill in the device-dependent value (in seconds).
- for (int i = 0; i < entries.length; ++i) {
- if (mContext.getString(R.string.pref_video_quality_mms).equals(values[i])) {
- entries[i] = entries[i].toString().replace(
- "30", Integer.toString(mmsVideoDuration));
- break;
- }
- }
- } else {
- // The device does not support mms. Remove it. Using
- // filterUnsupported is not efficient but adding a new method
- // for remove is not worth it.
- ArrayList<String> supported = new ArrayList<String>();
- for (int i = 0; i < entries.length; ++i) {
- if (!mContext.getString(R.string.pref_video_quality_mms).equals(values[i])) {
- supported.add(values[i].toString());
- }
- }
- videoQuality.filterUnsupported(supported);
+ private ArrayList<String> getSupportedVideoQuality() {
+ ArrayList<String> supported = new ArrayList<String>();
+ // Check for supported quality
+ if (CamcorderProfile.hasProfile(mCameraId, CamcorderProfile.QUALITY_1080P)) {
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_1080P));
+ }
+ if (CamcorderProfile.hasProfile(mCameraId, CamcorderProfile.QUALITY_720P)) {
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_720P));
}
+ if (CamcorderProfile.hasProfile(mCameraId, CamcorderProfile.QUALITY_480P)) {
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_480P));
+ }
+
+ return supported;
}
private void initVideoEffect(PreferenceGroup group, ListPreference videoEffect) {
CharSequence[] values = videoEffect.getEntryValues();
- boolean goofyFaceSupported = EffectsRecorder.isEffectSupported(EffectsRecorder.EFFECT_GOOFY_FACE);
+ boolean goofyFaceSupported =
+ EffectsRecorder.isEffectSupported(EffectsRecorder.EFFECT_GOOFY_FACE);
boolean backdropperSupported =
EffectsRecorder.isEffectSupported(EffectsRecorder.EFFECT_BACKDROPPER) &&
mParameters.isAutoExposureLockSupported() &&
diff --git a/src/com/android/camera/ListPreference.java b/src/com/android/camera/ListPreference.java
index 288c875..6885a37 100644
--- a/src/com/android/camera/ListPreference.java
+++ b/src/com/android/camera/ListPreference.java
@@ -22,8 +22,6 @@ import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.Log;
-import com.android.camera.R;
-
import java.util.ArrayList;
import java.util.List;
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 8b6c328..74e217b 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -48,7 +48,6 @@ import android.os.ParcelFileDescriptor;
import android.os.SystemClock;
import android.provider.MediaStore;
import android.provider.MediaStore.Video;
-import android.provider.Settings;
import android.util.Log;
import android.view.GestureDetector;
import android.view.Gravity;
@@ -196,11 +195,6 @@ public class VideoCamera extends ActivityBase
private ContentValues mCurrentVideoValues;
private CamcorderProfile mProfile;
- // The array of video quality profiles supported by each camera(s). Here the
- // cameraId is the index of the array to get the profile map which contain
- // the set of quality string and its real quality of a camera.
- private HashMap<String, Integer>[] mProfileQuality;
- private HashMap<String, Integer>[] mTimeLapseProfileQuality;
// The video duration limit. 0 menas no limit.
private int mMaxVideoDurationInMs;
@@ -365,9 +359,9 @@ public class VideoCamera extends ActivityBase
mCameraDevice = Util.openCamera(VideoCamera.this, mCameraId);
readVideoPreferences();
startPreview();
- } catch(CameraHardwareException e) {
+ } catch (CameraHardwareException e) {
mOpenCameraFail = true;
- } catch(CameraDisabledException e) {
+ } catch (CameraDisabledException e) {
mCameraDisabled = true;
}
}
@@ -643,11 +637,14 @@ public class VideoCamera extends ActivityBase
}
private void readVideoPreferences() {
- String quality = mPreferences.getString(
+ CameraSettings settings = new CameraSettings(this, mParameters,
+ mCameraId, CameraHolder.instance().getCameraInfo());
+ // The preference stores values from ListPreference and is thus string type for all values.
+ // We need to convert it to int manually.
+ int quality = Integer.valueOf(mPreferences.getString(
CameraSettings.KEY_VIDEO_QUALITY,
- CameraSettings.DEFAULT_VIDEO_QUALITY_VALUE);
- boolean videoQualityHigh =
- CameraSettings.getVideoQuality(this, quality);
+ settings.getDefaultVideoQuality(
+ getResources().getString(R.string.pref_video_quality_default))));
// Set video quality.
Intent intent = getIntent();
@@ -655,9 +652,9 @@ public class VideoCamera extends ActivityBase
int extraVideoQuality =
intent.getIntExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);
if (extraVideoQuality > 0) {
- quality = getString(R.string.pref_video_quality_high);
+ quality = CamcorderProfile.QUALITY_HIGH;
} else { // 0 is mms.
- quality = getString(R.string.pref_video_quality_mms);
+ quality = CamcorderProfile.QUALITY_LOW;
}
}
@@ -668,8 +665,7 @@ public class VideoCamera extends ActivityBase
intent.getIntExtra(MediaStore.EXTRA_DURATION_LIMIT, 0);
mMaxVideoDurationInMs = 1000 * seconds;
} else {
- mMaxVideoDurationInMs =
- CameraSettings.getVideoDurationInMillis(this, quality, mCameraId);
+ mMaxVideoDurationInMs = CameraSettings.DEFAULT_VIDEO_DURATION;
}
// Read time lapse recording interval.
@@ -679,8 +675,9 @@ public class VideoCamera extends ActivityBase
mTimeBetweenTimeLapseFrameCaptureMs = Integer.parseInt(frameIntervalStr);
mCaptureTimeLapse = (mTimeBetweenTimeLapseFrameCaptureMs != 0);
- int profileQuality = getProfileQuality(mCameraId, quality, mCaptureTimeLapse);
- mProfile = CamcorderProfile.get(mCameraId, profileQuality);
+ // TODO: This should be checked instead directly +1000.
+ if (mCaptureTimeLapse) quality += 1000;
+ mProfile = CamcorderProfile.get(mCameraId, quality);
getDesiredPreviewSize();
// Set effect
@@ -706,55 +703,6 @@ public class VideoCamera extends ActivityBase
}
- int getProfileQuality(int cameraId, String quality, boolean captureTimeLapse) {
- HashMap<String, Integer>[] qualityMap;
- if (captureTimeLapse) {
- if (mTimeLapseProfileQuality == null) {
- mTimeLapseProfileQuality = new HashMap[
- CameraHolder.instance().getNumberOfCameras()];
- }
- qualityMap = mTimeLapseProfileQuality;
- if (qualityMap[cameraId] == null) {
- qualityMap[cameraId] = buildProfileQuality(cameraId, TIME_LAPSE_VIDEO_QUALITY);
- }
- } else {
- if (mProfileQuality == null) {
- mProfileQuality = new HashMap[
- CameraHolder.instance().getNumberOfCameras()];
- }
- qualityMap = mProfileQuality;
- if (qualityMap[cameraId] == null) {
- qualityMap[cameraId] = buildProfileQuality(cameraId, VIDEO_QUALITY);
- }
- }
- return qualityMap[cameraId].get(quality);
- }
-
- HashMap<String, Integer> buildProfileQuality(int cameraId,
- int qualityList[]) {
- HashMap<String, Integer> qualityMap = new HashMap<String, Integer>();
- int highestQuality = -1, secondHighestQuality = -1,
- lastEffectiveQuality = -1;
- for (int i = 0; i < qualityList.length; i++) {
- if (CamcorderProfile.hasProfile(cameraId, qualityList[i])) {
- if (highestQuality == -1) {
- highestQuality = qualityList[i];
- } else if (secondHighestQuality == -1) {
- secondHighestQuality = qualityList[i];
- }
- lastEffectiveQuality = qualityList[i];
- }
- }
- if (secondHighestQuality == -1) {
- secondHighestQuality = highestQuality;
- }
- qualityMap.put(getString(R.string.pref_video_quality_high), highestQuality);
- qualityMap.put(getString(R.string.pref_video_quality_low), secondHighestQuality);
- qualityMap.put(getString(R.string.pref_video_quality_youtube), highestQuality);
- qualityMap.put(getString(R.string.pref_video_quality_mms), lastEffectiveQuality);
- return qualityMap;
- }
-
private void getDesiredPreviewSize() {
mParameters = mCameraDevice.getParameters();
if (mParameters.getSupportedVideoSizes() == null) {
@@ -804,10 +752,10 @@ public class VideoCamera extends ActivityBase
readVideoPreferences();
resizeForPreviewAspectRatio();
startPreview();
- } catch(CameraHardwareException e) {
+ } catch (CameraHardwareException e) {
Util.showErrorAndFinish(this, R.string.cannot_connect_camera);
return;
- } catch(CameraDisabledException e) {
+ } catch (CameraDisabledException e) {
Util.showErrorAndFinish(this, R.string.camera_disabled);
return;
}
@@ -1247,7 +1195,7 @@ public class VideoCamera extends ActivityBase
mSurfaceHeight);
if (mEffectType == EffectsRecorder.EFFECT_BACKDROPPER &&
- ((String)mEffectParameter).equals(EFFECT_BG_FROM_GALLERY) ) {
+ ((String) mEffectParameter).equals(EFFECT_BG_FROM_GALLERY)) {
mEffectsRecorder.setEffect(mEffectType, mEffectUriFromGallery);
} else {
mEffectsRecorder.setEffect(mEffectType, mEffectParameter);
@@ -1881,7 +1829,7 @@ public class VideoCamera extends ActivityBase
if (resultCode == RESULT_OK) {
// onActivityResult() runs before onResume(), so this parameter will be
// seen by startPreview from onResume()
- mEffectUriFromGallery = ((Uri)data.getData()).toString();
+ mEffectUriFromGallery = ((Uri) data.getData()).toString();
Log.v(TAG, "Received URI from gallery: " + mEffectUriFromGallery);
}
break;
@@ -2005,15 +1953,15 @@ public class VideoCamera extends ActivityBase
if (mEffectType == EffectsRecorder.EFFECT_NONE) return false;
if (mEffectParameter.equals(currentEffectParameter)) return false;
}
- Log.v(TAG, "New effect selection: " + mPreferences.getString(CameraSettings.KEY_VIDEO_EFFECT, "none") );
+ Log.v(TAG, "New effect selection: " + mPreferences.getString(CameraSettings.KEY_VIDEO_EFFECT, "none"));
- if ( mEffectType == EffectsRecorder.EFFECT_NONE ) {
+ if (mEffectType == EffectsRecorder.EFFECT_NONE) {
// Stop effects and return to normal preview
mEffectsRecorder.stopPreview();
return true;
}
if (mEffectType == EffectsRecorder.EFFECT_BACKDROPPER &&
- ((String)mEffectParameter).equals(EFFECT_BG_FROM_GALLERY)) {
+ ((String) mEffectParameter).equals(EFFECT_BG_FROM_GALLERY)) {
// Request video from gallery to use for background
Intent i = new Intent(Intent.ACTION_PICK);
i.setDataAndType(Video.Media.EXTERNAL_CONTENT_URI,
@@ -2114,7 +2062,7 @@ public class VideoCamera extends ActivityBase
mZoomControl.setZoomMax(mZoomMax);
mZoomControl.setZoomIndex(mParameters.getZoom());
mZoomControl.setSmoothZoomSupported(mSmoothZoomSupported);
- mZoomControl.setOnZoomChangeListener(new ZoomChangeListener() );
+ mZoomControl.setOnZoomChangeListener(new ZoomChangeListener());
mCameraDevice.setZoomChangeListener(mZoomListener);
}
@@ -2122,7 +2070,7 @@ public class VideoCamera extends ActivityBase
implements android.hardware.Camera.OnZoomChangeListener {
@Override
public void onZoomChange(int value, boolean stopped, android.hardware.Camera camera) {
- Log.v(TAG, "Zoom changed: value=" + value + ". stopped="+ stopped);
+ Log.v(TAG, "Zoom changed: value=" + value + ". stopped=" + stopped);
mZoomValue = value;
// Update the UI when we get zoom value.