Search in sources :

Example 1 with StaticMetadata

use of com.android.mediaframeworktest.helpers.StaticMetadata in project android_frameworks_base by DirtyUnicorns.

the class Camera2SurfaceViewTestCase method openDevice.

/**
     * Open a camera device and get the StaticMetadata for a given camera id.
     *
     * @param cameraId The id of the camera device to be opened.
     */
protected void openDevice(String cameraId) throws Exception {
    mCamera = CameraTestUtils.openCamera(mCameraManager, cameraId, mCameraListener, mHandler);
    mCollector.setCameraId(cameraId);
    CameraCharacteristics properties = mCameraManager.getCameraCharacteristics(cameraId);
    mStaticInfo = new StaticMetadata(properties, CheckLevel.ASSERT, /*collector*/
    null);
    StreamConfigurationMap configMap = properties.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
    mSupportRAW10 = configMap.isOutputSupportedFor(ImageFormat.RAW10);
    if (mStaticInfo.isColorOutputSupported()) {
        mOrderedPreviewSizes = getSupportedPreviewSizes(cameraId, mCameraManager, getPreviewSizeBound(mWindowManager, PREVIEW_SIZE_BOUND));
        mOrderedVideoSizes = getSupportedVideoSizes(cameraId, mCameraManager, PREVIEW_SIZE_BOUND);
        mOrderedStillSizes = getSupportedStillSizes(cameraId, mCameraManager, null);
        if (mSupportRAW10) {
            mOrderedRAW10Sizes = getSortedSizesForFormat(cameraId, mCameraManager, ImageFormat.RAW10, null);
        }
        mOrderedYUV420888Sizes = getSortedSizesForFormat(cameraId, mCameraManager, ImageFormat.YUV_420_888, null);
        // Use ImageFormat.YUV_420_888 for now. TODO: need figure out what's format for preview
        // in public API side.
        mMinPreviewFrameDurationMap = mStaticInfo.getAvailableMinFrameDurationsForFormatChecked(ImageFormat.YUV_420_888);
    }
}
Also used : CameraCharacteristics(android.hardware.camera2.CameraCharacteristics) StreamConfigurationMap(android.hardware.camera2.params.StreamConfigurationMap) StaticMetadata(com.android.mediaframeworktest.helpers.StaticMetadata)

Example 2 with StaticMetadata

use of com.android.mediaframeworktest.helpers.StaticMetadata in project android_frameworks_base by DirtyUnicorns.

the class Camera2SurfaceViewTestCase method isReprocessSupported.

protected boolean isReprocessSupported(String cameraId, int format) throws CameraAccessException {
    if (format != ImageFormat.YUV_420_888 && format != ImageFormat.PRIVATE) {
        throw new IllegalArgumentException("format " + format + " is not supported for reprocessing");
    }
    StaticMetadata info = new StaticMetadata(mCameraManager.getCameraCharacteristics(cameraId), CheckLevel.ASSERT, /*collector*/
    null);
    int cap = CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING;
    if (format == ImageFormat.PRIVATE) {
        cap = CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING;
    }
    return info.isCapabilitySupported(cap);
}
Also used : StaticMetadata(com.android.mediaframeworktest.helpers.StaticMetadata)

Example 3 with StaticMetadata

use of com.android.mediaframeworktest.helpers.StaticMetadata in project android_frameworks_base by crdroidandroid.

the class Camera2SurfaceViewTestCase method isReprocessSupported.

protected boolean isReprocessSupported(String cameraId, int format) throws CameraAccessException {
    if (format != ImageFormat.YUV_420_888 && format != ImageFormat.PRIVATE) {
        throw new IllegalArgumentException("format " + format + " is not supported for reprocessing");
    }
    StaticMetadata info = new StaticMetadata(mCameraManager.getCameraCharacteristics(cameraId), CheckLevel.ASSERT, /*collector*/
    null);
    int cap = CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING;
    if (format == ImageFormat.PRIVATE) {
        cap = CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING;
    }
    return info.isCapabilitySupported(cap);
}
Also used : StaticMetadata(com.android.mediaframeworktest.helpers.StaticMetadata)

Example 4 with StaticMetadata

use of com.android.mediaframeworktest.helpers.StaticMetadata in project platform_frameworks_base by android.

the class Camera2SurfaceViewTestCase method isReprocessSupported.

protected boolean isReprocessSupported(String cameraId, int format) throws CameraAccessException {
    if (format != ImageFormat.YUV_420_888 && format != ImageFormat.PRIVATE) {
        throw new IllegalArgumentException("format " + format + " is not supported for reprocessing");
    }
    StaticMetadata info = new StaticMetadata(mCameraManager.getCameraCharacteristics(cameraId), CheckLevel.ASSERT, /*collector*/
    null);
    int cap = CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING;
    if (format == ImageFormat.PRIVATE) {
        cap = CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING;
    }
    return info.isCapabilitySupported(cap);
}
Also used : StaticMetadata(com.android.mediaframeworktest.helpers.StaticMetadata)

Example 5 with StaticMetadata

use of com.android.mediaframeworktest.helpers.StaticMetadata in project platform_frameworks_base by android.

the class Camera2SurfaceViewTestCase method openDevice.

/**
     * Open a camera device and get the StaticMetadata for a given camera id.
     *
     * @param cameraId The id of the camera device to be opened.
     */
protected void openDevice(String cameraId) throws Exception {
    mCamera = CameraTestUtils.openCamera(mCameraManager, cameraId, mCameraListener, mHandler);
    mCollector.setCameraId(cameraId);
    CameraCharacteristics properties = mCameraManager.getCameraCharacteristics(cameraId);
    mStaticInfo = new StaticMetadata(properties, CheckLevel.ASSERT, /*collector*/
    null);
    StreamConfigurationMap configMap = properties.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
    mSupportRAW10 = configMap.isOutputSupportedFor(ImageFormat.RAW10);
    if (mStaticInfo.isColorOutputSupported()) {
        mOrderedPreviewSizes = getSupportedPreviewSizes(cameraId, mCameraManager, getPreviewSizeBound(mWindowManager, PREVIEW_SIZE_BOUND));
        mOrderedVideoSizes = getSupportedVideoSizes(cameraId, mCameraManager, PREVIEW_SIZE_BOUND);
        mOrderedStillSizes = getSupportedStillSizes(cameraId, mCameraManager, null);
        if (mSupportRAW10) {
            mOrderedRAW10Sizes = getSortedSizesForFormat(cameraId, mCameraManager, ImageFormat.RAW10, null);
        }
        mOrderedYUV420888Sizes = getSortedSizesForFormat(cameraId, mCameraManager, ImageFormat.YUV_420_888, null);
        // Use ImageFormat.YUV_420_888 for now. TODO: need figure out what's format for preview
        // in public API side.
        mMinPreviewFrameDurationMap = mStaticInfo.getAvailableMinFrameDurationsForFormatChecked(ImageFormat.YUV_420_888);
    }
}
Also used : CameraCharacteristics(android.hardware.camera2.CameraCharacteristics) StreamConfigurationMap(android.hardware.camera2.params.StreamConfigurationMap) StaticMetadata(com.android.mediaframeworktest.helpers.StaticMetadata)

Aggregations

StaticMetadata (com.android.mediaframeworktest.helpers.StaticMetadata)10 CameraCharacteristics (android.hardware.camera2.CameraCharacteristics)5 StreamConfigurationMap (android.hardware.camera2.params.StreamConfigurationMap)5