Back to Exoplayer

Format (ExoPlayer library)

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

latest24.8 KB
Original Source

Package com.google.android.exoplayer2

Class Format

  • java.lang.Object

    • com.google.android.exoplayer2.Format
  • All Implemented Interfaces:Bundleable


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classFormatextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[Bundleable](Bundleable.html "interface in com.google.android.exoplayer2")

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

Represents a media format.

When building formats, populate all fields whose values are known and relevant to the type of format being constructed. For information about different types of format, see ExoPlayer's Supported formats page.

Fields commonly relevant to all formats

Fields relevant to container formats

  • containerMimeType
  • If the container only contains a single media track, fields relevant to sample formats can are also be relevant and can be set to describe the sample format of that track.
  • If the container only contains one track of a given type (possibly alongside tracks of other types), then fields relevant to that track type can be set to describe the properties of the track. See the sections below for video, audio and text formats.

Fields relevant to sample formats

Fields relevant to video formats

Fields relevant to audio formats

Fields relevant to text formats

Fields relevant to image formats

Nested Class Summary

Nested Classes | Modifier and Type | Class | Description | | --- | --- | --- | | static class | Format.Builder | Deprecated.

Builds Format instances. |

- 

Nested classes/interfaces inherited from interface com.google.android.exoplayer2.Bundleable

Bundleable.Creator<T extends Bundleable>

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | int | accessibilityChannel | Deprecated.

The Accessibility channel, or NO_VALUE if not known or applicable. | | int | averageBitrate | Deprecated.

The average bitrate in bits per second, or NO_VALUE if unknown or not applicable. | | int | bitrate | Deprecated.

The bitrate in bits per second. | | int | channelCount | Deprecated.

The number of audio channels, or NO_VALUE if unknown or not applicable. | | String | codecs | Deprecated.

Codecs of the format as described in RFC 6381, or null if unknown or not applicable. | | ColorInfo | colorInfo | Deprecated.

The color metadata associated with the video, or null if not applicable. | | String | containerMimeType | Deprecated.

The MIME type of the container, or null if unknown or not applicable. | | static Bundleable.Creator<Format> | CREATOR | Deprecated.

Object that can restore Format from a Bundle. | | @com.google.android.exoplayer2.C.CryptoType int | cryptoType | Deprecated.

The type of crypto that must be used to decode samples associated with this format, or C.CRYPTO_TYPE_NONE if the content is not encrypted. | | DrmInitData | drmInitData | Deprecated.

DRM initialization data if the stream is protected, or null otherwise. | | int | encoderDelay | Deprecated.

The number of frames to trim from the start of the decoded audio stream, or 0 if not applicable. | | int | encoderPadding | Deprecated.

The number of frames to trim from the end of the decoded audio stream, or 0 if not applicable. | | float | frameRate | Deprecated.

The frame rate in frames per second, or NO_VALUE if unknown or not applicable. | | int | height | Deprecated.

The height of the video in pixels, or NO_VALUE if unknown or not applicable. | | String | id | Deprecated.

An identifier for the format, or null if unknown or not applicable. | | List<byte[]> | initializationData | Deprecated.

Initialization data that must be provided to the decoder. | | String | label | Deprecated.

The human readable label, or null if unknown or not applicable. | | String | language | Deprecated.

The language as an IETF BCP 47 conformant tag, or null if unknown or not applicable. | | int | maxInputSize | Deprecated.

The maximum size of a buffer of data (typically one sample), or NO_VALUE if unknown or not applicable. | | Metadata | metadata | Deprecated.

Metadata, or null if unknown or not applicable. | | static int | NO_VALUE | Deprecated.

A value for various fields to indicate that the field's value is unknown or not applicable. | | static long | OFFSET_SAMPLE_RELATIVE | Deprecated.

A value for subsampleOffsetUs to indicate that subsample timestamps are relative to the timestamps of their parent samples. | | @com.google.android.exoplayer2.C.PcmEncoding int | pcmEncoding | Deprecated.

The C.PcmEncoding for PCM audio. | | int | peakBitrate | Deprecated.

The peak bitrate in bits per second, or NO_VALUE if unknown or not applicable. | | float | pixelWidthHeightRatio | Deprecated.

