Format.Builder


@UnstableApi
public final 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 methods

Format
Format.Builder

Sets accessibilityChannel.

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 drmInitData.

Format.Builder

Sets encoderDelay.

Format.Builder

Sets encoderPadding.

Format.Builder

Sets frameRate.

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 metadata.

Format.Builder

Sets pcmEncoding.

Format.Builder

Sets peakBitrate.

Format.Builder
@CanIgnoreReturnValue
setPixelWidthHeightRatio(float pixelWidthHeightRatio)

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

public Builder()

Creates a new instance with default values.

Public methods

build

public Format build()

setAccessibilityChannel

@CanIgnoreReturnValue
public Format.Builder setAccessibilityChannel(int accessibilityChannel)

Sets accessibilityChannel. The default value is NO_VALUE.

Parameters
int accessibilityChannel

The accessibilityChannel.

Returns
Format.Builder

The builder.

setAverageBitrate

@CanIgnoreReturnValue
public Format.Builder setAverageBitrate(int averageBitrate)

Sets averageBitrate. The default value is NO_VALUE.

Parameters
int averageBitrate

The averageBitrate.

Returns
Format.Builder

The builder.

setChannelCount

@CanIgnoreReturnValue
public Format.Builder setChannelCount(int channelCount)

Sets channelCount. The default value is NO_VALUE.

Parameters
int channelCount

The channelCount.

Returns
Format.Builder

The builder.

setCodecs

@CanIgnoreReturnValue
public Format.Builder setCodecs(@Nullable String codecs)

Sets codecs. The default value is null.

Parameters
@Nullable String codecs

The codecs.

Returns
Format.Builder

The builder.

setColorInfo

@CanIgnoreReturnValue
public Format.Builder setColorInfo(@Nullable ColorInfo colorInfo)

Sets colorInfo. The default value is null.

Parameters
@Nullable ColorInfo colorInfo

The colorInfo.

Returns
Format.Builder

The builder.

setContainerMimeType

@CanIgnoreReturnValue
public Format.Builder setContainerMimeType(@Nullable String containerMimeType)

Sets containerMimeType. The default value is null.

Parameters
@Nullable String containerMimeType

The containerMimeType.

Returns
Format.Builder

The builder.

setCryptoType

@CanIgnoreReturnValue
public Format.Builder setCryptoType(@C.CryptoType int cryptoType)

Sets cryptoType. The default value is CRYPTO_TYPE_NONE.

Parameters
@C.CryptoType int cryptoType

The C.CryptoType.

Returns
Format.Builder

The builder.

setCueReplacementBehavior

@CanIgnoreReturnValue
public Format.Builder setCueReplacementBehavior(
    @Format.CueReplacementBehavior int cueReplacementBehavior
)

Sets cueReplacementBehavior. The default value is CUE_REPLACEMENT_BEHAVIOR_MERGE.

Parameters
@Format.CueReplacementBehavior int cueReplacementBehavior

The Format.CueReplacementBehavior.

Returns
Format.Builder

The builder.

setDrmInitData

@CanIgnoreReturnValue
public Format.Builder setDrmInitData(@Nullable DrmInitData drmInitData)

Sets drmInitData. The default value is null.

Parameters
@Nullable DrmInitData drmInitData

The drmInitData.

Returns
Format.Builder

The builder.

setEncoderDelay

@CanIgnoreReturnValue
public Format.Builder setEncoderDelay(int encoderDelay)

Sets encoderDelay. The default value is 0.

Parameters
int encoderDelay

The encoderDelay.

Returns
Format.Builder

The builder.

setEncoderPadding

@CanIgnoreReturnValue
public Format.Builder setEncoderPadding(int encoderPadding)

Sets encoderPadding. The default value is 0.

Parameters
int encoderPadding

The encoderPadding.

Returns
Format.Builder

The builder.

setFrameRate

@CanIgnoreReturnValue
public Format.Builder setFrameRate(float frameRate)

Sets frameRate. The default value is NO_VALUE.

Parameters
float frameRate

The frameRate.

Returns
Format.Builder

The builder.

setHeight

@CanIgnoreReturnValue
public Format.Builder setHeight(int height)

Sets height. The default value is NO_VALUE.

Parameters
int height

The height.

Returns
Format.Builder

The builder.

setId

@CanIgnoreReturnValue
public Format.Builder setId(int id)

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

Parameters
int id

The id.

Returns
Format.Builder

The builder.

setId

@CanIgnoreReturnValue
public Format.Builder setId(@Nullable String id)

Sets id. The default value is null.

Parameters
@Nullable String id

The id.

Returns
Format.Builder

The builder.

setInitializationData

@CanIgnoreReturnValue
public Format.Builder setInitializationData(@Nullable List<byte[]> initializationData)

Sets initializationData. The default value is null.

Parameters
@Nullable List<byte[]> initializationData

The initializationData.

Returns
Format.Builder

The builder.

setLabel

@CanIgnoreReturnValue
public Format.Builder setLabel(@Nullable String label)

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
@Nullable String label

The label.

Returns
Format.Builder

