summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/VideoModule.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/VideoModule.java')
-rw-r--r--src/com/android/camera/VideoModule.java89
1 files changed, 34 insertions, 55 deletions
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");
}