Back to Exoplayer

Format.Builder (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/Format.Builder.html

latest20.1 KB
Original Source

Package com.google.android.exoplayer2

Class Format.Builder


public static final classFormat.Builderextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

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.

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | Builder() | Creates a new instance with default values. |

Method Summary

All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description | | --- | --- | --- | | Format | build() | | | Format.Builder | setAccessibilityChannel​(int accessibilityChannel) | Sets Format.accessibilityChannel. | | Format.Builder | setAverageBitrate​(int averageBitrate) | Sets Format.averageBitrate. | | Format.Builder | setChannelCount​(int channelCount) | Sets Format.channelCount. | | Format.Builder | setCodecs​(String codecs) | Sets Format.codecs. | | Format.Builder | setColorInfo​(ColorInfo colorInfo) | Sets Format.colorInfo. | | Format.Builder | setContainerMimeType​(String containerMimeType) | Sets Format.containerMimeType. | | Format.Builder | setCryptoType​(@com.google.android.exoplayer2.C.CryptoType int cryptoType) | Sets Format.cryptoType. | | Format.Builder | setDrmInitData​(DrmInitData drmInitData) | Sets Format.drmInitData. | | Format.Builder | setEncoderDelay​(int encoderDelay) | Sets Format.encoderDelay. | | Format.Builder | setEncoderPadding​(int encoderPadding) | Sets Format.encoderPadding. | | Format.Builder | setFrameRate​(float frameRate) | Sets Format.frameRate. | | Format.Builder | setHeight​(int height) | Sets Format.height. | | Format.Builder | setId​(int id) | Sets Format.id to Integer.toString(id). | | Format.Builder | setId​(String id) | Sets Format.id. | | Format.Builder | setInitializationData​(List<byte[]> initializationData) | Sets Format.initializationData. | | Format.Builder | setLabel​(String label) | Sets Format.label. | | Format.Builder | setLanguage​(String language) | Sets Format.language. | | Format.Builder | setMaxInputSize​(int maxInputSize) | Sets Format.maxInputSize. | | Format.Builder | setMetadata​(Metadata metadata) | Sets Format.metadata. | | Format.Builder | setPcmEncoding​(@com.google.android.exoplayer2.C.PcmEncoding int pcmEncoding) | Sets Format.pcmEncoding. | | Format.Builder | setPeakBitrate​(int peakBitrate) | Sets Format.peakBitrate. | | Format.Builder | setPixelWidthHeightRatio​(float pixelWidthHeightRatio) | Sets Format.pixelWidthHeightRatio. | | Format.Builder | setProjectionData​(byte[] projectionData) | Sets Format.projectionData. | | Format.Builder | setRoleFlags​(@com.google.android.exoplayer2.C.RoleFlags int roleFlags) | Sets Format.roleFlags. | | Format.Builder | setRotationDegrees​(int rotationDegrees) | Sets Format.rotationDegrees. | | Format.Builder | setSampleMimeType​(String sampleMimeType) | Sets Format.sampleMimeType. | | Format.Builder | setSampleRate​(int sampleRate) | Sets Format.sampleRate. | | Format.Builder | setSelectionFlags​(@com.google.android.exoplayer2.C.SelectionFlags int selectionFlags) | Sets Format.selectionFlags. | | Format.Builder | setStereoMode​(@com.google.android.exoplayer2.C.StereoMode int stereoMode) | Sets Format.stereoMode. | | Format.Builder | setSubsampleOffsetUs​(long subsampleOffsetUs) | Sets Format.subsampleOffsetUs. | | Format.Builder | setTileCountHorizontal​(int tileCountHorizontal) | Sets Format.tileCountHorizontal. | | Format.Builder | setTileCountVertical​(int tileCountVertical) | Sets Format.tileCountVertical. | | Format.Builder | setWidth​(int width) | Sets Format.width. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

- 

Builder

public Builder()

Creates a new instance with default values.

Method Detail

- 

setId

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setId​(@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")id)

Sets Format.id. The default value is null. Parameters:id - The Format.id.Returns:The builder.

- 

setId

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setId​(int id)

Sets Format.id to Integer.toString(id). The default value is null. Parameters:id - The Format.id.Returns:The builder.

- 

setLabel

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setLabel​(@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")label)

Sets Format.label. The default value is null. Parameters:label - The Format.label.Returns:The builder.

- 

setLanguage

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setLanguage​(@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")language)

Sets Format.language. The default value is null. Parameters:language - The Format.language.Returns:The builder.

- 

setSelectionFlags

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setSelectionFlags​([@SelectionFlags](C.SelectionFlags.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.C.SelectionFlags int selectionFlags)

Sets Format.selectionFlags. The default value is 0. Parameters:selectionFlags - The Format.selectionFlags.Returns:The builder.

- 

setRoleFlags

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setRoleFlags​([@RoleFlags](C.RoleFlags.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.C.RoleFlags int roleFlags)

Sets Format.roleFlags. The default value is 0. Parameters:roleFlags - The Format.roleFlags.Returns:The builder.

- 

setAverageBitrate

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setAverageBitrate​(int averageBitrate)

Sets Format.averageBitrate. The default value is Format.NO_VALUE. Parameters:averageBitrate - The Format.averageBitrate.Returns:The builder.

- 

setPeakBitrate

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setPeakBitrate​(int peakBitrate)

Sets Format.peakBitrate. The default value is Format.NO_VALUE. Parameters:peakBitrate - The Format.peakBitrate.Returns:The builder.

- 

setCodecs

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setCodecs​(@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")codecs)

Sets Format.codecs. The default value is null. Parameters:codecs - The Format.codecs.Returns:The builder.

- 

setMetadata

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setMetadata​(@Nullable[Metadata](metadata/Metadata.html "class in com.google.android.exoplayer2.metadata")metadata)

Sets Format.metadata. The default value is null. Parameters:metadata - The Format.metadata.Returns:The builder.

- 

setContainerMimeType

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setContainerMimeType​(@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")containerMimeType)

Sets Format.containerMimeType. The default value is null. Parameters:containerMimeType - The Format.containerMimeType.Returns:The builder.

- 

setSampleMimeType

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setSampleMimeType​(@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")sampleMimeType)

Sets Format.sampleMimeType. The default value is null. Parameters:sampleMimeType - Format.sampleMimeType.Returns:The builder.

- 

setMaxInputSize

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setMaxInputSize​(int maxInputSize)

Sets Format.maxInputSize. The default value is Format.NO_VALUE. Parameters:maxInputSize - The Format.maxInputSize.Returns:The builder.

- 

setInitializationData

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setInitializationData​(@Nullable[List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<byte[]> initializationData)

Sets Format.initializationData. The default value is null. Parameters:initializationData - The Format.initializationData.Returns:The builder.

- 

setDrmInitData

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setDrmInitData​(@Nullable[DrmInitData](drm/DrmInitData.html "class in com.google.android.exoplayer2.drm")drmInitData)

Sets Format.drmInitData. The default value is null. Parameters:drmInitData - The Format.drmInitData.Returns:The builder.

- 

setSubsampleOffsetUs

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setSubsampleOffsetUs​(long subsampleOffsetUs)

Sets Format.subsampleOffsetUs. The default value is Format.OFFSET_SAMPLE_RELATIVE. Parameters:subsampleOffsetUs - The Format.subsampleOffsetUs.Returns:The builder.

- 

setWidth

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setWidth​(int width)

Sets Format.width. The default value is Format.NO_VALUE. Parameters:width - The Format.width.Returns:The builder.

- 

setHeight

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setHeight​(int height)

Sets Format.height. The default value is Format.NO_VALUE. Parameters:height - The Format.height.Returns:The builder.

- 

setFrameRate

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setFrameRate​(float frameRate)

Sets Format.frameRate. The default value is Format.NO_VALUE. Parameters:frameRate - The Format.frameRate.Returns:The builder.

- 

setRotationDegrees

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setRotationDegrees​(int rotationDegrees)

Sets Format.rotationDegrees. The default value is 0. Parameters:rotationDegrees - The Format.rotationDegrees.Returns:The builder.

- 

setPixelWidthHeightRatio

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setPixelWidthHeightRatio​(float pixelWidthHeightRatio)

Sets Format.pixelWidthHeightRatio. The default value is 1.0f. Parameters:pixelWidthHeightRatio - The Format.pixelWidthHeightRatio.Returns:The builder.

- 

setProjectionData

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setProjectionData​(@Nullable
                                        byte[] projectionData)

Sets Format.projectionData. The default value is null. Parameters:projectionData - The Format.projectionData.Returns:The builder.

- 

setStereoMode

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setStereoMode​(@com.google.android.exoplayer2.C.StereoMode int stereoMode)

Sets Format.stereoMode. The default value is Format.NO_VALUE. Parameters:stereoMode - The Format.stereoMode.Returns:The builder.

- 

setColorInfo

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setColorInfo​(@Nullable[ColorInfo](video/ColorInfo.html "class in com.google.android.exoplayer2.video")colorInfo)

Sets Format.colorInfo. The default value is null. Parameters:colorInfo - The Format.colorInfo.Returns:The builder.

- 

setChannelCount

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setChannelCount​(int channelCount)

Sets Format.channelCount. The default value is Format.NO_VALUE. Parameters:channelCount - The Format.channelCount.Returns:The builder.

- 

setSampleRate

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setSampleRate​(int sampleRate)

Sets Format.sampleRate. The default value is Format.NO_VALUE. Parameters:sampleRate - The Format.sampleRate.Returns:The builder.

- 

setPcmEncoding

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setPcmEncoding​(@com.google.android.exoplayer2.C.PcmEncoding int pcmEncoding)

Sets Format.pcmEncoding. The default value is Format.NO_VALUE. Parameters:pcmEncoding - The Format.pcmEncoding.Returns:The builder.

- 

setEncoderDelay

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setEncoderDelay​(int encoderDelay)

Sets Format.encoderDelay. The default value is 0. Parameters:encoderDelay - The Format.encoderDelay.Returns:The builder.

- 

setEncoderPadding

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setEncoderPadding​(int encoderPadding)

Sets Format.encoderPadding. The default value is 0. Parameters:encoderPadding - The Format.encoderPadding.Returns:The builder.

- 

setAccessibilityChannel

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setAccessibilityChannel​(int accessibilityChannel)

Sets Format.accessibilityChannel. The default value is Format.NO_VALUE. Parameters:accessibilityChannel - The Format.accessibilityChannel.Returns:The builder.

- 

setTileCountHorizontal

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setTileCountHorizontal​(int tileCountHorizontal)

Sets Format.tileCountHorizontal. The default value is Format.NO_VALUE. Parameters:tileCountHorizontal - The Format.accessibilityChannel.Returns:The builder.

- 

setTileCountVertical

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setTileCountVertical​(int tileCountVertical)

Sets Format.tileCountVertical. The default value is Format.NO_VALUE. Parameters:tileCountVertical - The Format.accessibilityChannel.Returns:The builder.

- 

setCryptoType

@CanIgnoreReturnValue
public[Format.Builder](Format.Builder.html "class in com.google.android.exoplayer2")setCryptoType​(@com.google.android.exoplayer2.C.CryptoType int cryptoType)

Sets Format.cryptoType. The default value is C.CRYPTO_TYPE_NONE. Parameters:cryptoType - The C.CryptoType.Returns:The builder.

- 

build

public[Format](Format.html "class in com.google.android.exoplayer2")build()