diff options
author | Vijay kumar Tumati <vtumati@codeaurora.org> | 2014-03-05 15:54:22 +0530 |
---|---|---|
committer | Vijay kumar Tumati <vtumati@codeaurora.org> | 2014-07-16 10:58:02 +0530 |
commit | fd5878c075348cd1c0ccd16480c80e38b43ca675 (patch) | |
tree | 5e7285ebb47864e060e724b72545328ef18bbb07 | |
parent | 38cc61512bb6615e52bc373986edfadb039c7753 (diff) | |
download | android_packages_apps_Snap-fd5878c075348cd1c0ccd16480c80e38b43ca675.tar.gz android_packages_apps_Snap-fd5878c075348cd1c0ccd16480c80e38b43ca675.tar.bz2 android_packages_apps_Snap-fd5878c075348cd1c0ccd16480c80e38b43ca675.zip |
Camera: Add HSR 60 and HSR 90 modes
Adding 2 more modes 60 and 90 to
HSR feature.
HSR - High speed recording where
video is recorded at the same fps
at which camera is pumping frames.
CRs-Fixed: 629713
Change-Id: I31a13f8d5db8c94be7bafb7506bafe268b764362
-rw-r--r-- | res/values/qcomarrays.xml | 8 | ||||
-rw-r--r-- | res/values/qcomstrings.xml | 16 | ||||
-rw-r--r-- | src/com/android/camera/CameraSettings.java | 5 | ||||
-rw-r--r-- | src/com/android/camera/VideoModule.java | 89 |
4 files changed, 50 insertions, 68 deletions
diff --git a/res/values/qcomarrays.xml b/res/values/qcomarrays.xml index a87977d66..2b1fade1c 100644 --- a/res/values/qcomarrays.xml +++ b/res/values/qcomarrays.xml @@ -404,7 +404,9 @@ <item>@string/pref_camera_hfr_entry_2x</item> <item>@string/pref_camera_hfr_entry_3x</item> <item>@string/pref_camera_hfr_entry_4x</item> - <item>@string/pref_camera_hfr_entry_hsr</item> + <item>@string/pref_camera_hfr_entry_hsr_60</item> + <item>@string/pref_camera_hfr_entry_hsr_90</item> + <item>@string/pref_camera_hfr_entry_hsr_120</item> </string-array> <!-- Do not localize entryvalues --> @@ -413,7 +415,9 @@ <item>@string/pref_camera_hfr_value_2x</item> <item>@string/pref_camera_hfr_value_3x</item> <item>@string/pref_camera_hfr_value_4x</item> - <item>@string/pref_camera_hfr_value_hsr</item> + <item>@string/pref_camera_hfr_value_hsr_60</item> + <item>@string/pref_camera_hfr_value_hsr_90</item> + <item>@string/pref_camera_hfr_value_hsr_120</item> </string-array> <!-- Do not localize entryvalues --> diff --git a/res/values/qcomstrings.xml b/res/values/qcomstrings.xml index f3617aaa8..6d1815a77 100644 --- a/res/values/qcomstrings.xml +++ b/res/values/qcomstrings.xml @@ -213,7 +213,7 @@ <!-- The message is shown in dialog when the app encounters an unsupported resolution for HSR mode --> <string name="error_app_unsupported_hsr"> - HSR(120 FPS) is not supported for selected resolution + HSR is not supported for selected resolution </string> <!-- The message is shown in dialog when the app encounters an unsupported video codec for HFR mode --> @@ -265,14 +265,18 @@ <string name="pref_camera_hfr_entry_2x">HFR 60</string> <string name="pref_camera_hfr_entry_3x">HFR 90</string> <string name="pref_camera_hfr_entry_4x">HFR 120</string> - <string name="pref_camera_hfr_entry_hsr">HSR 120</string> + <string name="pref_camera_hfr_entry_hsr_60">HSR 60</string> + <string name="pref_camera_hfr_entry_hsr_90">HSR 90</string> + <string name="pref_camera_hfr_entry_hsr_120">HSR 120</string> <!-- HFR entry values. Do not translate. --> <string name="pref_camera_hfr_value_off">off</string> - <string name="pref_camera_hfr_value_2x">60</string> - <string name="pref_camera_hfr_value_3x">90</string> - <string name="pref_camera_hfr_value_4x">120</string> - <string name="pref_camera_hfr_value_hsr">hsr</string> + <string name="pref_camera_hfr_value_2x">hfr60</string> + <string name="pref_camera_hfr_value_3x">hfr90</string> + <string name="pref_camera_hfr_value_4x">hfr120</string> + <string name="pref_camera_hfr_value_hsr_60">hsr60</string> + <string name="pref_camera_hfr_value_hsr_90">hsr90</string> + <string name="pref_camera_hfr_value_hsr_120">hsr120</string> <!-- Denoise Settings screen, setting title text --> <string name="pref_camera_denoise_title">Wavelet Denoise Mode</string> diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java index 5e24ced13..1027c9c39 100644 --- a/src/com/android/camera/CameraSettings.java +++ b/src/com/android/camera/CameraSettings.java @@ -445,11 +445,6 @@ public class CameraSettings { pictureFormat, getSupportedPictureFormatLists()); } - if (hfr != null) { - filterUnsupportedOptions(group, - hfr, mParameters.getSupportedVideoHighFrameRateModes()); - } - if(advancedFeatures != null) { filterUnsupportedOptions(group, advancedFeatures, getSupportedAdvancedFeatures(mParameters)); diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index 8c27d555f..79ab14761 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -1879,6 +1879,7 @@ public class VideoModule implements CameraModule, mUnsupportedHFRVideoSize = false; mUnsupportedHFRVideoCodec = false; + mUnsupportedHSRVideoSize = false; // To set preview format as YV12 , run command // "adb shell setprop "debug.camera.yv12" true" String yv12formatset = SystemProperties.get("debug.camera.yv12"); @@ -1891,22 +1892,26 @@ public class VideoModule implements CameraModule, String HighFrameRate = mPreferences.getString( CameraSettings.KEY_VIDEO_HIGH_FRAME_RATE, mActivity. getString(R.string.pref_camera_hfr_default)); - - if(!("off".equals(HighFrameRate)) && !("hsr".equals(HighFrameRate))){ - mUnsupportedHFRVideoSize = true; + if (("hfr".equals(HighFrameRate.substring(0,3))) || + ("hsr".equals(HighFrameRate.substring(0,3)))) { + String hfrRate = HighFrameRate.substring(3); + if ("hfr".equals(HighFrameRate.substring(0,3))) { + mUnsupportedHFRVideoSize = true; + } else mUnsupportedHSRVideoSize = true; String hfrsize = videoWidth+"x"+videoHeight; Log.v(TAG, "current set resolution is : "+hfrsize); try { Size size = null; - if (isSupported(HighFrameRate,mParameters.getSupportedVideoHighFrameRateModes())) { + if (isSupported(hfrRate,mParameters.getSupportedVideoHighFrameRateModes())) { int index = mParameters.getSupportedVideoHighFrameRateModes().indexOf( - HighFrameRate); + hfrRate); size = mParameters.getSupportedHfrSizes().get(index); } if (size != null) { - Log.v(TAG, "supported hfr size : "+ size.width+ " "+size.height); if (videoWidth <= size.width && videoHeight <= size.height) { - mUnsupportedHFRVideoSize = false; + if ("hfr".equals(HighFrameRate.substring(0,3))) { + mUnsupportedHFRVideoSize = false; + } else mUnsupportedHSRVideoSize = false; Log.v(TAG,"Current hfr resolution is supported"); } } @@ -1914,7 +1919,7 @@ public class VideoModule implements CameraModule, Log.e(TAG, "supported hfr sizes is null"); } - int hfrFps = Integer.parseInt(HighFrameRate); + int hfrFps = Integer.parseInt(hfrRate); int inputBitrate = videoWidth*videoHeight*hfrFps; //check if codec supports the resolution, otherwise throw toast @@ -1932,59 +1937,33 @@ public class VideoModule implements CameraModule, "mMaxHFRFrameWidth = " + videoEncoder.mMaxHFRFrameWidth + " , "+ "mMaxHFRFrameHeight = " + videoEncoder.mMaxHFRFrameHeight + " , "+ "mMaxHFRMode = " + videoEncoder.mMaxHFRMode); - mUnsupportedHFRVideoSize = true; + if ("hfr".equals(HighFrameRate.substring(0,3))) { + mUnsupportedHFRVideoSize = true; + } else mUnsupportedHSRVideoSize = true; } break; } } - - if(mUnsupportedHFRVideoSize) - Log.v(TAG,"Unsupported hfr resolution"); - - if(mVideoEncoder != MediaRecorder.VideoEncoder.H264) - mUnsupportedHFRVideoCodec = true; - } - if (isSupported(HighFrameRate, - mParameters.getSupportedVideoHighFrameRateModes()) && - !mUnsupportedHFRVideoSize && - !("hsr".equals(HighFrameRate))) { - mParameters.setVideoHighFrameRate(HighFrameRate); - mParameters.set("video-hsr", "off"); - } - else { - mParameters.setVideoHighFrameRate("off"); - } - mUnsupportedHSRVideoSize = false; - - if (("hsr".equals(HighFrameRate))) { - mUnsupportedHSRVideoSize = true; - String hsrsize = videoWidth+"x"+videoHeight; - Log.v(TAG, "current set resolution is : "+hsrsize); - try { - Size size = null; - if (isSupported("120",mParameters.getSupportedVideoHighFrameRateModes())) { - int index = mParameters.getSupportedVideoHighFrameRateModes().indexOf( - "120"); - size = mParameters.getSupportedHfrSizes().get(index); - } - if (size != null) { - Log.v(TAG, "supported hsr size : "+ size.width+ " "+size.height); - if (videoWidth <= size.width && videoHeight <= size.height) { - mUnsupportedHSRVideoSize = false; - Log.v(TAG,"Current hsr resolution is supported"); - } + if ("hfr".equals(HighFrameRate.substring(0,3))) { + mParameters.set("video-hsr", "off"); + if (mUnsupportedHFRVideoSize) { + mParameters.setVideoHighFrameRate("off"); + Log.v(TAG,"Unsupported hfr resolution"); + } else { + mParameters.setVideoHighFrameRate(hfrRate); } - } catch (NullPointerException e) { - Log.e(TAG, "supported hfr sizes is null"); + } else { + mParameters.setVideoHighFrameRate("off"); + if (mUnsupportedHSRVideoSize) { + Log.v(TAG,"Unsupported hsr resolution"); + mParameters.set("video-hsr", "off"); + } else mParameters.set("video-hsr", hfrRate); } - - if (mUnsupportedHSRVideoSize) Log.v(TAG,"Unsupported hsr resolution"); - } - - if (("hsr".equals(HighFrameRate)) && !mUnsupportedHSRVideoSize) { - mParameters.set("video-hsr", "on"); - } - else { + if(mVideoEncoder != MediaRecorder.VideoEncoder.H264) { + mUnsupportedHFRVideoCodec = true; + } + } else { + mParameters.setVideoHighFrameRate("off"); mParameters.set("video-hsr", "off"); } |