diff options
author | Vladimir Petrov <vpetro@codeaurora.org> | 2014-07-14 18:32:12 -0700 |
---|---|---|
committer | Leena Winterrowd <lenhardw@codeaurora.org> | 2014-08-21 16:43:23 -0700 |
commit | 3d8233a425e5f3e59f402fe3a14e672de1fb7d82 (patch) | |
tree | c2c0756a3c0a63e0c8d7a7fc1812cc2db86305b2 | |
parent | 759452b4bf1c28769fb1b151f0abb79331ce3f36 (diff) | |
download | android_packages_apps_Snap-3d8233a425e5f3e59f402fe3a14e672de1fb7d82.tar.gz android_packages_apps_Snap-3d8233a425e5f3e59f402fe3a14e672de1fb7d82.tar.bz2 android_packages_apps_Snap-3d8233a425e5f3e59f402fe3a14e672de1fb7d82.zip |
SnapdragonCamera: Fix improper call to disable HFR
- Remove the filter for unsupported HFR modes in camcorder
(may re-introduce CR#510215)
- Fix improperly hardcoded setting of HFR mode to "disable"
instead of "off"
- Revert code where string prefixes were added to HFR camera
parameter
This reverts commit 1ad1d65a88e350e6e5461828ab930638b778564d.
This reverts commit 9804a5e9116c8e17ac11449fcd83f2e0af5d4f38.
CRs-Fixed: 687765
Change-Id: I85eecca7f2fc9bd83e90e0610ab66f1102dedc02
-rw-r--r-- | src/com/android/camera/CameraSettings.java | 3 | ||||
-rw-r--r-- | src/com/android/camera/VideoModule.java | 77 |
2 files changed, 45 insertions, 35 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java index 3a87652df..2803dbe1b 100644 --- a/src/com/android/camera/CameraSettings.java +++ b/src/com/android/camera/CameraSettings.java @@ -127,6 +127,7 @@ public class CameraSettings { public static final String KEY_QC_FACE_RECOGNITION = "face-recognition"; public static final String KEY_QC_DIS_MODE = "dis"; public static final String KEY_SNAPCAM_HDR_MODE = "hdr-mode"; + public static final String KEY_VIDEO_HSR = "video-hsr"; public static final String KEY_INTERNAL_PREVIEW_RESTART = "internal-restart"; public static final String KEY_QC_ZSL_HDR_SUPPORTED = "zsl-hdr-supported"; @@ -375,7 +376,6 @@ public class CameraSettings { ListPreference videoSnapSize = group.findPreference(KEY_VIDEO_SNAPSHOT_SIZE); ListPreference videoHdr = group.findPreference(KEY_VIDEO_HDR); ListPreference pictureFormat = group.findPreference(KEY_PICTURE_FORMAT); - ListPreference hfr = group.findPreference(KEY_VIDEO_HIGH_FRAME_RATE); ListPreference longShot = group.findPreference(KEY_LONGSHOT); ListPreference auto_hdr = group.findPreference(KEY_AUTO_HDR); ListPreference hdr_mode = group.findPreference(KEY_HDR_MODE); @@ -470,6 +470,7 @@ public class CameraSettings { removePreference(group, longShot.getKey()); } } + private void initPreference(PreferenceGroup group) { ListPreference videoQuality = group.findPreference(KEY_VIDEO_QUALITY); ListPreference timeLapseInterval = group.findPreference(KEY_VIDEO_TIME_LAPSE_FRAME_INTERVAL); diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index 9d0700dd1..698e76ff9 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -1279,23 +1279,23 @@ public class VideoModule implements CameraModule, //check if codec supports the resolution, otherwise throw toast List<VideoEncoderCap> videoEncoders = EncoderCapabilities.getVideoEncoders(); for (VideoEncoderCap videoEncoder: videoEncoders) { - if (videoEncoder.mCodec == mVideoEncoder){ + if (videoEncoder.mCodec == mVideoEncoder) { if (videoWidth > videoEncoder.mMaxFrameWidth || - videoWidth < videoEncoder.mMinFrameWidth || - videoHeight > videoEncoder.mMaxFrameHeight || - videoHeight < videoEncoder.mMinFrameHeight){ - Log.e(TAG,"Selected codec "+mVideoEncoder+ - " does not support "+ videoWidth + "x" + videoHeight - +" resolution"); - Log.e(TAG, "Codec capabilities: " + - "mMinFrameWidth = " + videoEncoder.mMinFrameWidth + " , "+ - "mMinFrameHeight = " + videoEncoder.mMinFrameHeight + " , "+ - "mMaxFrameWidth = " + videoEncoder.mMaxFrameWidth + " , "+ - "mMaxFrameHeight = " + videoEncoder.mMaxFrameHeight); - mUnsupportedResolution = true; - Toast.makeText(mActivity, R.string.error_app_unsupported, - Toast.LENGTH_LONG).show(); - return; + videoWidth < videoEncoder.mMinFrameWidth || + videoHeight > videoEncoder.mMaxFrameHeight || + videoHeight < videoEncoder.mMinFrameHeight) { + Log.e(TAG, "Selected codec " + mVideoEncoder + + " does not support "+ videoWidth + "x" + videoHeight + + " resolution"); + Log.e(TAG, "Codec capabilities: " + + "mMinFrameWidth = " + videoEncoder.mMinFrameWidth + " , " + + "mMinFrameHeight = " + videoEncoder.mMinFrameHeight + " , " + + "mMaxFrameWidth = " + videoEncoder.mMaxFrameWidth + " , " + + "mMaxFrameHeight = " + videoEncoder.mMaxFrameHeight); + mUnsupportedResolution = true; + Toast.makeText(mActivity, R.string.error_app_unsupported, + Toast.LENGTH_LONG).show(); + return; } break; } @@ -1976,12 +1976,14 @@ public class VideoModule implements CameraModule, String hfrRate = HighFrameRate.substring(3); if ("hfr".equals(HighFrameRate.substring(0,3))) { mUnsupportedHFRVideoSize = true; - } else mUnsupportedHSRVideoSize = true; + } else { + mUnsupportedHSRVideoSize = true; + } String hfrsize = videoWidth+"x"+videoHeight; Log.v(TAG, "current set resolution is : "+hfrsize); try { Size size = null; - if (isSupported(hfrRate,mParameters.getSupportedVideoHighFrameRateModes())) { + if (isSupported(hfrRate, mParameters.getSupportedVideoHighFrameRateModes())) { int index = mParameters.getSupportedVideoHighFrameRateModes().indexOf( hfrRate); size = mParameters.getSupportedHfrSizes().get(index); @@ -1990,7 +1992,9 @@ public class VideoModule implements CameraModule, if (videoWidth <= size.width && videoHeight <= size.height) { if ("hfr".equals(HighFrameRate.substring(0,3))) { mUnsupportedHFRVideoSize = false; - } else mUnsupportedHSRVideoSize = false; + } else { + mUnsupportedHSRVideoSize = false; + } Log.v(TAG,"Current hfr resolution is supported"); } } @@ -2008,23 +2012,25 @@ public class VideoModule implements CameraModule, int maxBitrate = (videoEncoder.mMaxHFRFrameWidth * videoEncoder.mMaxHFRFrameHeight * videoEncoder.mMaxHFRMode); - if (inputBitrate > maxBitrate ){ - Log.e(TAG,"Selected codec "+mVideoEncoder+ + if (inputBitrate > maxBitrate ) { + Log.e(TAG,"Selected codec "+mVideoEncoder+ " does not support HFR " + HighFrameRate + " with "+ videoWidth + "x" + videoHeight +" resolution"); - Log.e(TAG, "Codec capabilities: " + - "mMaxHFRFrameWidth = " + videoEncoder.mMaxHFRFrameWidth + " , "+ - "mMaxHFRFrameHeight = " + videoEncoder.mMaxHFRFrameHeight + " , "+ + Log.e(TAG, "Codec capabilities: " + + "mMaxHFRFrameWidth = " + videoEncoder.mMaxHFRFrameWidth + " , " + + "mMaxHFRFrameHeight = " + videoEncoder.mMaxHFRFrameHeight + " , " + "mMaxHFRMode = " + videoEncoder.mMaxHFRMode); - if ("hfr".equals(HighFrameRate.substring(0,3))) { - mUnsupportedHFRVideoSize = true; - } else mUnsupportedHSRVideoSize = true; + if ("hfr".equals(HighFrameRate.substring(0,3))) { + mUnsupportedHFRVideoSize = true; + } else { + mUnsupportedHSRVideoSize = true; + } } break; } } if ("hfr".equals(HighFrameRate.substring(0,3))) { - mParameters.set("video-hsr", "off"); + mParameters.set(CameraSettings.KEY_VIDEO_HSR, "off"); if (mUnsupportedHFRVideoSize) { mParameters.setVideoHighFrameRate("off"); Log.v(TAG,"Unsupported hfr resolution"); @@ -2035,15 +2041,17 @@ public class VideoModule implements CameraModule, mParameters.setVideoHighFrameRate("off"); if (mUnsupportedHSRVideoSize) { Log.v(TAG,"Unsupported hsr resolution"); - mParameters.set("video-hsr", "off"); - } else mParameters.set("video-hsr", hfrRate); + mParameters.set(CameraSettings.KEY_VIDEO_HSR, "off"); + } else { + mParameters.set(CameraSettings.KEY_VIDEO_HSR, hfrRate); + } } if(mVideoEncoder != MediaRecorder.VideoEncoder.H264) { mUnsupportedHFRVideoCodec = true; } } else { mParameters.setVideoHighFrameRate("off"); - mParameters.set("video-hsr", "off"); + mParameters.set(CameraSettings.KEY_VIDEO_HSR, "off"); } // Read Flip mode from adb command @@ -2100,7 +2108,7 @@ public class VideoModule implements CameraModule, //HFR/HSR recording not supported with DIS,TimeLapse,HDR option String hfr = mParameters.getVideoHighFrameRate(); - String hsr = mParameters.get("video-hsr"); + String hsr = mParameters.get(CameraSettings.KEY_VIDEO_HSR); String hdr = mParameters.getVideoHDRMode(); if ( ((hfr != null) && (!hfr.equals("off"))) || ((hsr != null) && (!hsr.equals("off"))) ) { @@ -2116,8 +2124,9 @@ public class VideoModule implements CameraModule, Toast.makeText(mActivity, R.string.error_app_unsupported_hfr_selection, Toast.LENGTH_LONG).show(); mParameters.setVideoHighFrameRate("off"); - mParameters.set("video-hsr", "off"); - mUI.overrideSettings(CameraSettings.KEY_VIDEO_HIGH_FRAME_RATE,"off"); + mParameters.set(CameraSettings.KEY_VIDEO_HSR, "off"); + mUI.overrideSettings(CameraSettings.KEY_VIDEO_HIGH_FRAME_RATE, "off"); + mUI.initializePopup(mPreferenceGroup); } } |