public final class

VideoCaptureConfig

extends java.lang.Object

implements UseCaseConfig<VideoCapture>, ImageOutputConfig, ThreadConfig

 java.lang.Object

↳androidx.camera.core.impl.VideoCaptureConfig

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

Config for a video capture use case.

In the earlier stage, the VideoCapture is deprioritized.

Summary

Fields
public static final Config.Option<java.lang.Integer>OPTION_AUDIO_BIT_RATE

public static final Config.Option<java.lang.Integer>OPTION_AUDIO_CHANNEL_COUNT

public static final Config.Option<java.lang.Integer>OPTION_AUDIO_MIN_BUFFER_SIZE

public static final Config.Option<java.lang.Integer>OPTION_AUDIO_SAMPLE_RATE

public static final Config.Option<java.lang.Integer>OPTION_BIT_RATE

public static final Config.Option<java.lang.Integer>OPTION_INTRA_FRAME_INTERVAL

public static final Config.Option<java.lang.Integer>OPTION_VIDEO_FRAME_RATE

Constructors
publicVideoCaptureConfig(OptionsBundle config)

Methods
public intgetAudioBitRate()

Returns the audio encoding bit rate.

public intgetAudioBitRate(int valueIfMissing)

Returns the audio encoding bit rate.

public intgetAudioChannelCount()

Returns the audio channel count.

public intgetAudioChannelCount(int valueIfMissing)

Returns the audio channel count.

public intgetAudioMinBufferSize()

Returns the audio minimum buffer size, in bytes.

public intgetAudioMinBufferSize(int valueIfMissing)

Returns the audio minimum buffer size, in bytes.

public intgetAudioSampleRate()

Returns the audio sample rate.

public intgetAudioSampleRate(int valueIfMissing)

Returns the audio sample rate.

public intgetBitRate()

Returns the encoding bit rate.

public intgetBitRate(int valueIfMissing)

Returns the encoding bit rate.

public ConfiggetConfig()

public intgetIFrameInterval()

Returns the number of seconds between each key frame.

public intgetIFrameInterval(int valueIfMissing)

Returns the number of seconds between each key frame.

public intgetInputFormat()

Retrieves the format of the image that is fed as input.

public intgetVideoFrameRate()

Returns the recording frames per second.

public intgetVideoFrameRate(int valueIfMissing)

Returns the recording frames per second.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

public static final Config.Option<java.lang.Integer> OPTION_VIDEO_FRAME_RATE

public static final Config.Option<java.lang.Integer> OPTION_BIT_RATE

public static final Config.Option<java.lang.Integer> OPTION_INTRA_FRAME_INTERVAL

public static final Config.Option<java.lang.Integer> OPTION_AUDIO_BIT_RATE

public static final Config.Option<java.lang.Integer> OPTION_AUDIO_SAMPLE_RATE

public static final Config.Option<java.lang.Integer> OPTION_AUDIO_CHANNEL_COUNT

public static final Config.Option<java.lang.Integer> OPTION_AUDIO_MIN_BUFFER_SIZE

Constructors

public VideoCaptureConfig(OptionsBundle config)

Methods

public int getVideoFrameRate(int valueIfMissing)

Returns the recording frames per second.

Parameters:

valueIfMissing: The value to return if this configuration option has not been set.

Returns:

The stored value or valueIfMissing if the value does not exist in this configuration.

public int getVideoFrameRate()

Returns the recording frames per second.

Returns:

The stored value, if it exists in this configuration.

public int getBitRate(int valueIfMissing)

Returns the encoding bit rate.

Parameters:

valueIfMissing: The value to return if this configuration option has not been set.

Returns:

The stored value or valueIfMissing if the value does not exist in this configuration.

public int getBitRate()

Returns the encoding bit rate.

Returns:

The stored value, if it exists in this configuration.

public int getIFrameInterval(int valueIfMissing)

Returns the number of seconds between each key frame.

Parameters:

valueIfMissing: The value to return if this configuration option has not been set.

Returns:

The stored value or valueIfMissing if the value does not exist in this configuration.

public int getIFrameInterval()

Returns the number of seconds between each key frame.

Returns:

The stored value, if it exists in this configuration.

public int getAudioBitRate(int valueIfMissing)

Returns the audio encoding bit rate.

Parameters:

