OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.media; | 5 package org.chromium.media; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.graphics.SurfaceTexture; | 8 import android.graphics.SurfaceTexture; |
9 import android.opengl.GLES20; | 9 import android.opengl.GLES20; |
10 import android.util.Log; | 10 import android.util.Log; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 Log.d(TAG, "allocate: matched (" + matchedWidth + "x" + matchedHeight +
")"); | 158 Log.d(TAG, "allocate: matched (" + matchedWidth + "x" + matchedHeight +
")"); |
159 | 159 |
160 if (parameters.isVideoStabilizationSupported()) { | 160 if (parameters.isVideoStabilizationSupported()) { |
161 Log.d(TAG, "Image stabilization supported, currently: " | 161 Log.d(TAG, "Image stabilization supported, currently: " |
162 + parameters.getVideoStabilization() + ", setting it."); | 162 + parameters.getVideoStabilization() + ", setting it."); |
163 parameters.setVideoStabilization(true); | 163 parameters.setVideoStabilization(true); |
164 } else { | 164 } else { |
165 Log.d(TAG, "Image stabilization not supported."); | 165 Log.d(TAG, "Image stabilization not supported."); |
166 } | 166 } |
167 | 167 |
| 168 if (parameters.getSupportedFocusModes().contains( |
| 169 android.hardware.Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO))
{ |
| 170 parameters.setFocusMode(android.hardware.Camera.Parameters.FOCUS_MOD
E_CONTINUOUS_VIDEO); |
| 171 } else { |
| 172 Log.d(TAG, "Continuous focus mode not supported."); |
| 173 } |
| 174 |
168 setCaptureParameters(matchedWidth, matchedHeight, chosenFrameRate, param
eters); | 175 setCaptureParameters(matchedWidth, matchedHeight, chosenFrameRate, param
eters); |
169 parameters.setPictureSize(matchedWidth, matchedHeight); | 176 parameters.setPictureSize(matchedWidth, matchedHeight); |
170 parameters.setPreviewSize(matchedWidth, matchedHeight); | 177 parameters.setPreviewSize(matchedWidth, matchedHeight); |
171 parameters.setPreviewFpsRange(chosenFpsRange[0], chosenFpsRange[1]); | 178 parameters.setPreviewFpsRange(chosenFpsRange[0], chosenFpsRange[1]); |
172 parameters.setPreviewFormat(mCaptureFormat.mPixelFormat); | 179 parameters.setPreviewFormat(mCaptureFormat.mPixelFormat); |
173 try { | 180 try { |
174 mCamera.setParameters(parameters); | 181 mCamera.setParameters(parameters); |
175 } catch (RuntimeException ex) { | 182 } catch (RuntimeException ex) { |
176 Log.e(TAG, "setParameters: " + ex); | 183 Log.e(TAG, "setParameters: " + ex); |
177 return false; | 184 return false; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 break; | 309 break; |
303 case Surface.ROTATION_0: | 310 case Surface.ROTATION_0: |
304 default: | 311 default: |
305 orientation = 0; | 312 orientation = 0; |
306 break; | 313 break; |
307 } | 314 } |
308 } | 315 } |
309 return orientation; | 316 return orientation; |
310 } | 317 } |
311 } | 318 } |
OLD | NEW |