summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/CameraSettings.java
diff options
context:
space:
mode:
authorAlok Kediya <kediya@codeaurora.org>2013-09-23 14:31:42 +0530
committerLinux Build Service Account <lnxbuild@localhost>2013-10-31 19:38:25 -0600
commitaed65253fb207b952a29e416a02d5b9a0c492416 (patch)
tree541d555d05d0a4da1ab25cb7720084ff23cc599e /src/com/android/camera/CameraSettings.java
parente04982ad43fa3672cadf821a1bbc9c6454ce20f3 (diff)
downloadandroid_packages_apps_Snap-aed65253fb207b952a29e416a02d5b9a0c492416.tar.gz
android_packages_apps_Snap-aed65253fb207b952a29e416a02d5b9a0c492416.tar.bz2
android_packages_apps_Snap-aed65253fb207b952a29e416a02d5b9a0c492416.zip
Camera: Add initial QCom value add features.
- Enhance the camera picture size table by adding more number of supported resolutions. - Enhance the camcorder menu by adding support for additional video and audio codecs. - Also provide option to select the duration of the recording clip. (cherry picked from commit 7a5402332f3b527767b85c1fc112880d02a47c0e) Change-Id: I553d4eb74337701bc57d069c8374646a7e15c2d5 (cherry picked from commit cdffd7510e1f9a236e43438f035bc5be9e3c0c17) (cherry picked from commit 93c32e9e069d7c48b71fbbe45cae59a54df443ec) (cherry picked from commit f6b24346ab9d28953a5697924d6815ed2c006cf3)
Diffstat (limited to 'src/com/android/camera/CameraSettings.java')
-rw-r--r--src/com/android/camera/CameraSettings.java100
1 files changed, 92 insertions, 8 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index 55867a1e8..38dcc6965 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -16,12 +16,14 @@
package com.android.camera;
+import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Resources;
import android.content.res.TypedArray;
+import android.hardware.Camera;
import android.hardware.Camera.CameraInfo;
import android.hardware.Camera.Parameters;
import android.hardware.Camera.Size;
@@ -36,6 +38,7 @@ import com.android.camera2.R;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
+import android.os.Build;
/**
* Provides utilities and keys for Camera settings.
@@ -67,6 +70,9 @@ public class CameraSettings {
public static final String KEY_PHOTOSPHERE_PICTURESIZE = "pref_photosphere_picturesize_key";
public static final String KEY_STARTUP_MODULE_INDEX = "camera.startup_module";
+ public static final String KEY_VIDEO_ENCODER = "pref_camera_videoencoder_key";
+ public static final String KEY_AUDIO_ENCODER = "pref_camera_audioencoder_key";
+ public static final String KEY_VIDEO_DURATION = "pref_camera_video_duration_key";
public static final String EXPOSURE_DEFAULT_VALUE = "0";
public static final int CURRENT_VERSION = 5;
@@ -96,10 +102,10 @@ public class CameraSettings {
}
public static String getSupportedHighestVideoQuality(int cameraId,
- String defaultQuality) {
+ String defaultQuality,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);
+ List<String> supported = getSupportedVideoQuality(cameraId,parameters);
if (supported == null) {
Log.e(TAG, "No supported video quality is found");
return defaultQuality;
@@ -177,7 +183,8 @@ 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(mCameraId));
+ filterUnsupportedOptions(group, videoQuality, getSupportedVideoQuality(
+ mCameraId,mParameters));
}
if (pictureSize != null) {
@@ -484,19 +491,96 @@ public class CameraSettings {
initialCameraPictureSize(context, parameters);
writePreferredCameraId(preferences, currentCameraId);
}
+ private static boolean checkSupportedVideoQuality(Parameters parameters,int width, int height){
+ List <Size> supported = parameters.getSupportedVideoSizes();
+ int flag = 0;
+ for (Size size : supported){
+ //since we are having two profiles with same height, we are checking with height
+ if (size.height == 480) {
+ if (size.height == height && size.width == width) {
+ flag = 1;
+ break;
+ }
+ } else {
+ if (size.width == width) {
+ flag = 1;
+ break;
+ }
+ }
+ }
+ if (flag == 1)
+ return true;
- private static ArrayList<String> getSupportedVideoQuality(int cameraId) {
+ return false;
+ }
+ private static ArrayList<String> getSupportedVideoQuality(int cameraId,Parameters parameters) {
ArrayList<String> supported = new ArrayList<String>();
// Check for supported quality
+ if (ApiHelper.HAS_FINE_RESOLUTION_QUALITY_LEVELS) {
+ getFineResolutionQuality(supported,cameraId,parameters);
+ } else {
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_HIGH));
+ CamcorderProfile high = CamcorderProfile.get(
+ cameraId, CamcorderProfile.QUALITY_HIGH);
+ CamcorderProfile low = CamcorderProfile.get(
+ cameraId, CamcorderProfile.QUALITY_LOW);
+ if (high.videoFrameHeight * high.videoFrameWidth >
+ low.videoFrameHeight * low.videoFrameWidth) {
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_LOW));
+ }
+ }
+
+ return supported;
+ }
+
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
+ private static void getFineResolutionQuality(ArrayList<String> supported,
+ int cameraId,Parameters parameters) {
if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_1080P)) {
- supported.add(Integer.toString(CamcorderProfile.QUALITY_1080P));
+ if (checkSupportedVideoQuality(parameters,1920,1080)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_1080P));
+ }
}
if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_720P)) {
- supported.add(Integer.toString(CamcorderProfile.QUALITY_720P));
+ if (checkSupportedVideoQuality(parameters,1280,720)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_720P));
+ }
}
if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_480P)) {
- supported.add(Integer.toString(CamcorderProfile.QUALITY_480P));
+ if (checkSupportedVideoQuality(parameters,720,480)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_480P));
+ }
}
- return supported;
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_FWVGA)) {
+ if (checkSupportedVideoQuality(parameters,864,480)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_FWVGA));
+ }
+ }
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_WVGA)) {
+ if (checkSupportedVideoQuality(parameters,800,480)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_WVGA));
+ }
+ }
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_VGA)) {
+ if (checkSupportedVideoQuality(parameters,640,480)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_VGA));
+ }
+ }
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_CIF)) {
+ if (checkSupportedVideoQuality(parameters,352,288)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_CIF));
+ }
+ }
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_QVGA)) {
+ if (checkSupportedVideoQuality(parameters,320,240)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_QVGA));
+ }
+ }
+ if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_QCIF)) {
+ if (checkSupportedVideoQuality(parameters,176,144)){
+ supported.add(Integer.toString(CamcorderProfile.QUALITY_QCIF));
+ }
+ }
+
}
}