use of android.hardware.Camera.Parameters in project android_frameworks_base by ResurrectionRemix.
the class CameraTestHelper method getCameraParameters.
/**
* Helper method for getting the available parameters of the default camera
*/
public Parameters getCameraParameters() {
mCamera = Camera.open(CAMERA_ID);
Parameters params = mCamera.getParameters();
mCamera.release();
return params;
}
use of android.hardware.Camera.Parameters in project android_frameworks_base by ResurrectionRemix.
the class LegacyMetadataMapper method createCharacteristics.
/**
* Create characteristics for a legacy device by mapping the {@code parameters}
* and {@code info}
*
* @param parameters A string parseable by {@link Camera.Parameters#unflatten}
* @param info Camera info with camera facing direction and angle of orientation
* @return static camera characteristics for a camera device
*
* @throws NullPointerException if any of the args were {@code null}
*/
public static CameraCharacteristics createCharacteristics(String parameters, android.hardware.CameraInfo info) {
checkNotNull(parameters, "parameters must not be null");
checkNotNull(info, "info must not be null");
checkNotNull(info.info, "info.info must not be null");
CameraMetadataNative m = new CameraMetadataNative();
mapCharacteristicsFromInfo(m, info.info);
Camera.Parameters params = Camera.getEmptyParameters();
params.unflatten(parameters);
mapCharacteristicsFromParameters(m, params);
if (DEBUG) {
Log.v(TAG, "createCharacteristics metadata:");
Log.v(TAG, "--------------------------------------------------- (start)");
m.dumpToLog();
Log.v(TAG, "--------------------------------------------------- (end)");
}
return new CameraCharacteristics(m);
}
use of android.hardware.Camera.Parameters in project android_packages_apps_Camera by CyanogenMod.
the class VideoModule method processZoomValueChanged.
private void processZoomValueChanged(int index, boolean fromKey) {
if (fromKey || (!fromKey && !mZoomSetByKey)) {
// Not useful to change zoom value when the activity is paused.
if (mPaused)
return;
mZoomValue = index;
// Set zoom parameters asynchronously
mParameters.setZoom(mZoomValue);
mActivity.mCameraDevice.setParametersAsync(mParameters);
if (mZoomRenderer != null) {
Parameters p = mActivity.mCameraDevice.getParameters();
mZoomRenderer.setZoomValue(mZoomRatios.get(p.getZoom()));
}
} else {
mZoomSetByKey = false;
}
}
use of android.hardware.Camera.Parameters in project android_packages_apps_Camera by CyanogenMod.
the class PanoramaModule method setupCamera.
private void setupCamera() throws CameraHardwareException, CameraDisabledException {
openCamera();
Parameters parameters = mCameraDevice.getParameters();
setupCaptureParams(parameters);
configureCamera(parameters);
}
use of android.hardware.Camera.Parameters in project JustAndroid by chinaltz.
the class CameraConfigurationManager method initFromCameraParameters.
/**
* 初始化相机参数. cameraResolution,screenResolution
*/
void initFromCameraParameters(Camera camera) {
Parameters parameters = camera.getParameters();
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = manager.getDefaultDisplay();
screenResolution = new Point(display.getWidth(), display.getHeight());
// preview size is always something like 480*320, other 320*480
Point screenResolutionForCamera = new Point();
screenResolutionForCamera.x = screenResolution.x;
screenResolutionForCamera.y = screenResolution.y;
//
if (Config.orientation == 1) {
if (screenResolution.x < screenResolution.y) {
screenResolutionForCamera.x = screenResolution.y;
screenResolutionForCamera.y = screenResolution.x;
}
}
Log.d(TAG, "Screen resolution: " + screenResolutionForCamera);
initCameraResolution(parameters, screenResolutionForCamera);
}
Aggregations