Format.Builder


@UnstableApi
class Format.Builder


Builds Format instances.

Use Format#buildUpon() to obtain a builder representing an existing Format.

When building formats, populate all fields whose values are known and relevant to the type of format being constructed. See the Format Javadoc for information about which fields should be set for different types of format.

Summary

Public constructors

Creates a new instance with default values.

Public functions

Format!
Format.Builder!

Sets accessibilityChannel.

Format.Builder!

Sets auxiliaryTrackType.

Format.Builder!

Sets averageBitrate.

Format.Builder!

Sets channelCount.

Format.Builder!

Sets codecs.

Format.Builder!

Sets colorInfo.

Format.Builder!

Sets containerMimeType.

Format.Builder!

Sets cryptoType.

Format.Builder!

Sets cueReplacementBehavior.

Format.Builder!

Sets the opaque object customData.

Format.Builder!

Sets drmInitData.

Format.Builder!

Sets encoderDelay.

Format.Builder!

Sets encoderPadding.

Format.Builder!

Sets frameRate.

Format.Builder!

Sets hasPrerollSamples.

Format.Builder!

Sets height.

Format.Builder!

Sets id to Integer.toString(id).

Format.Builder!

Sets id.

Format.Builder!

Sets initializationData.

Format.Builder!

Sets label.

Format.Builder!

Sets labels.

Format.Builder!

Sets language.

Format.Builder!

Sets maxInputSize.

Format.Builder!

Sets maxNumReorderSamples.

Format.Builder!

Sets metadata.

Format.Builder!

Sets pcmEncoding.

Format.Builder!

Sets peakBitrate.

Format.Builder!

Sets pixelWidthHeightRatio.

Format.Builder!

Sets projectionData.

Format.Builder!

Sets roleFlags.

Format.Builder!

Sets rotationDegrees.

Format.Builder!

Sets sampleMimeType.

Format.Builder!

Sets sampleRate.

Format.Builder!

Sets selectionFlags.

Format.Builder!

Sets stereoMode.

Format.Builder!

Sets subsampleOffsetUs.

Format.Builder!

Sets tileCountHorizontal.

Format.Builder!

Sets tileCountVertical.

Format.Builder!

Sets width.

Public constructors

Builder

Builder()

Creates a new instance with default values.

Public functions

build

fun build(): Format!

setAccessibilityChannel

@CanIgnoreReturnValue
fun setAccessibilityChannel(accessibilityChannel: Int): Format.Builder!

Sets accessibilityChannel. The default value is NO_VALUE.

Parameters
accessibilityChannel: Int

The accessibilityChannel.

Returns
Format.Builder!

The builder.

setAuxiliaryTrackType

@CanIgnoreReturnValue
fun setAuxiliaryTrackType(@C.AuxiliaryTrackType auxiliaryTrackType: Int): Format.Builder!

Sets auxiliaryTrackType. The default value is AUXILIARY_TRACK_TYPE_UNDEFINED.

This must be set to a value other than AUXILIARY_TRACK_TYPE_UNDEFINED only when role flags contains ROLE_FLAG_AUXILIARY.

Parameters
@C.AuxiliaryTrackType auxiliaryTrackType: Int

The auxiliaryTrackType.

Returns
Format.Builder!

The builder.

setAverageBitrate

@CanIgnoreReturnValue
fun setAverageBitrate(averageBitrate: Int): Format.Builder!

Sets averageBitrate. The default value is NO_VALUE.

Parameters
averageBitrate: Int

The averageBitrate.

Returns
Format.Builder!

The builder.

setChannelCount

@CanIgnoreReturnValue
fun setChannelCount(channelCount: Int): Format.Builder!

Sets channelCount. The default value is NO_VALUE.

Parameters
channelCount: Int

The channelCount.

Returns
Format.Builder!

The builder.

setCodecs

@CanIgnoreReturnValue
fun setCodecs(codecs: String?): Format.Builder!

Sets codecs. The default value is null.

Parameters
codecs: String?

The codecs.

Returns
Format.Builder!

The builder.

setColorInfo

@CanIgnoreReturnValue
fun setColorInfo(colorInfo: ColorInfo?): Format.Builder!

Sets colorInfo. The default value is null.

Parameters
colorInfo: ColorInfo?

The colorInfo.

Returns
Format.Builder!

The builder.

setContainerMimeType

@CanIgnoreReturnValue
fun setContainerMimeType(containerMimeType: String?): Format.Builder!

Sets containerMimeType. The default value is null.

Parameters
containerMimeType: String?

The containerMimeType.

Returns
Format.Builder!

The builder.

setCryptoType

@CanIgnoreReturnValue
fun setCryptoType(@C.CryptoType cryptoType: Int): Format.Builder!