valueIfMissing: The value to return if this configuration option has not been set.

Returns:

The stored value or valueIfMissing if the value does not exist in this configuration.

public int getAudioBitRate()

Returns the audio encoding bit rate.

Returns:

The stored value, if it exists in this configuration.

public int getAudioSampleRate(int valueIfMissing)

Returns the audio sample rate.

Parameters:

valueIfMissing: The value to return if this configuration option has not been set.

Returns:

The stored value or valueIfMissing if the value does not exist in this configuration.

public int getAudioSampleRate()

Returns the audio sample rate.

Returns:

The stored value, if it exists in this configuration.

public int getAudioChannelCount(int valueIfMissing)

Returns the audio channel count.

Parameters:

valueIfMissing: The value to return if this configuration option has not been set.

Returns:

The stored value or valueIfMissing if the value does not exist in this configuration.

public int getAudioChannelCount()

Returns the audio channel count.

Returns:

The stored value, if it exists in this configuration.

public int getAudioMinBufferSize(int valueIfMissing)

Returns the audio minimum buffer size, in bytes.

Parameters:

valueIfMissing: The value to return if this configuration option has not been set.

Returns:

The stored value or valueIfMissing if the value does not exist in this configuration.

public int getAudioMinBufferSize()

Returns the audio minimum buffer size, in bytes.

Returns:

The stored value, if it exists in this configuration.

public int getInputFormat()

Retrieves the format of the image that is fed as input.

This should always be PRIVATE for VideoCapture.

public Config getConfig()

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 androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.camera.core.VideoCapture;
import androidx.camera.core.internal.ThreadConfig;

/**
 * Config for a video capture use case.
 *
 * <p>In the earlier stage, the VideoCapture is deprioritized.
 */
