Package com.google.android.exoplayer2
Class Format.Builder
- java.lang.Object
-
- com.google.android.exoplayer2.Format.Builder
-
- Enclosing class:
- Format
public static final class Format.Builder extends Object
BuildsFormat
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
-
-
-
Method Detail
-
setId
@CanIgnoreReturnValue public Format.Builder setId(@Nullable String id)
SetsFormat.id
. The default value isnull
.- Parameters:
id
- TheFormat.id
.- Returns:
- The builder.
-
setId
@CanIgnoreReturnValue public Format.Builder setId(int id)
- Parameters:
id
- TheFormat.id
.- Returns:
- The builder.
-
setLabel
@CanIgnoreReturnValue public Format.Builder setLabel(@Nullable String label)
SetsFormat.label
. The default value isnull
.- Parameters:
label
- TheFormat.label
.- Returns:
- The builder.
-
setLanguage
@CanIgnoreReturnValue public Format.Builder setLanguage(@Nullable String language)
SetsFormat.language
. The default value isnull
.- Parameters:
language
- TheFormat.language
.- Returns:
- The builder.
-
setSelectionFlags
@CanIgnoreReturnValue public Format.Builder setSelectionFlags(@SelectionFlags @com.google.android.exoplayer2.C.SelectionFlags int selectionFlags)
SetsFormat.selectionFlags
. The default value is 0.- Parameters:
selectionFlags
- TheFormat.selectionFlags
.- Returns:
- The builder.
-
setRoleFlags
@CanIgnoreReturnValue public Format.Builder setRoleFlags(@RoleFlags @com.google.android.exoplayer2.C.RoleFlags int roleFlags)
SetsFormat.roleFlags
. The default value is 0.- Parameters:
roleFlags
- TheFormat.roleFlags
.- Returns:
- The builder.
-
setAverageBitrate
@CanIgnoreReturnValue public Format.Builder setAverageBitrate(int averageBitrate)
SetsFormat.averageBitrate
. The default value isFormat.NO_VALUE
.- Parameters:
averageBitrate
- TheFormat.averageBitrate
.- Returns:
- The builder.
-
setPeakBitrate
@CanIgnoreReturnValue public Format.Builder setPeakBitrate(int peakBitrate)
SetsFormat.peakBitrate
. The default value isFormat.NO_VALUE
.- Parameters:
peakBitrate
- TheFormat.peakBitrate
.- Returns:
- The builder.
-
setCodecs
@CanIgnoreReturnValue public Format.Builder setCodecs(@Nullable String codecs)
SetsFormat.codecs
. The default value isnull
.- Parameters:
codecs
- TheFormat.codecs
.- Returns:
- The builder.
-
setMetadata
@CanIgnoreReturnValue public Format.Builder setMetadata(@Nullable Metadata metadata)
SetsFormat.metadata
. The default value isnull
.- Parameters:
metadata
- TheFormat.metadata
.- Returns:
- The builder.
-
setContainerMimeType
@CanIgnoreReturnValue public Format.Builder setContainerMimeType(@Nullable String containerMimeType)
SetsFormat.containerMimeType
. The default value isnull
.- Parameters:
containerMimeType
- TheFormat.containerMimeType
.- Returns:
- The builder.
-
setSampleMimeType
@CanIgnoreReturnValue public Format.Builder setSampleMimeType(@Nullable String sampleMimeType)
SetsFormat.sampleMimeType
. The default value isnull
.- Parameters:
sampleMimeType
-Format.sampleMimeType
.- Returns:
- The builder.
-
setMaxInputSize
@CanIgnoreReturnValue public Format.Builder setMaxInputSize(int maxInputSize)
SetsFormat.maxInputSize
. The default value isFormat.NO_VALUE
.- Parameters:
maxInputSize
- TheFormat.maxInputSize
.- Returns:
- The builder.
-
setInitializationData
@CanIgnoreReturnValue public Format.Builder setInitializationData(@Nullable List<byte[]> initializationData)
SetsFormat.initializationData
. The default value isnull
.- Parameters:
initializationData
- TheFormat.initializationData
.- Returns:
- The builder.
-
setDrmInitData
@CanIgnoreReturnValue public Format.Builder setDrmInitData(@Nullable DrmInitData drmInitData)
SetsFormat.drmInitData
. The default value isnull
.- Parameters:
drmInitData
- TheFormat.drmInitData
.- Returns:
- The builder.
-
setSubsampleOffsetUs
@CanIgnoreReturnValue public Format.Builder setSubsampleOffsetUs(long subsampleOffsetUs)
SetsFormat.subsampleOffsetUs
. The default value isFormat.OFFSET_SAMPLE_RELATIVE
.- Parameters:
subsampleOffsetUs
- TheFormat.subsampleOffsetUs
.- Returns:
- The builder.
-
setWidth
@CanIgnoreReturnValue public Format.Builder setWidth(int width)
SetsFormat.width
. The default value isFormat.NO_VALUE
.- Parameters:
width
- TheFormat.width
.- Returns:
- The builder.
-
setHeight
@CanIgnoreReturnValue public Format.Builder setHeight(int height)
SetsFormat.height
. The default value isFormat.NO_VALUE
.- Parameters:
height
- TheFormat.height
.- Returns:
- The builder.
-
setFrameRate
@CanIgnoreReturnValue public Format.Builder setFrameRate(float frameRate)
SetsFormat.frameRate
. The default value isFormat.NO_VALUE
.- Parameters:
frameRate
- TheFormat.frameRate
.- Returns:
- The builder.
-
setRotationDegrees
@CanIgnoreReturnValue public Format.Builder setRotationDegrees(int rotationDegrees)
SetsFormat.rotationDegrees
. The default value is 0.- Parameters:
rotationDegrees
- TheFormat.rotationDegrees
.- Returns:
- The builder.
-
setPixelWidthHeightRatio
@CanIgnoreReturnValue public Format.Builder setPixelWidthHeightRatio(float pixelWidthHeightRatio)
SetsFormat.pixelWidthHeightRatio
. The default value is 1.0f.- Parameters:
pixelWidthHeightRatio
- TheFormat.pixelWidthHeightRatio
.- Returns:
- The builder.
-
setProjectionData
@CanIgnoreReturnValue public Format.Builder setProjectionData(@Nullable byte[] projectionData)
SetsFormat.projectionData
. The default value isnull
.- Parameters:
projectionData
- TheFormat.projectionData
.- Returns:
- The builder.
-
setStereoMode
@CanIgnoreReturnValue public Format.Builder setStereoMode(@com.google.android.exoplayer2.C.StereoMode int stereoMode)
SetsFormat.stereoMode
. The default value isFormat.NO_VALUE
.- Parameters:
stereoMode
- TheFormat.stereoMode
.- Returns:
- The builder.
-
setColorInfo
@CanIgnoreReturnValue public Format.Builder setColorInfo(@Nullable ColorInfo colorInfo)
SetsFormat.colorInfo
. The default value isnull
.- Parameters:
colorInfo
- TheFormat.colorInfo
.- Returns:
- The builder.
-
setChannelCount
@CanIgnoreReturnValue public Format.Builder setChannelCount(int channelCount)
SetsFormat.channelCount
. The default value isFormat.NO_VALUE
.- Parameters:
channelCount
- TheFormat.channelCount
.- Returns:
- The builder.
-
setSampleRate
@CanIgnoreReturnValue public Format.Builder setSampleRate(int sampleRate)
SetsFormat.sampleRate
. The default value isFormat.NO_VALUE
.- Parameters:
sampleRate
- TheFormat.sampleRate
.- Returns:
- The builder.
-
setPcmEncoding
@CanIgnoreReturnValue public Format.Builder setPcmEncoding(@com.google.android.exoplayer2.C.PcmEncoding int pcmEncoding)
SetsFormat.pcmEncoding
. The default value isFormat.NO_VALUE
.- Parameters:
pcmEncoding
- TheFormat.pcmEncoding
.- Returns:
- The builder.
-
setEncoderDelay
@CanIgnoreReturnValue public Format.Builder setEncoderDelay(int encoderDelay)
SetsFormat.encoderDelay
. The default value is 0.- Parameters:
encoderDelay
- TheFormat.encoderDelay
.- Returns:
- The builder.
-
setEncoderPadding
@CanIgnoreReturnValue public Format.Builder setEncoderPadding(int encoderPadding)
SetsFormat.encoderPadding
. The default value is 0.- Parameters:
encoderPadding
- TheFormat.encoderPadding
.- Returns:
- The builder.
-
setAccessibilityChannel
@CanIgnoreReturnValue public Format.Builder setAccessibilityChannel(int accessibilityChannel)
SetsFormat.accessibilityChannel
. The default value isFormat.NO_VALUE
.- Parameters:
accessibilityChannel
- TheFormat.accessibilityChannel
.- Returns:
- The builder.
-
setTileCountHorizontal
@CanIgnoreReturnValue public Format.Builder setTileCountHorizontal(int tileCountHorizontal)
SetsFormat.tileCountHorizontal
. The default value isFormat.NO_VALUE
.- Parameters:
tileCountHorizontal
- TheFormat.accessibilityChannel
.- Returns:
- The builder.
-
setTileCountVertical
@CanIgnoreReturnValue public Format.Builder setTileCountVertical(int tileCountVertical)
SetsFormat.tileCountVertical
. The default value isFormat.NO_VALUE
.- Parameters:
tileCountVertical
- TheFormat.accessibilityChannel
.- Returns:
- The builder.
-
setCryptoType
@CanIgnoreReturnValue public Format.Builder setCryptoType(@com.google.android.exoplayer2.C.CryptoType int cryptoType)
SetsFormat.cryptoType
. The default value isC.CRYPTO_TYPE_NONE
.- Parameters:
cryptoType
- TheC.CryptoType
.- Returns:
- The builder.
-
build
public Format build()
-
-