Sets cryptoType. The default value is CRYPTO_TYPE_NONE.

Parameters
@C.CryptoType cryptoType: Int

The C.CryptoType.

Returns
Format.Builder!

The builder.

setCueReplacementBehavior

@CanIgnoreReturnValue
fun setCueReplacementBehavior(
    @Format.CueReplacementBehavior cueReplacementBehavior: Int
): Format.Builder!

Sets cueReplacementBehavior. The default value is CUE_REPLACEMENT_BEHAVIOR_MERGE.

Parameters
@Format.CueReplacementBehavior cueReplacementBehavior: Int

The Format.CueReplacementBehavior.

Returns
Format.Builder!

The builder.

setCustomData

@UnstableApi
@CanIgnoreReturnValue
fun setCustomData(customData: Any?): Format.Builder!

Sets the opaque object customData. The default value is null.

This value is not included in serialized Bundle instances of this class that are used to transfer data to other processes.

Parameters
customData: Any?

The customData.

Returns
Format.Builder!

The builder.

setDrmInitData

@CanIgnoreReturnValue
fun setDrmInitData(drmInitData: DrmInitData?): Format.Builder!

Sets drmInitData. The default value is null.

Parameters
drmInitData: DrmInitData?

The drmInitData.

Returns
Format.Builder!

The builder.

setEncoderDelay

@CanIgnoreReturnValue
fun setEncoderDelay(encoderDelay: Int): Format.Builder!

Sets encoderDelay. The default value is 0.

Parameters
encoderDelay: Int

The encoderDelay.

Returns
Format.Builder!

The builder.

setEncoderPadding

@CanIgnoreReturnValue
fun setEncoderPadding(encoderPadding: Int): Format.Builder!

Sets encoderPadding. The default value is 0.

Parameters
encoderPadding: Int

The encoderPadding.

Returns
Format.Builder!

The builder.

setFrameRate

@CanIgnoreReturnValue
fun setFrameRate(frameRate: Float): Format.Builder!

Sets frameRate. The default value is NO_VALUE.

Parameters
frameRate: Float

The frameRate.

Returns
Format.Builder!

The builder.

setHasPrerollSamples

@CanIgnoreReturnValue
fun setHasPrerollSamples(hasPrerollSamples: Boolean): Format.Builder!

Sets hasPrerollSamples. The default value is false.

Parameters
hasPrerollSamples: Boolean

The hasPrerollSamples.

Returns
Format.Builder!

The builder.

setHeight

@CanIgnoreReturnValue
fun setHeight(height: Int): Format.Builder!

Sets height. The default value is NO_VALUE.

Parameters
height: Int

The height.

Returns
Format.Builder!

The builder.

setId

@CanIgnoreReturnValue
fun setId(id: Int): Format.Builder!

Sets id to Integer.toString(id). The default value is null.

Parameters
id: Int

The id.

Returns
Format.Builder!

The builder.

setId

@CanIgnoreReturnValue
fun setId(id: String?): Format.Builder!

Sets id. The default value is null.

Parameters
id: String?

The id.

Returns
Format.Builder!

The builder.

setInitializationData

@CanIgnoreReturnValue
fun setInitializationData(initializationData: (Mutable)List<ByteArray!>?): Format.Builder!

Sets initializationData. The default value is null.

Parameters
initializationData: (Mutable)List<ByteArray!>?

The initializationData.

Returns
Format.Builder!

The builder.

setLabel

@CanIgnoreReturnValue
fun setLabel(label: String?): Format.Builder!

Sets label. The default value is null.

If both this default label and a list of labels are set, this default label must be part of label list.

Parameters
label: String?

The label.

Returns
Format.Builder!

The builder.

setLabels

@CanIgnoreReturnValue
fun setLabels(labels: (Mutable)List<Label!>!): Format.Builder!

Sets labels. The default value is an empty list.

If both the default label and this list are set, the default label must be part of this list of labels.

Parameters
labels: (Mutable)List<Label!>!

The labels.

Returns
Format.Builder!

The builder.

setLanguage

@CanIgnoreReturnValue
fun setLanguage(language: String?): Format.Builder!

Sets language. The default value is null.

Parameters
language: String?

The language.

Returns
Format.Builder!

The builder.

setMaxInputSize

@CanIgnoreReturnValue
fun setMaxInputSize(maxInputSize: Int): Format.Builder!

Sets maxInputSize. The default value is NO_VALUE.

Parameters
maxInputSize: Int

The maxInputSize.

Returns
Format.Builder!

The builder.

setMaxNumReorderSamples

@CanIgnoreReturnValue
fun setMaxNumReorderSamples(maxNumReorderSamples: Int): Format.Builder!

Sets maxNumReorderSamples. The default value is NO_VALUE.