The width to height ratio of pixels in the video, or 1.0 if unknown or not applicable. | | byte[] | projectionData | Deprecated.

The projection data for 360/VR video, or null if not applicable. | | @com.google.android.exoplayer2.C.RoleFlags int | roleFlags | Deprecated.

Track role flags. | | int | rotationDegrees | Deprecated.

The clockwise rotation that should be applied to the video for it to be rendered in the correct orientation, or 0 if unknown or not applicable. | | String | sampleMimeType | Deprecated.

The sample MIME type, or null if unknown or not applicable. | | int | sampleRate | Deprecated.

The audio sampling rate in Hz, or NO_VALUE if unknown or not applicable. | | @com.google.android.exoplayer2.C.SelectionFlags int | selectionFlags | Deprecated.

Track selection flags. | | @com.google.android.exoplayer2.C.StereoMode int | stereoMode | Deprecated.

The stereo layout for 360/3D/VR video, or NO_VALUE if not applicable. | | long | subsampleOffsetUs | Deprecated.

For samples that contain subsamples, this is an offset that should be added to subsample timestamps. | | int | tileCountHorizontal | Deprecated.

The number of horizontal tiles in an image, or NO_VALUE if not known or applicable. | | int | tileCountVertical | Deprecated.

The number of vertical tiles in an image, or NO_VALUE if not known or applicable. | | int | width | Deprecated.

The width of the video in pixels, or NO_VALUE if unknown or not applicable. |

Method Summary

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | Format.Builder | buildUpon() | Deprecated.

Returns a Format.Builder initialized with the values of this instance. | | Format | copyWithCryptoType​(@com.google.android.exoplayer2.C.CryptoType int cryptoType) | Deprecated.

Returns a copy of this format with the specified cryptoType. | | boolean | equals​(Object obj) | Deprecated. | | int | getPixelCount() | Deprecated.

Returns the number of pixels if this is a video format whose width and height are known, or NO_VALUE otherwise | | int | hashCode() | Deprecated. | | boolean | initializationDataEquals​(Format other) | Deprecated.

Returns whether the initializationDatas belonging to this format and other are equal. | | Bundle | toBundle() | Deprecated.

Returns a Bundle representing the information stored in this object. | | Bundle | toBundle​(boolean excludeMetadata) | Deprecated.

Returns a Bundle representing the information stored in this object. | | static String | toLogString​(Format format) | Deprecated.

Returns a prettier String than toString(), intended for logging. | | String | toString() | Deprecated. | | Format | withManifestFormatInfo​(Format manifestFormat) | Deprecated. |

- 

Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, wait, wait, wait

Field Detail

- 

NO_VALUE

public static final int NO_VALUE

Deprecated.

A value for various fields to indicate that the field's value is unknown or not applicable. See Also:Constant Field Values

- 

OFFSET_SAMPLE_RELATIVE

public static final long OFFSET_SAMPLE_RELATIVE

Deprecated.

A value for subsampleOffsetUs to indicate that subsample timestamps are relative to the timestamps of their parent samples. See Also:Constant Field Values

- 

id

