當前位置: 首頁>>代碼示例>>Java>>正文


Java Parameters.setPreviewFpsRange方法代碼示例

本文整理匯總了Java中android.hardware.Camera.Parameters.setPreviewFpsRange方法的典型用法代碼示例。如果您正苦於以下問題:Java Parameters.setPreviewFpsRange方法的具體用法?Java Parameters.setPreviewFpsRange怎麽用?Java Parameters.setPreviewFpsRange使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.hardware.Camera.Parameters的用法示例。


在下文中一共展示了Parameters.setPreviewFpsRange方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateCamera

import android.hardware.Camera.Parameters; //導入方法依賴的package包/類
protected synchronized void updateCamera() throws RuntimeException {
	if (mPreviewStarted) {
		mPreviewStarted = false;
		mCamera.stopPreview();
	}

	Parameters parameters = mCamera.getParameters();
	mQuality = VideoQuality.determineClosestSupportedResolution(parameters, mQuality);
	int[] max = VideoQuality.determineMaximumSupportedFramerate(parameters);
	parameters.setPreviewFormat(mCameraImageFormat);
	parameters.setPreviewSize(mQuality.resX, mQuality.resY);
	parameters.setPreviewFpsRange(max[0], max[1]);

	try {
		mCamera.setParameters(parameters);
		mCamera.setDisplayOrientation(mOrientation);
		mCamera.startPreview();
		mPreviewStarted = true;
	} catch (RuntimeException e) {
		destroyCamera();
		throw e;
	}
}
 
開發者ID:ghazi94,項目名稱:Android_CCTV,代碼行數:24,代碼來源:VideoStream.java

示例2: updateCamera

import android.hardware.Camera.Parameters; //導入方法依賴的package包/類
protected synchronized void updateCamera() throws RuntimeException {
	
	// The camera is already correctly configured
	if (mUpdated) return;
	
	if (mPreviewStarted) {
		mPreviewStarted = false;
		mCamera.stopPreview();
	}

	Parameters parameters = mCamera.getParameters();
	mQuality = VideoQuality.determineClosestSupportedResolution(parameters, mQuality);
	int[] max = VideoQuality.determineMaximumSupportedFramerate(parameters);
	
	double ratio = (double)mQuality.resX/(double)mQuality.resY;
	mSurfaceView.requestAspectRatio(ratio);
	
	parameters.setPreviewFormat(mCameraImageFormat);
	parameters.setPreviewSize(mQuality.resX, mQuality.resY);
	parameters.setPreviewFpsRange(max[0], max[1]);

	try {
		mCamera.setParameters(parameters);
		mCamera.setDisplayOrientation(mOrientation);
		mCamera.startPreview();
		mPreviewStarted = true;
		mUpdated = true;
	} catch (RuntimeException e) {
		destroyCamera();
		throw e;
	}
}
 
開發者ID:galme,項目名稱:ROLF-EV3,代碼行數:33,代碼來源:VideoStream.java

示例3: updateCamera

import android.hardware.Camera.Parameters; //導入方法依賴的package包/類
protected synchronized void updateCamera() throws RuntimeException {
	
	// The camera is already correctly configured
	if (mUpdated) return;
	
	if (mPreviewStarted) {
		mPreviewStarted = false;
		mCamera.stopPreview();
	}

	Parameters parameters = mCamera.getParameters();
	mQuality = VideoQuality.determineClosestSupportedResolution(parameters, mQuality);
	int[] max = VideoQuality.determineMaximumSupportedFramerate(parameters);
	
	double ratio = (double)mQuality.resX/(double)mQuality.resY;
	mSurfaceView.requestAspectRatio(ratio);
	
	parameters.setPreviewFormat(mCameraImageFormat);
	parameters.setPreviewSize(mQuality.resX, mQuality.resY);
	//int cur_fr = mQuality.framerate * 1000;
	//if(max[0] < cur_fr && cur_fr < max[1])
	//	max[0] = max[1] = cur_fr;
	parameters.setPreviewFpsRange(max[0], max[1]);
       parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);   //focus

	try {
		mCamera.setParameters(parameters);
		mCamera.setDisplayOrientation(mOrientation);
		mCamera.startPreview();
		//mCamera.cancelAutoFocus();
		mPreviewStarted = true;
		mUpdated = true;
	} catch (RuntimeException e) {
		destroyCamera();
		throw e;
	}
}
 
開發者ID:xunboo,項目名稱:JJCamera,代碼行數:38,代碼來源:VideoStream.java

示例4: 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();
}
 
開發者ID:asm-products,項目名稱:nexus-camera,代碼行數:35,代碼來源:WideAnglePanoramaModule.java


注:本文中的android.hardware.Camera.Parameters.setPreviewFpsRange方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。