Search in sources :

Example 51 with CameraInfo

use of android.hardware.Camera.CameraInfo in project android_frameworks_base by ResurrectionRemix.

the class CamcorderProfile method get.

/**
     * Returns the camcorder profile for the first back-facing camera on the
     * device at the given quality level. If the device has no back-facing
     * camera, this returns null.
     * @param quality the target quality level for the camcorder profile
     * @see #get(int, int)
     */
public static CamcorderProfile get(int quality) {
    int numberOfCameras = Camera.getNumberOfCameras();
    CameraInfo cameraInfo = new CameraInfo();
    for (int i = 0; i < numberOfCameras; i++) {
        Camera.getCameraInfo(i, cameraInfo);
        if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
            return get(i, quality);
        }
    }
    return null;
}
Also used : CameraInfo(android.hardware.Camera.CameraInfo)

Example 52 with CameraInfo

use of android.hardware.Camera.CameraInfo in project android_frameworks_base by ResurrectionRemix.

the class CamcorderProfile method hasProfile.

/**
     * Returns true if camcorder profile exists for the first back-facing
     * camera at the given quality level.
     *
     * <p>
     * When using the Camera 2 API in {@code LEGACY} mode (i.e. when
     * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL} is set
     * to
     * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY}),
     * {@link #hasProfile} may return {@code true} for unsupported resolutions.  To ensure a
     * a given resolution is supported in LEGACY mode, the configuration given in
     * {@link android.hardware.camera2.CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP}
     * must contain the the resolution in the supported output sizes.  The recommended way to check
     * this is with
     * {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputSizes(Class)} with the
     * class of the desired recording endpoint, and check that the desired resolution is contained
     * in the list returned.
     * </p>
     * @see android.hardware.camera2.CameraManager
     * @see android.hardware.camera2.CameraCharacteristics
     *
     * @param quality the target quality level for the camcorder profile
     */
public static boolean hasProfile(int quality) {
    int numberOfCameras = Camera.getNumberOfCameras();
    CameraInfo cameraInfo = new CameraInfo();
    for (int i = 0; i < numberOfCameras; i++) {
        Camera.getCameraInfo(i, cameraInfo);
        if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
            return hasProfile(i, quality);
        }
    }
    return false;
}
Also used : CameraInfo(android.hardware.Camera.CameraInfo)

Example 53 with CameraInfo

use of android.hardware.Camera.CameraInfo in project android_frameworks_base by ResurrectionRemix.

the class CameraProfile method getJpegEncodingQualityParameter.

/**
     * Returns a pre-defined still image capture (jpeg) quality level
     * used for the given quality level in the Camera application for
     * the first back-facing camera on the device. If the device has no
     * back-facing camera, this returns 0.
     *
     * @param quality The target quality level
     */
public static int getJpegEncodingQualityParameter(int quality) {
    int numberOfCameras = Camera.getNumberOfCameras();
    CameraInfo cameraInfo = new CameraInfo();
    for (int i = 0; i < numberOfCameras; i++) {
        Camera.getCameraInfo(i, cameraInfo);
        if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
            return getJpegEncodingQualityParameter(i, quality);
        }
    }
    return 0;
}
Also used : CameraInfo(android.hardware.Camera.CameraInfo)

Example 54 with CameraInfo

use of android.hardware.Camera.CameraInfo in project android_frameworks_base by DirtyUnicorns.

the class CamcorderProfile method get.

/**
     * Returns the camcorder profile for the first back-facing camera on the
     * device at the given quality level. If the device has no back-facing
     * camera, this returns null.
     * @param quality the target quality level for the camcorder profile
     * @see #get(int, int)
     */
public static CamcorderProfile get(int quality) {
    int numberOfCameras = Camera.getNumberOfCameras();
    CameraInfo cameraInfo = new CameraInfo();
    for (int i = 0; i < numberOfCameras; i++) {
        Camera.getCameraInfo(i, cameraInfo);
        if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
            return get(i, quality);
        }
    }
    return null;
}
Also used : CameraInfo(android.hardware.Camera.CameraInfo)

Example 55 with CameraInfo

use of android.hardware.Camera.CameraInfo in project android_frameworks_base by DirtyUnicorns.

the class CamcorderProfile method hasProfile.

/**
     * Returns true if camcorder profile exists for the first back-facing
     * camera at the given quality level.
     *
     * <p>
     * When using the Camera 2 API in {@code LEGACY} mode (i.e. when
     * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL} is set
     * to
     * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY}),
     * {@link #hasProfile} may return {@code true} for unsupported resolutions.  To ensure a
     * a given resolution is supported in LEGACY mode, the configuration given in
     * {@link android.hardware.camera2.CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP}
     * must contain the the resolution in the supported output sizes.  The recommended way to check
     * this is with
     * {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputSizes(Class)} with the
     * class of the desired recording endpoint, and check that the desired resolution is contained
     * in the list returned.
     * </p>
     * @see android.hardware.camera2.CameraManager
     * @see android.hardware.camera2.CameraCharacteristics
     *
     * @param quality the target quality level for the camcorder profile
     */
public static boolean hasProfile(int quality) {
    int numberOfCameras = Camera.getNumberOfCameras();
    CameraInfo cameraInfo = new CameraInfo();
    for (int i = 0; i < numberOfCameras; i++) {
        Camera.getCameraInfo(i, cameraInfo);
        if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
            return hasProfile(i, quality);
        }
    }
    return false;
}
Also used : CameraInfo(android.hardware.Camera.CameraInfo)

Aggregations

CameraInfo (android.hardware.Camera.CameraInfo)58 Camera (android.hardware.Camera)6 SuppressLint (android.annotation.SuppressLint)5 CameraCharacteristics (android.hardware.camera2.CameraCharacteristics)5 ServiceSpecificException (android.os.ServiceSpecificException)5 WindowManager (android.view.WindowManager)3 IOException (java.io.IOException)2 TargetApi (android.annotation.TargetApi)1 Intent (android.content.Intent)1 Bitmap (android.graphics.Bitmap)1 Face (android.hardware.Camera.Face)1 FaceDetectionListener (android.hardware.Camera.FaceDetectionListener)1 MediaRecorder (android.media.MediaRecorder)1 Uri (android.net.Uri)1 Bundle (android.os.Bundle)1 NonNull (android.support.annotation.NonNull)1 Pair (android.util.Pair)1 LayoutInflater (android.view.LayoutInflater)1 ViewGroup (android.view.ViewGroup)1 AppDataDirGuesser (com.google.testing.littlemock.AppDataDirGuesser)1