Parameters
maxNumReorderSamples: Int

maxNumReorderSamples.

Returns
Format.Builder!

The builder.

setMetadata

@CanIgnoreReturnValue
fun setMetadata(metadata: Metadata?): Format.Builder!

Sets metadata. The default value is null.

Parameters
metadata: Metadata?

The metadata.

Returns
Format.Builder!

The builder.

setPcmEncoding

@CanIgnoreReturnValue
fun setPcmEncoding(@C.PcmEncoding pcmEncoding: Int): Format.Builder!

Sets pcmEncoding. The default value is NO_VALUE.

Parameters
@C.PcmEncoding pcmEncoding: Int

The pcmEncoding.

Returns
Format.Builder!

The builder.

setPeakBitrate

@CanIgnoreReturnValue
fun setPeakBitrate(peakBitrate: Int): Format.Builder!

Sets peakBitrate. The default value is NO_VALUE.

Parameters
peakBitrate: Int

The peakBitrate.

Returns
Format.Builder!

The builder.

setPixelWidthHeightRatio

@CanIgnoreReturnValue
fun setPixelWidthHeightRatio(pixelWidthHeightRatio: Float): Format.Builder!

Sets pixelWidthHeightRatio. The default value is 1.0f.

Parameters
pixelWidthHeightRatio: Float

The pixelWidthHeightRatio.

Returns
Format.Builder!

The builder.

setProjectionData

@CanIgnoreReturnValue
fun setProjectionData(projectionData: ByteArray?): Format.Builder!

Sets projectionData. The default value is null.

Parameters
projectionData: ByteArray?

The projectionData.

Returns
Format.Builder!

The builder.

setRoleFlags

@CanIgnoreReturnValue
fun setRoleFlags(@C.RoleFlags roleFlags: Int): Format.Builder!

Sets roleFlags. The default value is 0.

When roleFlags includes ROLE_FLAG_AUXILIARY, then the specific can also be set.

Parameters
@C.RoleFlags roleFlags: Int

The roleFlags.

Returns
Format.Builder!

The builder.

setRotationDegrees

@CanIgnoreReturnValue
fun setRotationDegrees(rotationDegrees: Int): Format.Builder!

Sets rotationDegrees. The default value is 0.

Parameters
rotationDegrees: Int

The rotationDegrees.

Returns
Format.Builder!

The builder.

setSampleMimeType

@CanIgnoreReturnValue
fun setSampleMimeType(sampleMimeType: String?): Format.Builder!

Sets sampleMimeType. The default value is null.

Parameters
sampleMimeType: String?

sampleMimeType.

Returns
Format.Builder!

The builder.

setSampleRate

@CanIgnoreReturnValue
fun setSampleRate(sampleRate: Int): Format.Builder!

Sets sampleRate. The default value is NO_VALUE.

Parameters
sampleRate: Int

The sampleRate.

Returns
Format.Builder!

The builder.

setSelectionFlags

@CanIgnoreReturnValue
fun setSelectionFlags(@C.SelectionFlags selectionFlags: Int): Format.Builder!

Sets selectionFlags. The default value is 0.

Parameters
@C.SelectionFlags selectionFlags: Int

The selectionFlags.

Returns
Format.Builder!

The builder.

setStereoMode

@CanIgnoreReturnValue
fun setStereoMode(@C.StereoMode stereoMode: Int): Format.Builder!

Sets stereoMode. The default value is NO_VALUE.

Parameters
@C.StereoMode stereoMode: Int

The stereoMode.

Returns
Format.Builder!

The builder.

setSubsampleOffsetUs

@CanIgnoreReturnValue
fun setSubsampleOffsetUs(subsampleOffsetUs: Long): Format.Builder!

Sets subsampleOffsetUs. The default value is OFFSET_SAMPLE_RELATIVE.

Parameters
subsampleOffsetUs: Long

The subsampleOffsetUs.

Returns
Format.Builder!

The builder.

setTileCountHorizontal

@CanIgnoreReturnValue
fun setTileCountHorizontal(tileCountHorizontal: Int): Format.Builder!

Sets tileCountHorizontal. The default value is NO_VALUE.

Parameters
tileCountHorizontal: Int

The accessibilityChannel.

Returns
Format.Builder!

The builder.

setTileCountVertical

@CanIgnoreReturnValue
fun setTileCountVertical(tileCountVertical: Int): Format.Builder!

Sets tileCountVertical. The default value is NO_VALUE.

Parameters
tileCountVertical: Int

The accessibilityChannel.

Returns
Format.Builder!

The builder.

setWidth

@CanIgnoreReturnValue
fun setWidth(width: Int): Format.Builder!

Sets width. The default value is NO_VALUE.

Parameters
width: Int

The width.

Returns
Format.Builder!

The builder.