summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2013-07-31 11:25:09 -0700
committerDoris Liu <tianliu@google.com>2013-07-31 14:23:37 -0700
commit3f7e00441f65ebd463a68d4c687589a65980ac5b (patch)
treefc5e36dfe6a3e237d56de34126720fe9f0ff8ddf /src
parent6d29a648f497f827d623d7af0b679e98ea58bf90 (diff)
downloadandroid_packages_apps_Snap-3f7e00441f65ebd463a68d4c687589a65980ac5b.tar.gz
android_packages_apps_Snap-3f7e00441f65ebd463a68d4c687589a65980ac5b.tar.bz2
android_packages_apps_Snap-3f7e00441f65ebd463a68d4c687589a65980ac5b.zip
Set default video quality to the highest
Bug: 9886141 Change-Id: I4741d5c898ac666923cfc12abc78d5d3517cb05f
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/CameraSettings.java48
-rw-r--r--src/com/android/camera/VideoModule.java29
2 files changed, 26 insertions, 51 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index 4e9a5ddfe..3558014cc 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -93,16 +93,16 @@ public class CameraSettings {
return group;
}
- @TargetApi(ApiHelper.VERSION_CODES.HONEYCOMB)
- public static String getDefaultVideoQuality(int cameraId,
+ public static String getSupportedHighestVideoQuality(int cameraId,
String defaultQuality) {
- if (ApiHelper.HAS_FINE_RESOLUTION_QUALITY_LEVELS) {
- if (CamcorderProfile.hasProfile(
- cameraId, Integer.valueOf(defaultQuality))) {
- return defaultQuality;
- }
- }
- return Integer.toString(CamcorderProfile.QUALITY_HIGH);
+ // When launching the camera app first time, we will set the video quality
+ // to the first one (i.e. highest quality) in the supported list
+ List<String> supported = getSupportedVideoQuality(cameraId);
+ if (supported == null) {
+ Log.e(TAG, "No supported video quality is found");
+ return defaultQuality;
+ }
+ return supported.get(0);
}
public static void initialCameraPictureSize(
@@ -177,7 +177,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) {
- filterUnsupportedOptions(group, videoQuality, getSupportedVideoQuality());
+ filterUnsupportedOptions(group, videoQuality, getSupportedVideoQuality(mCameraId));
}
if (pictureSize != null) {
@@ -532,37 +532,19 @@ public class CameraSettings {
writePreferredCameraId(preferences, currentCameraId);
}
- private ArrayList<String> getSupportedVideoQuality() {
+ private static ArrayList<String> getSupportedVideoQuality(int cameraId) {
ArrayList<String> supported = new ArrayList<String>();
// Check for supported quality
- if (ApiHelper.HAS_FINE_RESOLUTION_QUALITY_LEVELS) {
- getFineResolutionQuality(supported);
- } else {
- supported.add(Integer.toString(CamcorderProfile.QUALITY_HIGH));
- CamcorderProfile high = CamcorderProfile.get(
- mCameraId, CamcorderProfile.QUALITY_HIGH);
- CamcorderProfile low = CamcorderProfile.get(
- mCameraId, CamcorderProfile.QUALITY_LOW);
- if (high.videoFrameHeight * high.videoFrameWidth >
- low.videoFrameHeight * low.videoFrameWidth) {
- supported.add(Integer.toString(CamcorderProfile.QUALITY_LOW));
- }
- }
-
- return supported;
- }
-
- @TargetApi(ApiHelper.VERSION_CODES.HONEYCOMB)
- private void getFineResolutionQuality(ArrayList<String> supported) {
- if (CamcorderProfile.hasProfile(mCameraId, CamcorderProfile.QUALITY_1080P)) {
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_1080P)) {
supported.add(Integer.toString(CamcorderProfile.QUALITY_1080P));
}
- if (CamcorderProfile.hasProfile(mCameraId, CamcorderProfile.QUALITY_720P)) {
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_720P)) {
supported.add(Integer.toString(CamcorderProfile.QUALITY_720P));
}
- if (CamcorderProfile.hasProfile(mCameraId, CamcorderProfile.QUALITY_480P)) {
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_480P)) {
supported.add(Integer.toString(CamcorderProfile.QUALITY_480P));
}
+ return supported;
}
private void initVideoEffect(PreferenceGroup group, ListPreference videoEffect) {
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index e3efa22b6..956890e5e 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -472,20 +472,10 @@ public class VideoModule implements CameraModule,
if (effectsActive()) {
mUI.overrideSettings(
CameraSettings.KEY_VIDEO_QUALITY,
- Integer.toString(getLowVideoQuality()));
+ Integer.toString(CamcorderProfile.QUALITY_480P));
}
}
- @TargetApi(ApiHelper.VERSION_CODES.HONEYCOMB)
- private static int getLowVideoQuality() {
- if (ApiHelper.HAS_FINE_RESOLUTION_QUALITY_LEVELS) {
- return CamcorderProfile.QUALITY_480P;
- } else {
- return CamcorderProfile.QUALITY_LOW;
- }
- }
-
-
@Override
public void onOrientationChanged(int orientation) {
// We keep the last known orientation. So if the user first orient
@@ -565,7 +555,7 @@ public class VideoModule implements CameraModule,
// back to use SurfaceTexture for preview and we need to stop then start
// the preview. This will cause the preview flicker since the preview
// will not be continuous for a short period of time.
- // TODO: need to get the capture animation to work
+ // TODO: need to get the capture animation to work
// ((CameraScreenNail) mActivity.mCameraScreenNail).animateCapture(mDisplayRotation);
mUI.enablePreviewThumb(true);
@@ -613,11 +603,14 @@ public class VideoModule implements CameraModule,
private void readVideoPreferences() {
// The preference stores values from ListPreference and is thus string type for all values.
// We need to convert it to int manually.
- String defaultQuality = CameraSettings.getDefaultVideoQuality(mCameraId,
- mActivity.getResources().getString(R.string.pref_video_quality_default));
- String videoQuality =
- mPreferences.getString(CameraSettings.KEY_VIDEO_QUALITY,
- defaultQuality);
+ String videoQuality = mPreferences.getString(CameraSettings.KEY_VIDEO_QUALITY,
+ null);
+ if (videoQuality == null) {
+ // check for highest quality before setting default value
+ videoQuality = CameraSettings.getSupportedHighestVideoQuality(mCameraId,
+ mActivity.getResources().getString(R.string.pref_video_quality_default));
+ mPreferences.edit().putString(CameraSettings.KEY_VIDEO_QUALITY, videoQuality);
+ }
int quality = Integer.valueOf(videoQuality);
// Set video quality.
@@ -649,7 +642,7 @@ public class VideoModule implements CameraModule,
// Set quality to be no higher than 480p.
CamcorderProfile profile = CamcorderProfile.get(mCameraId, quality);
if (profile.videoFrameHeight > 480) {
- quality = getLowVideoQuality();
+ quality = CamcorderProfile.QUALITY_480P;
}
} else {
mEffectParameter = null;