本文整理匯總了Java中android.hardware.Camera.Parameters.getSupportedPreviewFpsRange方法的典型用法代碼示例。如果您正苦於以下問題:Java Parameters.getSupportedPreviewFpsRange方法的具體用法?Java Parameters.getSupportedPreviewFpsRange怎麽用?Java Parameters.getSupportedPreviewFpsRange使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.hardware.Camera.Parameters
的用法示例。
在下文中一共展示了Parameters.getSupportedPreviewFpsRange方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupCaptureParams
import android.hardware.Camera.Parameters; //導入方法依賴的package包/類
private void setupCaptureParams(Parameters parameters) {
List<Size> supportedSizes = parameters.getSupportedPreviewSizes();
if (!findBestPreviewSize(supportedSizes, true, true)) {
Log.w(TAG, "No 4:3 ratio preview size supported.");
if (!findBestPreviewSize(supportedSizes, false, true)) {
Log.w(TAG, "Can't find a supported preview size smaller than 960x720.");
findBestPreviewSize(supportedSizes, false, false);
}
}
Log.d(TAG, "camera preview h = "
+ mCameraPreviewHeight + " , w = " + mCameraPreviewWidth);
parameters.setPreviewSize(mCameraPreviewWidth, mCameraPreviewHeight);
List<int[]> frameRates = parameters.getSupportedPreviewFpsRange();
int last = frameRates.size() - 1;
int minFps = (frameRates.get(last))[Parameters.PREVIEW_FPS_MIN_INDEX];
int maxFps = (frameRates.get(last))[Parameters.PREVIEW_FPS_MAX_INDEX];
parameters.setPreviewFpsRange(minFps, maxFps);
Log.d(TAG, "preview fps: " + minFps + ", " + maxFps);
List<String> supportedFocusModes = parameters.getSupportedFocusModes();
if (supportedFocusModes.indexOf(mTargetFocusMode) >= 0) {
parameters.setFocusMode(mTargetFocusMode);
} else {
// Use the default focus mode and log a message
Log.w(TAG, "Cannot set the focus mode to " + mTargetFocusMode +
" becuase the mode is not supported.");
}
parameters.set(CameraUtil.RECORDING_HINT, CameraUtil.FALSE);
mHorizontalViewAngle = parameters.getHorizontalViewAngle();
mVerticalViewAngle = parameters.getVerticalViewAngle();
}
示例2: getMaxPreviewFpsRange
import android.hardware.Camera.Parameters; //導入方法依賴的package包/類
public static int[] getMaxPreviewFpsRange(Parameters params) {
List<int[]> frameRates = params.getSupportedPreviewFpsRange();
if (frameRates != null && frameRates.size() > 0) {
// The list is sorted. Return the last element.
return frameRates.get(frameRates.size() - 1);
}
return new int[0];
}
示例3: setCamera
import android.hardware.Camera.Parameters; //導入方法依賴的package包/類
void setCamera() {
myCamera = getCameraInstance();
Parameters params = myCamera.getParameters();
List<Camera.Size> sizes = params.getSupportedPictureSizes();
int minWidth = Integer.MAX_VALUE, minHeight = Integer.MAX_VALUE;
for (int i = 0; i < sizes.size(); i++) {
Log.i("PictureSize", "Supported Size: " + sizes.get(i).width
+ " height : " + sizes.get(i).height);
if (sizes.get(i).width < minWidth) {
minWidth = sizes.get(i).width;
minHeight = sizes.get(i).height;
}
}
Log.i("PictureSize", "Min Size: " + minWidth + " height : " + minHeight);
List<int[]> fpsRanges = params.getSupportedPreviewFpsRange();
for (int i = 0; i < fpsRanges.size(); i++) {
Log.i("Fps ranges:", String.valueOf(fpsRanges.get(i)[0] / 1000)
+ ' ' + String.valueOf(fpsRanges.get(i)[1] / 1000));
}
params.setPictureSize(minWidth, minHeight);
params.setPreviewSize(minWidth, minHeight);
myCamera.setParameters(params);
camHeight = myCamera.getParameters().getPreviewSize().height;
camWidth = myCamera.getParameters().getPreviewSize().width;
Log.i("SavedPictureSize", "Size: " + camWidth + " height : "
+ camHeight);
mCallbackBuf = new byte[camHeight * camWidth * 3 / 2]; // 用於previewcallback
hbeg = (camHeight - hnum) / 2;
wbeg = (camWidth - wnum) / 2;
myCamera.setPreviewCallbackWithBuffer(new MyPreview());
myCamera.addCallbackBuffer(mCallbackBuf);
sv_hidden.removeAllViews(); // 是不是應該先清空
myCameraSurfaceView = new MyCameraSurfaceView(getApplicationContext(),
myCamera);
sv_hidden.addView(myCameraSurfaceView);
// sv_hidden.setVisibility(View.INVISIBLE);
}