summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/arrays.xml37
-rw-r--r--res/values/strings.xml4
-rw-r--r--src/com/android/camera/AndroidCameraManagerImpl.java9
-rw-r--r--src/com/android/camera/CameraSettings.java37
-rw-r--r--src/com/android/camera/PhotoModule.java2
-rw-r--r--src/com/android/camera/VideoModule.java6
6 files changed, 53 insertions, 42 deletions
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 4ec1949da..40ce12a74 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -31,32 +31,19 @@
<item>@string/pref_video_quality_entry_qvga</item>
<item>@string/pref_video_quality_entry_qcif</item>
</string-array>
-
<string-array name="pref_video_quality_entryvalues" translatable="false">
- <!-- The integer value of CamcorderProfile.QUALITY_4kDCI -->
- <item>13</item>
- <!-- The integer value of CamcorderProfile.QUALITY_2160P -->
- <item>8</item>
- <!-- The integer value of CamcorderProfile.QUALITY_1080P -->
- <item>6</item>
- <!-- The integer value of CamcorderProfile.QUALITY_720P -->
- <item>5</item>
- <!-- The integer value of CamcorderProfile.QUALITY_480P -->
- <item>4</item>
- <!-- The integer value of CamcorderProfile.QUALITY_FWVGA -->
- <item>12</item>
- <!-- The integer value of CamcorderProfile.QUALITY_WVGA -->
- <item>9</item>
- <!-- The integer value of CamcorderProfile.QUALITY_VGA -->
- <item>10</item>
- <!-- The integer value of CamcorderProfile.QUALITY_WQVGA -->
- <item>11</item>
- <!-- The integer value of CamcorderProfile.QUALITY_CIF -->
- <item>@string/pref_video_quality_default</item>
- <!-- The integer value of CamcorderProfile.QUALITY_QVGA -->
- <item>7</item>
- <!-- The integer value of CamcorderProfile.QUALITY_QCIF -->
- <item>2</item>
+ <item>4096x2160</item>
+ <item>3840x2160</item>
+ <item>1920x1080</item>
+ <item>1280x720</item>
+ <item>720x480</item>
+ <item>864x480</item>
+ <item>800x480</item>
+ <item>640x480</item>
+ <item>400x240</item>
+ <item>352x288</item>
+ <item>320x240</item>
+ <item>176x144</item>
</string-array>
<!-- Camera Preference save path entries -->
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 63de736bc..d10696381 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -238,8 +238,8 @@
<!-- The Video quality settings in preference [CHAR LIMIT=21] -->
<string name="pref_video_quality_title">Video quality</string>
- <!-- The default quality value is 3 (CIF) -->
- <string name="pref_video_quality_default" translatable="false">3</string>
+ <!-- The default quality value is (CIF) -->
+ <string name="pref_video_quality_default" translatable="false">352x288</string>
<!-- Video quality setting entry.
Videos will be recorded in 4k DCI quality. [CHAR LIMIT=24] -->
<string name="pref_video_quality_entry_4kdci" translatable="false">
diff --git a/src/com/android/camera/AndroidCameraManagerImpl.java b/src/com/android/camera/AndroidCameraManagerImpl.java
index 42ae20f02..637a5f5c5 100644
--- a/src/com/android/camera/AndroidCameraManagerImpl.java
+++ b/src/com/android/camera/AndroidCameraManagerImpl.java
@@ -201,14 +201,7 @@ class AndroidCameraManagerImpl implements CameraManager {
try {
switch (msg.what) {
case OPEN_CAMERA:
- try {
- mCamera = android.hardware.Camera.openLegacy(msg.arg1,
- android.hardware.Camera.CAMERA_HAL_API_VERSION_1_0);
- } catch (RuntimeException e) {
- /* Retry with open if openLegacy fails */
- Log.v(TAG, "openLegacy failed. Using open instead");
- mCamera = android.hardware.Camera.open(msg.arg1);
- }
+ mCamera = android.hardware.Camera.open(msg.arg1);
if (mCamera != null) {
mParametersIsDirty = true;
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index 315cf62b9..7b5b2e7a6 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -247,13 +247,30 @@ public class CameraSettings {
private final int mCameraId;
private static final HashMap<Integer, String>
VIDEO_ENCODER_TABLE = new HashMap<Integer, String>();
+ public static final HashMap<String, Integer>
+ VIDEO_QUALITY_TABLE = new HashMap<String, Integer>();
static {
+ //video encoders
VIDEO_ENCODER_TABLE.put(MediaRecorder.VideoEncoder.H263, "h263");
VIDEO_ENCODER_TABLE.put(MediaRecorder.VideoEncoder.H264, "h264");
VIDEO_ENCODER_TABLE.put(MediaRecorder.VideoEncoder.H265, "h265");
VIDEO_ENCODER_TABLE.put(MediaRecorder.VideoEncoder.MPEG_4_SP, "m4v");
- }
+
+ //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("864x480", CamcorderProfile.QUALITY_FWVGA);
+ VIDEO_QUALITY_TABLE.put("800x480", CamcorderProfile.QUALITY_WVGA);
+ VIDEO_QUALITY_TABLE.put("640x480", CamcorderProfile.QUALITY_VGA);
+ VIDEO_QUALITY_TABLE.put("400x240", CamcorderProfile.QUALITY_WQVGA);
+ 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) {
@@ -275,7 +292,7 @@ public class CameraSettings {
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,parameters);
+ List<String> supported = getSupportedVideoQualities(cameraId,parameters);
if (supported == null) {
Log.e(TAG, "No supported video quality is found");
return defaultQuality;
@@ -734,7 +751,7 @@ public class CameraSettings {
}
if (videoQuality != null) {
- filterUnsupportedOptions(group, videoQuality, getSupportedVideoQuality(
+ filterUnsupportedOptions(group, videoQuality, getSupportedVideoQualities(
mCameraId,mParameters));
}
@@ -1151,6 +1168,20 @@ public class CameraSettings {
}
}
+
+ 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;
+ }
public static int getVideoDurationInMillis(String quality) {
if (VIDEO_QUALITY_MMS.equals(quality)) {
return MMS_VIDEO_DURATION * 1000;
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 2d6a0f256..aba28fcb6 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -2589,7 +2589,7 @@ public class PhotoModule
/** This can run on a background thread, so don't do UI updates here. Post any
view updates to MainHandler or do it on onPreviewStarted() . */
private void startPreview() {
- if (mPaused || mCameraDevice == null) {
+ if (mPaused || mCameraDevice == null || mParameters == null) {
return;
}
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 5bec8ef14..e66d529b3 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -770,11 +770,11 @@ public class VideoModule implements CameraModule,
String videoQuality = mPreferences.getString(CameraSettings.KEY_VIDEO_QUALITY,
null);
if (videoQuality == null) {
- mParameters = mCameraDevice.getParameters();
+ mParameters = mCameraDevice.getParameters();
String defaultQuality = mActivity.getResources().getString(
R.string.pref_video_quality_default);
boolean hasProfile = CamcorderProfile.hasProfile(
- Integer.parseInt(defaultQuality));
+ CameraSettings.VIDEO_QUALITY_TABLE.get(defaultQuality));
if (hasProfile == true){
videoQuality = defaultQuality;
} else {
@@ -784,7 +784,7 @@ public class VideoModule implements CameraModule,
}
mPreferences.edit().putString(CameraSettings.KEY_VIDEO_QUALITY, videoQuality);
}
- int quality = Integer.valueOf(videoQuality);
+ int quality = CameraSettings.VIDEO_QUALITY_TABLE.get(videoQuality);
// Set video quality.
Intent intent = mActivity.getIntent();