public interface

VideoEncoderInfo

implements EncoderInfo

 androidx.camera.video.internal.encoder.VideoEncoderInfo

Subclasses:

VideoEncoderInfoWrapper, SwappedVideoEncoderInfo, VideoEncoderInfoImpl

Gradle dependencies

compile group: 'androidx.camera', name: 'camera-video', version: '1.5.0-alpha01'

  • groupId: androidx.camera
  • artifactId: camera-video
  • version: 1.5.0-alpha01

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

Overview

VideoEncoderInfo provides video encoder related information and capabilities.

Summary

Methods
public booleancanSwapWidthHeight()

Return if the supported width height can be swapped.

public intgetHeightAlignment()

Returns the alignment requirement for video height (in pixels).

public <any>getSupportedBitrateRange()

Returns the video encoder's bitrate range.

public <any>getSupportedHeights()

Returns the range of supported video heights.

public <any>getSupportedHeightsFor(int width)

Returns the range of supported video heights for a video width.

public <any>getSupportedWidths()

Returns the range of supported video widths.

public <any>getSupportedWidthsFor(int height)

Returns the range of supported video widths for a video height.

public intgetWidthAlignment()

Returns the alignment requirement for video width (in pixels).

public booleanisSizeSupported(int width, int height)

Returns if the size is supported.

public booleanisSizeSupportedAllowSwapping(int width, int height)

Returns if the size is supported when the width height is allowed swapping.

Methods

public boolean canSwapWidthHeight()

Return if the supported width height can be swapped.

public boolean isSizeSupported(int width, int height)

Returns if the size is supported.

public boolean isSizeSupportedAllowSwapping(int width, int height)

Returns if the size is supported when the width height is allowed swapping.

This is basically equivalent to

 isSizeSupport(width, height)
         || (canSwapWidthHeight() && isSizeSupported(height, width))
 

public <any> getSupportedWidths()

Returns the range of supported video widths.

public <any> getSupportedHeights()

Returns the range of supported video heights.

public <any> getSupportedWidthsFor(int height)

Returns the range of supported video widths for a video height.

See also: VideoEncoderInfo.getSupportedHeights(), VideoEncoderInfo.getHeightAlignment()

public <any> getSupportedHeightsFor(int width)

Returns the range of supported video heights for a video width.

See also: VideoEncoderInfo.getSupportedWidths(), VideoEncoderInfo.getWidthAlignment()

public int getWidthAlignment()

Returns the alignment requirement for video width (in pixels).

This is usually a power-of-2 value that video width must be a multiple of.

public int getHeightAlignment()

Returns the alignment requirement for video height (in pixels).

This is usually a power-of-2 value that video height must be a multiple of.

public <any> getSupportedBitrateRange()

Returns the video encoder's bitrate range.

Source

/*
 * Copyright 2022 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.video.internal.encoder;

import android.util.Range;

import androidx.annotation.NonNull;

/**
 * VideoEncoderInfo provides video encoder related information and capabilities.
 */
public interface VideoEncoderInfo extends EncoderInfo {
    /** Return if the supported width height can be swapped. */
    boolean canSwapWidthHeight();

    /** Returns if the size is supported. */
    boolean isSizeSupported(int width, int height);

    /**
     * Returns if the size is supported when the width height is allowed swapping.
     *
     * <p>This is basically equivalent to
     * <pre>{@code
     * isSizeSupport(width, height)
     *         || (canSwapWidthHeight() && isSizeSupported(height, width))
     * }</pre>
     */
    default boolean isSizeSupportedAllowSwapping(int width, int height) {
        //noinspection SuspiciousNameCombination
        return isSizeSupported(width, height)
                || (canSwapWidthHeight() && isSizeSupported(height, width));
    }

    /** Returns the range of supported video widths. */
    @NonNull
    Range<Integer> getSupportedWidths();

    /** Returns the range of supported video heights. */
    @NonNull
    Range<Integer> getSupportedHeights();

    /**
     * Returns the range of supported video widths for a video height.
     *
     * @throws IllegalArgumentException if height is not supported.
     * @see #getSupportedHeights()
     * @see #getHeightAlignment()
     */
    @NonNull
    Range<Integer> getSupportedWidthsFor(int height);

    /**
     * Returns the range of supported video heights for a video width.
     *
     * @throws IllegalArgumentException if width is not supported.
     * @see #getSupportedWidths()
     * @see #getWidthAlignment()
     */
    @NonNull
    Range<Integer> getSupportedHeightsFor(int width);

    /**
     * Returns the alignment requirement for video width (in pixels).
     *
     * <p>This is usually a power-of-2 value that video width must be a multiple of.
     */
    int getWidthAlignment();

    /**
     * Returns the alignment requirement for video height (in pixels).
     *
     * <p>This is usually a power-of-2 value that video height must be a multiple of.
     */
    int getHeightAlignment();

    /**
     * Returns the video encoder's bitrate range.
     */
    @NonNull
    Range<Integer> getSupportedBitrateRange();
}