public interface

CameraCaptureResult

 androidx.camera.core.impl.CameraCaptureResult

Subclasses:

CameraCaptureResult.EmptyCameraCaptureResult, Camera2CameraCaptureResult

Gradle dependencies

compile group: 'androidx.camera', name: 'camera-core', version: '1.2.0-alpha01'

  • groupId: androidx.camera
  • artifactId: camera-core
  • version: 1.2.0-alpha01

Artifact androidx.camera:camera-core:1.2.0-alpha01 it located at Google repository (https://maven.google.com/)

Overview

The result of a single image capture.

Summary

Methods
public CameraCaptureMetaData.AeStategetAeState()

Returns the current auto exposure state.

public CameraCaptureMetaData.AfModegetAfMode()

Returns the current auto focus mode of operation.

public CameraCaptureMetaData.AfStategetAfState()

Returns the current auto focus state.

public CameraCaptureMetaData.AwbStategetAwbState()

Returns the current auto white balance state.

public CaptureResultgetCaptureResult()

Returns the CaptureResult for reprocessable capture request.

public CameraCaptureMetaData.FlashStategetFlashState()

Returns the current flash state.

public TagBundlegetTagBundle()

Returns the TagBundle object associated with the capture request.

public longgetTimestamp()

Returns the timestamp in nanoseconds.

public voidpopulateExifData(ExifData.Builder exifBuilder)

Populates the given Exif.Builder with attributes from this CameraCaptureResult.

Methods

public CameraCaptureMetaData.AfMode getAfMode()

Returns the current auto focus mode of operation.

public CameraCaptureMetaData.AfState getAfState()

Returns the current auto focus state.

public CameraCaptureMetaData.AeState getAeState()

Returns the current auto exposure state.

public CameraCaptureMetaData.AwbState getAwbState()

Returns the current auto white balance state.

public CameraCaptureMetaData.FlashState getFlashState()

Returns the current flash state.

public long getTimestamp()

Returns the timestamp in nanoseconds.

If the timestamp was unavailable then it will return -1L.

public TagBundle getTagBundle()

Returns the TagBundle object associated with the capture request.

public void populateExifData(ExifData.Builder exifBuilder)

Populates the given Exif.Builder with attributes from this CameraCaptureResult.

public CaptureResult getCaptureResult()

Returns the CaptureResult for reprocessable capture request.

Returns:

The CaptureResult.

See also: CameraDevice

Source

/*
 * Copyright 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.camera.core.impl;

import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CaptureResult;
import android.hardware.camera2.TotalCaptureResult;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.camera.core.impl.CameraCaptureMetaData.AeState;
import androidx.camera.core.impl.CameraCaptureMetaData.AfMode;
import androidx.camera.core.impl.CameraCaptureMetaData.AfState;
import androidx.camera.core.impl.CameraCaptureMetaData.AwbState;
import androidx.camera.core.impl.CameraCaptureMetaData.FlashState;
import androidx.camera.core.impl.utils.ExifData;

/**
 * The result of a single image capture.
 *
 */
@RequiresApi(21) // TODO(b/200306659): Remove and replace with annotation on package-info.java
public interface CameraCaptureResult {

    /** Returns the current auto focus mode of operation. */
    @NonNull
    AfMode getAfMode();

    /** Returns the current auto focus state. */
    @NonNull
    AfState getAfState();

    /** Returns the current auto exposure state. */
    @NonNull
    AeState getAeState();

    /** Returns the current auto white balance state.*/
    @NonNull
    AwbState getAwbState();

    /** Returns the current flash state. */
    @NonNull
    FlashState getFlashState();

    /**
     * Returns the timestamp in nanoseconds.
     *
     * <p> If the timestamp was unavailable then it will return {@code -1L}.
     */
    long getTimestamp();

    /** Returns the TagBundle object associated with the capture request. */
    @NonNull
    TagBundle getTagBundle();

    /** Populates the given Exif.Builder with attributes from this CameraCaptureResult. */
    default void populateExifData(@NonNull ExifData.Builder exifBuilder) {
        exifBuilder.setFlashState(getFlashState());
    }

    /**
     * Returns the {@link CaptureResult} for reprocessable capture request.
     * @return The {@link CaptureResult}.
     *
     * @see CameraDevice#createReprocessCaptureRequest(TotalCaptureResult)
     */
    @NonNull
    default CaptureResult getCaptureResult() {
        return CameraCaptureResult.EmptyCameraCaptureResult.create().getCaptureResult();
    }

    /** An implementation of CameraCaptureResult which always return default results. */
    final class EmptyCameraCaptureResult implements CameraCaptureResult {

        @NonNull
        public static CameraCaptureResult create() {
            return new EmptyCameraCaptureResult();
        }

        @NonNull
        @Override
        public AfMode getAfMode() {
            return AfMode.UNKNOWN;
        }

        @NonNull
        @Override
        public AfState getAfState() {
            return AfState.UNKNOWN;
        }

        @NonNull
        @Override
        public AeState getAeState() {
            return AeState.UNKNOWN;
        }

        @NonNull
        @Override
        public AwbState getAwbState() {
            return AwbState.UNKNOWN;
        }

        @NonNull
        @Override
        public FlashState getFlashState() {
            return FlashState.UNKNOWN;
        }

        @Override
        public long getTimestamp() {
            return -1L;
        }

        @Override
        @NonNull
        public TagBundle getTagBundle() {
            return TagBundle.emptyBundle();
        }
    }
}