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 |
|---|
Builder()Creates a new instance with default values. |
Public constructors
Public methods
setAccessibilityChannel
@CanIgnoreReturnValue
public Format.Builder setAccessibilityChannel(int accessibilityChannel)
Sets accessibilityChannel. The default value is NO_VALUE.
| Parameters | |
|---|---|
int accessibilityChannel |
The |
| Returns | |
|---|---|
Format.Builder |
The builder. |
setAuxiliaryTrackType
@CanIgnoreReturnValue
public Format.Builder setAuxiliaryTrackType(@C.AuxiliaryTrackType int auxiliaryTrackType)
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 int auxiliaryTrackType |
The |
| 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 |
| 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 |
| Returns | |
|---|---|
Format.Builder |
The builder. |
setCodecs
@CanIgnoreReturnValue
public Format.Builder setCodecs(@Nullable String codecs)
Sets codecs. The default value is null.
| Returns | |
|---|---|
Format.Builder |
The builder. |
setColorInfo
@CanIgnoreReturnValue
public Format.Builder setColorInfo(@Nullable ColorInfo colorInfo)
Sets colorInfo. The default value is null.
| 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 |
| 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 |
| 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 |
| Returns | |
|---|---|
Format.Builder |
The builder. |
setCustomData
@UnstableApi
@CanIgnoreReturnValue
public Format.Builder setCustomData(@Nullable Object customData)
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 | |
|---|---|
@Nullable Object customData |
The |
| Returns | |
|---|---|
Format.Builder |
The builder. |
setDecodedHeight
@CanIgnoreReturnValue
public Format.Builder setDecodedHeight(int decodedHeight)
Sets decodedHeight. The default value is NO_VALUE.
| Parameters | |
|---|---|
int decodedHeight |
The |
| Returns | |
|---|---|
Format.Builder |
The builder. |
setDecodedWidth
@CanIgnoreReturnValue
public Format.Builder setDecodedWidth(int decodedWidth)
Sets decodedWidth. The default value is NO_VALUE.
| Parameters | |
|---|---|
int decodedWidth |
The |
| 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 |
| Returns | |
|---|---|
Format.Builder |
The builder. |
setEncoderDelay
@CanIgnoreReturnValue
public Format.Builder setEncoderDelay(int encoderDelay)
Sets encoderDelay. The default value is 0.
| Parameters | |
|---|---|
int encoderDelay |
The |
| Returns | |
|---|---|
Format.Builder |
The builder. |
setEncoderPadding
@CanIgnoreReturnValue
public Format.Builder setEncoderPadding(int encoderPadding)
Sets encoderPadding. The default value is 0.
| Parameters | |
|---|---|
int encoderPadding |
The |
| 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 |
| Returns | |
|---|---|
Format.Builder |
The builder. |
setHasPrerollSamples
@CanIgnoreReturnValue
public Format.Builder setHasPrerollSamples(boolean hasPrerollSamples)
Sets hasPrerollSamples. The default value is false.
| Parameters | |
|---|---|
boolean hasPrerollSamples |
The |
| 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 |
| 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 |
| Returns | |
|---|---|
Format.Builder |
The builder. |
setId
@CanIgnoreReturnValue
public Format.Builder setId(@Nullable String id)
Sets id. The default value is null.
| 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 |
| 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.
| 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.
| Returns | |
|---|---|
Format.Builder |
The builder. |
setLanguage
@CanIgnoreReturnValue
public Format.Builder setLanguage(@Nullable String language)
Sets language. The default value is null.
| 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 |
| Returns | |
|---|---|
Format.Builder |
The builder. |
setMaxNumReorderSamples
@CanIgnoreReturnValue
public Format.Builder setMaxNumReorderSamples(int maxNumReorderSamples)
Sets maxNumReorderSamples. The default value is NO_VALUE.
| Parameters | |
|---|---|
int maxNumReorderSamples |
| Returns | |
|---|---|
Format.Builder |
The builder. |
setMaxSubLayers
@CanIgnoreReturnValue
public Format.Builder setMaxSubLayers(int maxSubLayers)
Sets maxSubLayers. The default value is NO_VALUE.
| Parameters | |
|---|---|
int maxSubLayers |
The |
| Returns | |
|---|---|
Format.Builder |
The builder. |
setMetadata
@CanIgnoreReturnValue
public Format.Builder setMetadata(@Nullable Metadata metadata)
Sets metadata. The default value is null.
| 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 |
| 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 |
| Returns | |
|---|---|
Format.Builder |
The builder. |
setPixelWidthHeightRatio
@CanIgnoreReturnValue
public Format.Builder setPixelWidthHeightRatio(float pixelWidthHeightRatio)
Sets pixelWidthHeightRatio. The default value is 1.0f.
| Parameters | |
|---|---|
float 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 |
| Returns | |
|---|---|
Format.Builder |
The builder. |
setRoleFlags
@CanIgnoreReturnValue
public Format.Builder setRoleFlags(@C.RoleFlags int roleFlags)
Sets roleFlags. The default value is 0.
When roleFlags includes ROLE_FLAG_AUXILIARY, then the specific C.AuxiliaryTrackType can also be set.
| Parameters | |
|---|---|
@C.RoleFlags int roleFlags |
The |
| Returns | |
|---|---|
Format.Builder |
The builder. |
setRotationDegrees
@CanIgnoreReturnValue
public Format.Builder setRotationDegrees(int rotationDegrees)
Sets rotationDegrees. The default value is 0.
| Parameters | |
|---|---|
int rotationDegrees |
The |
| Returns | |
|---|---|
Format.Builder |
The builder. |
setSampleMimeType
@CanIgnoreReturnValue
public Format.Builder setSampleMimeType(@Nullable String sampleMimeType)
Sets sampleMimeType. The default value is null.
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| Returns | |
|---|---|
Format.Builder |
The builder. |