diff options
| author | Steve Kondik <shade@chemlab.org> | 2013-10-17 14:09:34 -0700 |
|---|---|---|
| committer | Steve Kondik <shade@chemlab.org> | 2013-10-17 14:09:34 -0700 |
| commit | 17bd9d3aec795fca96a6aff8974cc5ee194e12b6 (patch) | |
| tree | 919c9136192243c1103d591184003423e69fb505 | |
| parent | 8a1aced9a1a2d070d3533f95b3bc3dedb1b1f282 (diff) | |
| download | android_packages_apps_Gallery2-17bd9d3aec795fca96a6aff8974cc5ee194e12b6.tar.gz android_packages_apps_Gallery2-17bd9d3aec795fca96a6aff8974cc5ee194e12b6.tar.bz2 android_packages_apps_Gallery2-17bd9d3aec795fca96a6aff8974cc5ee194e12b6.zip | |
camera: Add support for high frame rate video
* If the camera supports HFR for the WVGA profile, use it.
Change-Id: I3ba03239b66482af36010b75f6827ad9a5b28d30
| -rw-r--r-- | res/values/arrays.xml | 3 | ||||
| -rw-r--r-- | res/values/cm_strings.xml | 4 | ||||
| -rw-r--r-- | src/com/android/camera/CameraSettings.java | 7 | ||||
| -rw-r--r-- | src/com/android/camera/VideoModule.java | 13 |
4 files changed, 25 insertions, 2 deletions
diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 7c73a9ec3..c0c9750a0 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -23,6 +23,7 @@ <item>@string/pref_video_quality_entry_480p</item> <item>@string/pref_video_quality_entry_high</item> <item>@string/pref_video_quality_entry_low</item> + <item>@string/pref_video_quality_entry_hfr</item> </string-array> <string-array name="pref_video_quality_entryvalues" translatable="false"> @@ -36,6 +37,7 @@ <item>1</item> <!-- The integer value of CamcorderProfile.QUALITY_LOW --> <item>0</item> + <item>9</item> </string-array> <!-- These values correspond to the time interval between frame capture in millseconds @@ -533,5 +535,4 @@ <item>@string/pref_camera_countdown_label_ten</item> <item>@string/pref_camera_countdown_label_fifteen</item> </string-array> - </resources> diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index 60afd6fcb..e7dc36c01 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -84,4 +84,8 @@ <!-- The tips of trimming video --> <string name="fail_trim">This video file can not be trimmed</string> <string name="can_not_trim">Only mp4 files can be trimmed</string> + + <!-- HFR video size --> + <string name="pref_video_quality_entry_hfr">WVGA High Frame Rate</string> + </resources> diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java index f7f8b12c3..ddd2f27a9 100644 --- a/src/com/android/camera/CameraSettings.java +++ b/src/com/android/camera/CameraSettings.java @@ -630,6 +630,13 @@ public class CameraSettings { if (CamcorderProfile.hasProfile(mCameraId, CamcorderProfile.QUALITY_480P)) { supported.add(Integer.toString(CamcorderProfile.QUALITY_480P)); } + if (CamcorderProfile.hasProfile(mCameraId, CamcorderProfile.QUALITY_WVGA)) { + for (Size size : mParameters.getSupportedHfrSizes()) { + if (size.width == 800 && size.height == 480) { + supported.add(Integer.toString(CamcorderProfile.QUALITY_WVGA)); + } + } + } } /** diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index ce8a97ae9..9a3619269 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -193,6 +193,8 @@ public class VideoModule implements CameraModule, private int mVideoWidth; private int mVideoHeight; + private boolean mEnableHFR = false; + private StartPreviewThread mStartPreviewThread; private final MediaSaveService.OnMediaSavedListener mOnVideoSavedListener = @@ -668,6 +670,9 @@ public class VideoModule implements CameraModule, defaultQuality); int quality = Integer.valueOf(videoQuality); + // Enable HFR mode for WVGA + mEnableHFR = quality == CamcorderProfile.QUALITY_WVGA; + // Set video quality. Intent intent = mActivity.getIntent(); if (intent.hasExtra(MediaStore.EXTRA_VIDEO_QUALITY)) { @@ -1935,7 +1940,7 @@ public class VideoModule implements CameraModule, optimalSize.height); } else { // At least one device will get bus overflows if we set this too high - mParameters.setPictureSize(mDesiredPreviewWidth, mDesiredPreviewHeight); + mParameters.setPictureSize(mProfile.videoFrameWidth, mProfile.videoFrameHeight); } // Set JPEG quality. @@ -1943,6 +1948,12 @@ public class VideoModule implements CameraModule, CameraProfile.QUALITY_HIGH); mParameters.setJpegQuality(jpegQuality); + // Enable HFR mode for WVGA + List<String> hfrModes = mParameters.getSupportedVideoHighFrameRateModes(); + if (hfrModes.size() > 0) { + mParameters.setVideoHighFrameRate(mEnableHFR ? hfrModes.get(hfrModes.size() - 1) : "off"); + } + Util.dumpParameters(mParameters); mActivity.mCameraDevice.setParameters(mParameters); |
