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
public Format.Builder setId(@Nullable String id)
SetsFormat.id
. The default value isnull
.- Parameters:
id
- TheFormat.id
.- Returns:
- The builder.
-
setId
public Format.Builder setId(int id)
- Parameters:
id
- TheFormat.id
.- Returns:
- The builder.
-
setLabel
public Format.Builder setLabel(@Nullable String label)
SetsFormat.label
. The default value isnull
.- Parameters:
label
- TheFormat.label
.- Returns:
- The builder.
-
setLanguage
public Format.Builder setLanguage(@Nullable String language)
SetsFormat.language
. The default value isnull
.- Parameters:
language
- TheFormat.language
.- Returns:
- The builder.
-
setSelectionFlags
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
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
public Format.Builder setAverageBitrate(int averageBitrate)
SetsFormat.averageBitrate
. The default value isFormat.NO_VALUE
.- Parameters:
averageBitrate
- TheFormat.averageBitrate
.- Returns:
- The builder.
-
setPeakBitrate
public Format.Builder setPeakBitrate(int peakBitrate)
SetsFormat.peakBitrate
. The default value isFormat.NO_VALUE
.- Parameters:
peakBitrate
- TheFormat.peakBitrate
.- Returns:
- The builder.
-
setCodecs
public Format.Builder setCodecs(@Nullable String codecs)
SetsFormat.codecs
. The default value isnull
.- Parameters:
codecs
- TheFormat.codecs
.- Returns:
- The builder.
-
setMetadata
public Format.Builder setMetadata(@Nullable Metadata metadata)
SetsFormat.metadata
. The default value isnull
.- Parameters:
metadata
- TheFormat.metadata
.- Returns:
- The builder.
-
setContainerMimeType
public Format.Builder setContainerMimeType(@Nullable String containerMimeType)
SetsFormat.containerMimeType
. The default value isnull
.- Parameters:
containerMimeType
- TheFormat.containerMimeType
.- Returns:
- The builder.
-
setSampleMimeType
public Format.Builder setSampleMimeType(@Nullable String sampleMimeType)
SetsFormat.sampleMimeType
. The default value isnull
.- Parameters:
sampleMimeType
-Format.sampleMimeType
.- Returns:
- The builder.
-
setMaxInputSize
public Format.Builder setMaxInputSize(int maxInputSize)
SetsFormat.maxInputSize
. The default value isFormat.NO_VALUE
.- Parameters:
maxInputSize
- TheFormat.maxInputSize
.- Returns:
- The builder.
-
setInitializationData
public Format.Builder setInitializationData(@Nullable List<byte[]> initializationData)
SetsFormat.initializationData
. The default value isnull
.- Parameters:
initializationData
- TheFormat.initializationData
.- Returns:
- The builder.
-
setDrmInitData
public Format.Builder setDrmInitData(@Nullable DrmInitData drmInitData)
SetsFormat.drmInitData
. The default value isnull
.- Parameters:
drmInitData
- TheFormat.drmInitData
.- Returns:
- The builder.
-
setSubsampleOffsetUs
public Format.Builder setSubsampleOffsetUs(long subsampleOffsetUs)
SetsFormat.subsampleOffsetUs
. The default value isFormat.OFFSET_SAMPLE_RELATIVE
.- Parameters:
subsampleOffsetUs
- TheFormat.subsampleOffsetUs
.- Returns:
- The builder.
-
setWidth
public Format.Builder setWidth(int width)
SetsFormat.width
. The default value isFormat.NO_VALUE
.- Parameters:
width
- TheFormat.width
.- Returns:
- The builder.
-
setHeight
public Format.Builder setHeight(int height)
SetsFormat.height
. The default value isFormat.NO_VALUE
.- Parameters:
height
- TheFormat.height
.- Returns:
- The builder.
-
setFrameRate
public Format.Builder setFrameRate(float frameRate)
SetsFormat.frameRate
. The default value isFormat.NO_VALUE
.- Parameters:
frameRate
- TheFormat.frameRate
.- Returns:
- The builder.
-
setRotationDegrees
public Format.Builder setRotationDegrees(int rotationDegrees)
SetsFormat.rotationDegrees
. The default value is 0.- Parameters:
rotationDegrees
- TheFormat.rotationDegrees
.- Returns:
- The builder.
-
setPixelWidthHeightRatio
public Format.Builder setPixelWidthHeightRatio(float pixelWidthHeightRatio)
SetsFormat.pixelWidthHeightRatio
. The default value is 1.0f.- Parameters:
pixelWidthHeightRatio
- TheFormat.pixelWidthHeightRatio
.- Returns:
- The builder.
-
setProjectionData
public Format.Builder setProjectionData(@Nullable byte[] projectionData)
SetsFormat.projectionData
. The default value isnull
.- Parameters:
projectionData
- TheFormat.projectionData
.- Returns:
- The builder.
-
setStereoMode
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
public Format.Builder setColorInfo(@Nullable ColorInfo colorInfo)
SetsFormat.colorInfo
. The default value isnull
.- Parameters:
colorInfo
- TheFormat.colorInfo
.- Returns:
- The builder.
-
setChannelCount
public Format.Builder setChannelCount(int channelCount)
SetsFormat.channelCount
. The default value isFormat.NO_VALUE
.- Parameters:
channelCount
- TheFormat.channelCount
.- Returns:
- The builder.
-
setSampleRate
public Format.Builder setSampleRate(int sampleRate)
SetsFormat.sampleRate
. The default value isFormat.NO_VALUE
.- Parameters:
sampleRate
- TheFormat.sampleRate
.- Returns:
- The builder.
-
setPcmEncoding
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
public Format.Builder setEncoderDelay(int encoderDelay)
SetsFormat.encoderDelay
. The default value is 0.- Parameters:
encoderDelay
- TheFormat.encoderDelay
.- Returns:
- The builder.
-
setEncoderPadding
public Format.Builder setEncoderPadding(int encoderPadding)
SetsFormat.encoderPadding
. The default value is 0.- Parameters:
encoderPadding
- TheFormat.encoderPadding
.- Returns:
- The builder.
-
setAccessibilityChannel
public Format.Builder setAccessibilityChannel(int accessibilityChannel)
SetsFormat.accessibilityChannel
. The default value isFormat.NO_VALUE
.- Parameters:
accessibilityChannel
- TheFormat.accessibilityChannel
.- Returns:
- The builder.
-
setCryptoType
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()
-
-