DefaultEncoderFactory.Builder


public final class DefaultEncoderFactory.Builder


A builder for DefaultEncoderFactory instances.

Summary

Public constructors

Builder(Context context)

Creates a new Builder.

Public methods

DefaultEncoderFactory

Creates an instance of DefaultEncoderFactory, using defaults if values are unset.

DefaultEncoderFactory.Builder
@CanIgnoreReturnValue
setCodecPriority(
    @C.Priority @IntRange(to = C.PRIORITY_MAX) int codecPriority
)

Sets the codec priority.

DefaultEncoderFactory.Builder
@CanIgnoreReturnValue
setEnableFallback(boolean enableFallback)

Sets whether the encoder can fallback.

DefaultEncoderFactory.Builder

Sets the requested AudioEncoderSettings.

DefaultEncoderFactory.Builder

Sets the requested VideoEncoderSettings.

DefaultEncoderFactory.Builder

Sets the video EncoderSelector.

Public constructors

Builder

public Builder(Context context)

Creates a new Builder.

Public methods

build

public DefaultEncoderFactory build()

Creates an instance of DefaultEncoderFactory, using defaults if values are unset.

setCodecPriority

@CanIgnoreReturnValue
public DefaultEncoderFactory.Builder setCodecPriority(
    @C.Priority @IntRange(to = C.PRIORITY_MAX) int codecPriority
)

Sets the codec priority.

Specifying codec priority allows the resource manager in the platform to reclaim less important codecs before more important codecs.

It is recommended to use predefined priorities like PRIORITY_PROCESSING_FOREGROUND, PRIORITY_PROCESSING_BACKGROUND or priority values defined relative to those defaults.

This method is a no-op on API versions before 35.

The default value is PRIORITY_PROCESSING_FOREGROUND.

Parameters
@C.Priority @IntRange(to = C.PRIORITY_MAX) int codecPriority

The C.Priority for the codec. Should be at most PRIORITY_MAX.

setEnableFallback

@CanIgnoreReturnValue
public DefaultEncoderFactory.Builder setEnableFallback(boolean enableFallback)

Sets whether the encoder can fallback.

With format fallback enabled, when the requested Format is not supported, DefaultEncoderFactory finds a format that is supported by the device and configures the Codec with it. The fallback process may change the requested MIME type, resolution, bitrate, profile/level etc.

The default value is true.

setRequestedAudioEncoderSettings

@CanIgnoreReturnValue
public DefaultEncoderFactory.Builder setRequestedAudioEncoderSettings(
    AudioEncoderSettings requestedAudioEncoderSettings
)

Sets the requested AudioEncoderSettings.

The default value is DEFAULT.

Values in requestedAudioEncoderSettings may be ignored to reduce failures.

setRequestedVideoEncoderSettings

@CanIgnoreReturnValue
public DefaultEncoderFactory.Builder setRequestedVideoEncoderSettings(
    VideoEncoderSettings requestedVideoEncoderSettings
)

Sets the requested VideoEncoderSettings.

Values in requestedVideoEncoderSettings may be ignored to improve encoding quality and/or reduce failures.

profile and level are ignored for VIDEO_H264. Consider implementing Codec.EncoderFactory if such adjustments are unwanted.

requestedVideoEncoderSettings should be handled with care because there is no fallback support for it. For example, using incompatible profile and level can cause codec configuration failure. Setting an unsupported bitrateMode may cause encoder instantiation failure.

The default value is DEFAULT.

setVideoEncoderSelector

@CanIgnoreReturnValue
public DefaultEncoderFactory.Builder setVideoEncoderSelector(EncoderSelector videoEncoderSelector)

Sets the video EncoderSelector.

The default value is DEFAULT.