diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2014-02-13 02:18:54 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2014-02-13 02:18:54 -0800 |
commit | 2f14bf2b67a04b53916e52d4b1508c021149c82f (patch) | |
tree | a678b4a8674ad6d98352e473cf165cd658f356b1 | |
parent | cc1d00ec9306187cbe7fce0e6ba5446aeaaa98db (diff) | |
parent | 2ff6c25f40b0ab3672084fb7f1736e9113673c28 (diff) | |
download | android_packages_apps_Snap-2f14bf2b67a04b53916e52d4b1508c021149c82f.tar.gz android_packages_apps_Snap-2f14bf2b67a04b53916e52d4b1508c021149c82f.tar.bz2 android_packages_apps_Snap-2f14bf2b67a04b53916e52d4b1508c021149c82f.zip |
Merge "Camera: Add support for high speed recording"
-rw-r--r-- | res/values/qcomarrays.xml | 2 | ||||
-rw-r--r-- | res/values/qcomstrings.xml | 14 | ||||
-rw-r--r-- | src/com/android/camera/VideoModule.java | 52 |
3 files changed, 62 insertions, 6 deletions
diff --git a/res/values/qcomarrays.xml b/res/values/qcomarrays.xml index 4bafc660a..07bb7eb6c 100644 --- a/res/values/qcomarrays.xml +++ b/res/values/qcomarrays.xml @@ -404,6 +404,7 @@ <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> </string-array> <!-- Do not localize entryvalues --> @@ -412,6 +413,7 @@ <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> </string-array> <!-- Do not localize entryvalues --> diff --git a/res/values/qcomstrings.xml b/res/values/qcomstrings.xml index 52484f716..613205729 100644 --- a/res/values/qcomstrings.xml +++ b/res/values/qcomstrings.xml @@ -197,6 +197,12 @@ <!-- The message is shown in dialog when the app encounters an unsupported resolution for HFR mode --> <string name="error_app_unsupported_hfr">HFR is not supported for selected resolution</string> + <!-- 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 + </string> + <!-- The message is shown in dialog when the app encounters an unsupported video codec for HFR mode --> <string name="error_app_unsupported_hfr_codec">Only H264 video encoding is supported when HFR is ON</string> @@ -243,15 +249,17 @@ <!-- Settings screen, hfr radio button choices --> <string name="pref_camera_hfr_entry_off">Off</string> - <string name="pref_camera_hfr_entry_2x">60</string> - <string name="pref_camera_hfr_entry_3x">90</string> - <string name="pref_camera_hfr_entry_4x">120</string> + <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> <!-- 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> <!-- Denoise Settings screen, setting title text --> <string name="pref_camera_denoise_title">Wavelet Denoise Mode</string> diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index b5292b2f2..c0bff40dd 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -296,6 +296,7 @@ public class VideoModule implements CameraModule, private int videoHeight; boolean mUnsupportedResolution = false; private boolean mUnsupportedHFRVideoSize = false; + private boolean mUnsupportedHSRVideoSize = false; private boolean mUnsupportedHFRVideoCodec = false; // This Handler is used to post message back onto the main thread of the @@ -1438,6 +1439,13 @@ public class VideoModule implements CameraModule, return; } + if (mUnsupportedHSRVideoSize == true) { + Log.e(TAG, "Unsupported HSR and video size combinations"); + Toast.makeText(mActivity,R.string.error_app_unsupported_hsr, Toast.LENGTH_SHORT).show(); + mStartRecPending = false; + return; + } + if( mUnsupportedHFRVideoCodec == true) { Log.e(TAG, "Unsupported HFR and video codec combinations"); Toast.makeText(mActivity, R.string.error_app_unsupported_hfr_codec, @@ -1780,7 +1788,8 @@ 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))){ + + if(!("off".equals(HighFrameRate)) && !("hsr".equals(HighFrameRate))){ mUnsupportedHFRVideoSize = true; String hfrsize = videoWidth+"x"+videoHeight; Log.v(TAG, "current set resolution is : "+hfrsize); @@ -1810,10 +1819,47 @@ public class VideoModule implements CameraModule, } if (isSupported(HighFrameRate, mParameters.getSupportedVideoHighFrameRateModes()) && - !mUnsupportedHFRVideoSize) { + !mUnsupportedHFRVideoSize && + !("hsr".equals(HighFrameRate))) { mParameters.setVideoHighFrameRate(HighFrameRate); - } else + 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"); + } + } + } catch (NullPointerException e) { + Log.e(TAG, "supported hfr sizes is null"); + } + + if (mUnsupportedHSRVideoSize) Log.v(TAG,"Unsupported hsr resolution"); + } + + if (("hsr".equals(HighFrameRate)) && !mUnsupportedHSRVideoSize) { + mParameters.set("video-hsr", "on"); + } + else { + mParameters.set("video-hsr", "off"); + } // Read Flip mode from adb command //value: 0(default) - FLIP_MODE_OFF |