From fd5878c075348cd1c0ccd16480c80e38b43ca675 Mon Sep 17 00:00:00 2001 From: Vijay kumar Tumati Date: Wed, 5 Mar 2014 15:54:22 +0530 Subject: 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 --- src/com/android/camera/CameraSettings.java | 5 -- src/com/android/camera/VideoModule.java | 89 ++++++++++++------------------ 2 files changed, 34 insertions(+), 60 deletions(-) (limited to 'src/com') 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"); } -- cgit v1.2.3