@Nullable
public final[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")id

Deprecated.

An identifier for the format, or null if unknown or not applicable.

- 

label

@Nullable
public final[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")label

Deprecated.

The human readable label, or null if unknown or not applicable.

- 

language

@Nullable
public final[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")language

Deprecated.

The language as an IETF BCP 47 conformant tag, or null if unknown or not applicable.

- 

selectionFlags

[@SelectionFlags](C.SelectionFlags.html "annotation in com.google.android.exoplayer2")public final @com.google.android.exoplayer2.C.SelectionFlags int selectionFlags

Deprecated.

Track selection flags.

- 

roleFlags

[@RoleFlags](C.RoleFlags.html "annotation in com.google.android.exoplayer2")public final @com.google.android.exoplayer2.C.RoleFlags int roleFlags

Deprecated.

Track role flags.

- 

averageBitrate

public final int averageBitrate

Deprecated.

The average bitrate in bits per second, or NO_VALUE if unknown or not applicable. The way in which this field is populated depends on the type of media to which the format corresponds: - DASH representations: Always NO_VALUE. - HLS variants: The AVERAGE-BANDWIDTH attribute defined on the corresponding EXT-X-STREAM-INF tag in the multivariant playlist, or NO_VALUE if not present. - SmoothStreaming track elements: The Bitrate attribute defined on the corresponding TrackElement in the manifest, or NO_VALUE if not present. - Progressive container formats: Often NO_VALUE, but may be populated with the average bitrate of the container if known. - Sample formats: Often NO_VALUE, but may be populated with the average bitrate of the stream of samples with type sampleMimeType if known. Note that if sampleMimeType is a compressed format (e.g., MimeTypes.AUDIO_AAC), then this bitrate is for the stream of still compressed samples.

- 

peakBitrate

public final int peakBitrate

Deprecated.

The peak bitrate in bits per second, or NO_VALUE if unknown or not applicable. The way in which this field is populated depends on the type of media to which the format corresponds: - DASH representations: The @bandwidth attribute of the corresponding Representation element in the manifest. - HLS variants: The BANDWIDTH attribute defined on the corresponding EXT-X-STREAM-INF tag. - SmoothStreaming track elements: Always NO_VALUE. - Progressive container formats: Often NO_VALUE, but may be populated with the peak bitrate of the container if known. - Sample formats: Often NO_VALUE, but may be populated with the peak bitrate of the stream of samples with type sampleMimeType if known. Note that if sampleMimeType is a compressed format (e.g., MimeTypes.AUDIO_AAC), then this bitrate is for the stream of still compressed samples.

- 

bitrate

public final int bitrate

Deprecated.

The bitrate in bits per second. This is the peak bitrate if known, or else the average bitrate if known, or else NO_VALUE. Equivalent to: peakBitrate != NO_VALUE ? peakBitrate : averageBitrate.

- 

codecs

@Nullable
public final[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")codecs

Deprecated.

Codecs of the format as described in RFC 6381, or null if unknown or not applicable.

- 

metadata

@Nullable
public final[Metadata](metadata/Metadata.html "class in com.google.android.exoplayer2.metadata")metadata

Deprecated.

Metadata, or null if unknown or not applicable.

- 

containerMimeType

@Nullable
public final[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")containerMimeType

Deprecated.

The MIME type of the container, or null if unknown or not applicable.

- 

sampleMimeType

@Nullable
public final[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")sampleMimeType

Deprecated.

The sample MIME type, or null if unknown or not applicable.

- 

maxInputSize

public final int maxInputSize

Deprecated.

The maximum size of a buffer of data (typically one sample), or NO_VALUE if unknown or not applicable.

- 

initializationData

public final[List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<byte[]> initializationData

Deprecated.

Initialization data that must be provided to the decoder. Will not be null, but may be empty if initialization data is not required.

- 

drmInitData

@Nullable
public final[DrmInitData](drm/DrmInitData.html "class in com.google.android.exoplayer2.drm")drmInitData

Deprecated.

DRM initialization data if the stream is protected, or null otherwise.

- 

subsampleOffsetUs

public final long subsampleOffsetUs

Deprecated.

For samples that contain subsamples, this is an offset that should be added to subsample timestamps. A value of OFFSET_SAMPLE_RELATIVE indicates that subsample timestamps are relative to the timestamps of their parent samples.

- 

width

public final int width

Deprecated.

The width of the video in pixels, or NO_VALUE if unknown or not applicable.

- 

height

public final int height

Deprecated.

The height of the video in pixels, or NO_VALUE if unknown or not applicable.

- 

frameRate

public final float frameRate

Deprecated.

The frame rate in frames per second, or NO_VALUE if unknown or not applicable.

- 

rotationDegrees

public final int rotationDegrees

Deprecated.

The clockwise rotation that should be applied to the video for it to be rendered in the correct orientation, or 0 if unknown or not applicable. Only 0, 90, 180 and 270 are supported.

- 

pixelWidthHeightRatio

public final float pixelWidthHeightRatio

Deprecated.

The width to height ratio of pixels in the video, or 1.0 if unknown or not applicable.

- 

projectionData

@Nullable
public final byte[] projectionData

Deprecated.

The projection data for 360/VR video, or null if not applicable.

- 

stereoMode

public final @com.google.android.exoplayer2.C.StereoMode int stereoMode

Deprecated.

The stereo layout for 360/3D/VR video, or NO_VALUE if not applicable. Valid stereo modes are C.STEREO_MODE_MONO, C.STEREO_MODE_TOP_BOTTOM, C.STEREO_MODE_LEFT_RIGHT, C.STEREO_MODE_STEREO_MESH.

- 

colorInfo

@Nullable
public final[ColorInfo](video/ColorInfo.html "class in com.google.android.exoplayer2.video")colorInfo

Deprecated.

The color metadata associated with the video, or null if not applicable.

- 

channelCount

public final int channelCount

Deprecated.

The number of audio channels, or NO_VALUE if unknown or not applicable.

- 

sampleRate

public final int sampleRate

Deprecated.

The audio sampling rate in Hz, or NO_VALUE if unknown or not applicable.

- 

pcmEncoding

public final @com.google.android.exoplayer2.C.PcmEncoding int pcmEncoding

Deprecated.

The C.PcmEncoding for PCM audio. Set to NO_VALUE for other media types.

- 

encoderDelay

public final int encoderDelay

Deprecated.

The number of frames to trim from the start of the decoded audio stream, or 0 if not applicable.

- 

encoderPadding

public final int encoderPadding

Deprecated.

The number of frames to trim from the end of the decoded audio stream, or 0 if not applicable.

- 

accessibilityChannel

public final int accessibilityChannel

Deprecated.

The Accessibility channel, or NO_VALUE if not known or applicable.

- 

tileCountHorizontal

public final int tileCountHorizontal

Deprecated.

The number of horizontal tiles in an image, or NO_VALUE if not known or applicable.

- 

tileCountVertical

public final int tileCountVertical

Deprecated.

The number of vertical tiles in an image, or NO_VALUE if not known or applicable.

- 

cryptoType

public final @com.google.android.exoplayer2.C.CryptoType int cryptoType

Deprecated.

The type of crypto that must be used to decode samples associated with this format, or C.CRYPTO_TYPE_NONE if the content is not encrypted. Cannot be C.CRYPTO_TYPE_NONE if drmInitData is non-null, but may be C.CRYPTO_TYPE_UNSUPPORTED to indicate that the samples are encrypted using an unsupported crypto type.

- 

CREATOR

public static final[Bundleable.Creator](Bundleable.Creator.html "interface in com.google.android.exoplayer2")<[Format](Format.html "class in com.google.android.exoplayer2")> CREATOR

Deprecated.

Object that can restore Format from a Bundle.

Method Detail

- 

buildUpon

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

Deprecated.

Returns a Format.Builder initialized with the values of this instance.

- 

withManifestFormatInfo

public[Format](Format.html "class in com.google.android.exoplayer2")withManifestFormatInfo​([Format](Format.html "class in com.google.android.exoplayer2")manifestFormat)

Deprecated.

- 

copyWithCryptoType

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

Deprecated.

Returns a copy of this format with the specified cryptoType.

- 

getPixelCount

public int getPixelCount()

Deprecated.

Returns the number of pixels if this is a video format whose width and height are known, or NO_VALUE otherwise

- 

toString

public[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")toString()

Deprecated. Overrides:toString in class Object

- 

hashCode

public int hashCode()

Deprecated. Overrides:hashCode in class Object

- 

equals

public boolean equals​(@Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")obj)

Deprecated. Overrides:equals in class Object

- 

initializationDataEquals

public boolean initializationDataEquals​([Format](Format.html "class in com.google.android.exoplayer2")other)

Deprecated.

Returns whether the initializationDatas belonging to this format and other are equal. Parameters:other - The other format whose initializationData is being compared.Returns:Whether the initializationDatas belonging to this format and other are equal.

- 

toLogString

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

Deprecated.

Returns a prettier String than toString(), intended for logging.

- 

toBundle

public[Bundle](https://developer.android.com/reference/android/os/Bundle.html "class or interface in android.os")toBundle()

Deprecated.

Description copied from interface: Bundleable

Returns a Bundle representing the information stored in this object. Specified by:toBundle in interface Bundleable

- 

toBundle

public[Bundle](https://developer.android.com/reference/android/os/Bundle.html "class or interface in android.os")toBundle​(boolean excludeMetadata)

Deprecated.

Returns a Bundle representing the information stored in this object. If excludeMetadata is true, metadata is excluded.