@RequiresApi(21) // TODO(b/200306659): Remove and replace with annotation on package-info.java
public final class VideoCaptureConfig
        implements UseCaseConfig<VideoCapture>,
        ImageOutputConfig,
        ThreadConfig {

    // Option Declarations:
    // *********************************************************************************************

    public static final Option<Integer> OPTION_VIDEO_FRAME_RATE =
            Option.create("camerax.core.videoCapture.recordingFrameRate", int.class);
    public static final Option<Integer> OPTION_BIT_RATE =
            Option.create("camerax.core.videoCapture.bitRate", int.class);
    public static final Option<Integer> OPTION_INTRA_FRAME_INTERVAL =
            Option.create("camerax.core.videoCapture.intraFrameInterval", int.class);
    public static final Option<Integer> OPTION_AUDIO_BIT_RATE =
            Option.create("camerax.core.videoCapture.audioBitRate", int.class);
    public static final Option<Integer> OPTION_AUDIO_SAMPLE_RATE =
            Option.create("camerax.core.videoCapture.audioSampleRate", int.class);
    public static final Option<Integer> OPTION_AUDIO_CHANNEL_COUNT =
            Option.create("camerax.core.videoCapture.audioChannelCount", int.class);
    public static final Option<Integer> OPTION_AUDIO_MIN_BUFFER_SIZE =
            Option.create("camerax.core.videoCapture.audioMinBufferSize", int.class);

    // *********************************************************************************************

    private final OptionsBundle mConfig;

    public VideoCaptureConfig(@NonNull OptionsBundle config) {
        mConfig = config;
    }

    /**
     * Returns the recording frames per second.
     *
     * @param valueIfMissing The value to return if this configuration option has not been set.
     * @return The stored value or <code>valueIfMissing</code> if the value does not exist in this
     * configuration.
     */
    public int getVideoFrameRate(int valueIfMissing) {
        return retrieveOption(OPTION_VIDEO_FRAME_RATE, valueIfMissing);
    }

    /**
     * Returns the recording frames per second.
     *
     * @return The stored value, if it exists in this configuration.
     * @throws IllegalArgumentException if the option does not exist in this configuration.
     */
    public int getVideoFrameRate() {
        return retrieveOption(OPTION_VIDEO_FRAME_RATE);
    }

    /**
     * Returns the encoding bit rate.
     *
     * @param valueIfMissing The value to return if this configuration option has not been set.
     * @return The stored value or <code>valueIfMissing</code> if the value does not exist in this
     * configuration.
     */
    public int getBitRate(int valueIfMissing) {
        return retrieveOption(OPTION_BIT_RATE, valueIfMissing);
    }

    /**
     * Returns the encoding bit rate.
     *
     * @return The stored value, if it exists in this configuration.
     * @throws IllegalArgumentException if the option does not exist in this configuration.
     */
    public int getBitRate() {
        return retrieveOption(OPTION_BIT_RATE);
    }

    /**
     * Returns the number of seconds between each key frame.
     *
     * @param valueIfMissing The value to return if this configuration option has not been set.
     * @return The stored value or <code>valueIfMissing</code> if the value does not exist in this
     * configuration.
     */
    public int getIFrameInterval(int valueIfMissing) {
        return retrieveOption(OPTION_INTRA_FRAME_INTERVAL, valueIfMissing);
    }

    /**
     * Returns the number of seconds between each key frame.
     *
     * @return The stored value, if it exists in this configuration.
     * @throws IllegalArgumentException if the option does not exist in this configuration.
     */
    public int getIFrameInterval() {
        return retrieveOption(OPTION_INTRA_FRAME_INTERVAL);
    }

    /**
     * Returns the audio encoding bit rate.
     *
     * @param valueIfMissing The value to return if this configuration option has not been set.
     * @return The stored value or <code>valueIfMissing</code> if the value does not exist in this
     * configuration.
     */
    public int getAudioBitRate(int valueIfMissing) {
        return retrieveOption(OPTION_AUDIO_BIT_RATE, valueIfMissing);
    }

    /**
     * Returns the audio encoding bit rate.
     *
     * @return The stored value, if it exists in this configuration.
     * @throws IllegalArgumentException if the option does not exist in this configuration.
     */
    public int getAudioBitRate() {
        return retrieveOption(OPTION_AUDIO_BIT_RATE);
    }

    /**
     * Returns the audio sample rate.
     *
     * @param valueIfMissing The value to return if this configuration option has not been set.
     * @return The stored value or <code>valueIfMissing</code> if the value does not exist in this
     * configuration.
     */
    public int getAudioSampleRate(int valueIfMissing) {
        return retrieveOption(OPTION_AUDIO_SAMPLE_RATE, valueIfMissing);
    }

    /**
     * Returns the audio sample rate.
     *
     * @return The stored value, if it exists in this configuration.
     * @throws IllegalArgumentException if the option does not exist in this configuration.
     */
    public int getAudioSampleRate() {
        return retrieveOption(OPTION_AUDIO_SAMPLE_RATE);
    }

    /**
     * Returns the audio channel count.
     *
     * @param valueIfMissing The value to return if this configuration option has not been set.
     * @return The stored value or <code>valueIfMissing</code> if the value does not exist in this
     * configuration.
     */
    public int getAudioChannelCount(int valueIfMissing) {
        return retrieveOption(OPTION_AUDIO_CHANNEL_COUNT, valueIfMissing);
    }

    /**
     * Returns the audio channel count.
     *
     * @return The stored value, if it exists in this configuration.
     * @throws IllegalArgumentException if the option does not exist in this configuration.
     */
    public int getAudioChannelCount() {
        return retrieveOption(OPTION_AUDIO_CHANNEL_COUNT);
    }

    /**
     * Returns the audio minimum buffer size, in bytes.
     *
     * @param valueIfMissing The value to return if this configuration option has not been set.
     * @return The stored value or <code>valueIfMissing</code> if the value does not exist in this
     * configuration.
     */
    public int getAudioMinBufferSize(int valueIfMissing) {
        return retrieveOption(OPTION_AUDIO_MIN_BUFFER_SIZE, valueIfMissing);
    }

    /**
     * Returns the audio minimum buffer size, in bytes.
     *
     * @return The stored value, if it exists in this configuration.
     * @throws IllegalArgumentException if the option does not exist in this configuration.
     */
    public int getAudioMinBufferSize() {
        return retrieveOption(OPTION_AUDIO_MIN_BUFFER_SIZE);
    }

    /**
     * Retrieves the format of the image that is fed as input.
     *
     * <p>This should always be PRIVATE for VideoCapture.
     */
    @Override
    public int getInputFormat() {
        return ImageFormatConstants.INTERNAL_DEFINED_IMAGE_FORMAT_PRIVATE;
    }

    @NonNull
    @Override
    public Config getConfig() {
        return mConfig;
    }
}