summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/CameraSettings.java
diff options
context:
space:
mode:
authorSai Kumar Sanagavarapu <ssanagav@codeaurora.org>2016-01-07 21:04:11 +0100
committerDaniel Hillenbrand <codeworkx@cyanogenmod.org>2016-01-07 13:26:05 -0800
commit04568574c6a24efcf8d15426d133979df557ea2e (patch)
treefac66607f4bb030ebaee7a0b7d235b183e92197e /src/com/android/camera/CameraSettings.java
parent6bf48d33cacbdcc1df5de29c5a07b1cf5bd1a974 (diff)
downloadandroid_packages_apps_Snap-04568574c6a24efcf8d15426d133979df557ea2e.tar.gz
android_packages_apps_Snap-04568574c6a24efcf8d15426d133979df557ea2e.tar.bz2
android_packages_apps_Snap-04568574c6a24efcf8d15426d133979df557ea2e.zip
SnapdragonCamera: Query camcorder profiles before usage
1. Use generic camcorder profile query mechanism instead of hardcoding profile enums in app. 2. Fix NPE during startpreview if mFocusManager is null. Change-Id: I7bfc00f68f512c3029ca8ba75863583f1b376094
Diffstat (limited to 'src/com/android/camera/CameraSettings.java')
-rw-r--r--src/com/android/camera/CameraSettings.java35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index f6e4892cd..d97e3b86d 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -39,6 +39,7 @@ import org.codeaurora.snapcam.R;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
+import java.util.HashMap;
import android.os.Build;
import java.util.StringTokenizer;
import android.os.SystemProperties;
@@ -251,6 +252,22 @@ public class CameraSettings {
public static String mKeyIso = null;
public static String mKeyIsoValues = null;
+ public static final HashMap<String, Integer>
+ VIDEO_QUALITY_TABLE = new HashMap<String, Integer>();
+
+ static {
+ //video qualities
+ VIDEO_QUALITY_TABLE.put("4096x2160", CamcorderProfile.QUALITY_4KDCI);
+ VIDEO_QUALITY_TABLE.put("3840x2160", CamcorderProfile.QUALITY_2160P);
+ VIDEO_QUALITY_TABLE.put("1920x1080", CamcorderProfile.QUALITY_1080P);
+ VIDEO_QUALITY_TABLE.put("1280x720", CamcorderProfile.QUALITY_720P);
+ VIDEO_QUALITY_TABLE.put("720x480", CamcorderProfile.QUALITY_480P);
+ VIDEO_QUALITY_TABLE.put("640x480", CamcorderProfile.QUALITY_VGA);
+ VIDEO_QUALITY_TABLE.put("352x288", CamcorderProfile.QUALITY_CIF);
+ VIDEO_QUALITY_TABLE.put("320x240", CamcorderProfile.QUALITY_QVGA);
+ VIDEO_QUALITY_TABLE.put("176x144", CamcorderProfile.QUALITY_QCIF);
+ }
+
public CameraSettings(Activity activity, Parameters parameters,
int cameraId, CameraInfo[] cameraInfo) {
mContext = activity;
@@ -320,7 +337,7 @@ public class CameraSettings {
int cameraId, Parameters parameters) {
// 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,parameters);
+ List<String> supported = getSupportedVideoQualities(cameraId,parameters);
assert (supported != null) : "No supported video quality is found";
return supported.get(0);
}
@@ -819,7 +836,7 @@ public class CameraSettings {
}
if (videoQuality != null) {
- filterUnsupportedOptions(group, videoQuality, getSupportedVideoQuality(
+ filterUnsupportedOptions(group, videoQuality, getSupportedVideoQualities(
mCameraId,mParameters));
}
@@ -1227,6 +1244,20 @@ public class CameraSettings {
return supported;
}
+ public static ArrayList<String> getSupportedVideoQualities(int cameraId,Parameters parameters) {
+ ArrayList<String> supported = new ArrayList<String>();
+ List<String> temp = sizeListToStringList(parameters.getSupportedVideoSizes());
+ for (String videoSize : temp) {
+ if (VIDEO_QUALITY_TABLE.containsKey(videoSize)) {
+ int profile = VIDEO_QUALITY_TABLE.get(videoSize);
+ if (CamcorderProfile.hasProfile(cameraId, profile)) {
+ supported.add(videoSize);
+ }
+ }
+ }
+ return supported;
+ }
+
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
private static void getFineResolutionQuality(ArrayList<String> supported,
int cameraId,Parameters parameters) {