The builder.

setLabels

@CanIgnoreReturnValue
public Format.Builder setLabels(List<Label> labels)

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
List<Label> labels

The labels.

Returns
Format.Builder

The builder.

setLanguage

@CanIgnoreReturnValue
public Format.Builder setLanguage(@Nullable String language)

Sets language. The default value is null.

Parameters
@Nullable String language

The language.

Returns
Format.Builder

The builder.

setMaxInputSize

@CanIgnoreReturnValue
public Format.Builder setMaxInputSize(int maxInputSize)

Sets maxInputSize. The default value is NO_VALUE.

Parameters
int maxInputSize

The maxInputSize.

Returns
Format.Builder

The builder.

setMetadata

@CanIgnoreReturnValue
public Format.Builder setMetadata(@Nullable Metadata metadata)

Sets metadata. The default value is null.

Parameters
@Nullable Metadata metadata

The metadata.

Returns
Format.Builder

The builder.

setPcmEncoding

@CanIgnoreReturnValue
public Format.Builder setPcmEncoding(@C.PcmEncoding int pcmEncoding)

Sets pcmEncoding. The default value is NO_VALUE.

Parameters
@C.PcmEncoding int pcmEncoding

The pcmEncoding.

Returns
Format.Builder

The builder.

setPeakBitrate

@CanIgnoreReturnValue
public Format.Builder setPeakBitrate(int peakBitrate)

Sets peakBitrate. The default value is NO_VALUE.

Parameters
int peakBitrate

The peakBitrate.

Returns
Format.Builder

The builder.

setPixelWidthHeightRatio

@CanIgnoreReturnValue
public Format.Builder setPixelWidthHeightRatio(float pixelWidthHeightRatio)

Sets pixelWidthHeightRatio. The default value is 1.0f.

Parameters
float pixelWidthHeightRatio

The pixelWidthHeightRatio.

Returns
Format.Builder

The builder.

setProjectionData

@CanIgnoreReturnValue
public Format.Builder setProjectionData(@Nullable byte[] projectionData)

Sets projectionData. The default value is null.

Parameters
@Nullable byte[] projectionData

The projectionData.

Returns
Format.Builder

The builder.

setRoleFlags

@CanIgnoreReturnValue
public Format.Builder setRoleFlags(@C.RoleFlags int roleFlags)

Sets roleFlags. The default value is 0.

Parameters
@C.RoleFlags int roleFlags

The roleFlags.

Returns
Format.Builder

The builder.

setRotationDegrees

@CanIgnoreReturnValue
public Format.Builder setRotationDegrees(int rotationDegrees)

Sets rotationDegrees. The default value is 0.

Parameters
int rotationDegrees

The rotationDegrees.

Returns
Format.Builder

The builder.

setSampleMimeType

@CanIgnoreReturnValue
public Format.Builder setSampleMimeType(@Nullable String sampleMimeType)

Sets sampleMimeType. The default value is null.

Parameters
@Nullable String sampleMimeType

sampleMimeType.

Returns
Format.Builder

The builder.

setSampleRate

@CanIgnoreReturnValue
public Format.Builder setSampleRate(int sampleRate)

Sets sampleRate. The default value is NO_VALUE.

Parameters
int sampleRate

The sampleRate.

Returns
Format.Builder

The builder.

setSelectionFlags

@CanIgnoreReturnValue
public Format.Builder setSelectionFlags(@C.SelectionFlags int selectionFlags)

Sets selectionFlags. The default value is 0.

Parameters
@C.SelectionFlags int selectionFlags

The selectionFlags.

Returns
Format.Builder

The builder.

setStereoMode

@CanIgnoreReturnValue
public Format.Builder setStereoMode(@C.StereoMode int stereoMode)

Sets stereoMode. The default value is NO_VALUE.

Parameters
@C.StereoMode int stereoMode

The stereoMode.

Returns
Format.Builder

The builder.

setSubsampleOffsetUs

@CanIgnoreReturnValue
public Format.Builder setSubsampleOffsetUs(long subsampleOffsetUs)

Sets subsampleOffsetUs. The default value is OFFSET_SAMPLE_RELATIVE.

Parameters
long subsampleOffsetUs

The subsampleOffsetUs.

Returns
Format.Builder

The builder.

setTileCountHorizontal

@CanIgnoreReturnValue
public Format.Builder setTileCountHorizontal(int tileCountHorizontal)

Sets tileCountHorizontal. The default value is NO_VALUE.

Parameters
int tileCountHorizontal

The accessibilityChannel.

Returns
Format.Builder

The builder.

setTileCountVertical

@CanIgnoreReturnValue
public Format.Builder setTileCountVertical(int tileCountVertical)

Sets tileCountVertical. The default value is NO_VALUE.

Parameters
int tileCountVertical

The accessibilityChannel.

Returns
Format.Builder

The builder.

setWidth

@CanIgnoreReturnValue
public Format.Builder setWidth(int width)

Sets width. The default value is NO_VALUE.

Parameters
int width

The width.

Returns
Format.Builder

The builder.