DefaultEncoderFactory.Builder


class DefaultEncoderFactory.Builder


A builder for DefaultEncoderFactory instances.

Summary

Public constructors

Builder(context: Context!)

Creates a new Builder.

Public functions

DefaultEncoderFactory!

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

DefaultEncoderFactory.Builder!
@CanIgnoreReturnValue
setCodecPriority(
    @C.Priority codecPriority: @IntRange(to = C.PRIORITY_MAX) Int
)

Sets the codec priority.

DefaultEncoderFactory.Builder!

Sets whether the encoder can fallback.

DefaultEncoderFactory.Builder!

Sets the requested VideoEncoderSettings.

DefaultEncoderFactory.Builder!

Sets the video EncoderSelector.

Public constructors

Builder

Builder(context: Context!)

Creates a new Builder.

Public functions

build

fun build(): DefaultEncoderFactory!

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

setCodecPriority

@CanIgnoreReturnValue
fun setCodecPriority(
    @C.Priority codecPriority: @IntRange(to = C.PRIORITY_MAX) Int
): DefaultEncoderFactory.Builder!

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 codecPriority: @IntRange(to = C.PRIORITY_MAX) Int

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

setEnableFallback

@CanIgnoreReturnValue
fun setEnableFallback(enableFallback: Boolean): DefaultEncoderFactory.Builder!

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.

setRequestedVideoEncoderSettings

@CanIgnoreReturnValue
fun setRequestedVideoEncoderSettings(
    requestedVideoEncoderSettings: VideoEncoderSettings!
): DefaultEncoderFactory.Builder!

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
fun setVideoEncoderSelector(videoEncoderSelector: EncoderSelector!): DefaultEncoderFactory.Builder!

Sets the video EncoderSelector.

The default value is DEFAULT.