public final class MediaFormat
extends java.lang.Object
implements android.os.Parcelable
Parcelable
object that can be used describe the format of media stream.
This is a derivative of the media format class in ExoPlayer 1 SDK.
Modifier and Type | Field and Description |
---|---|
boolean |
adaptive
Specifies whether the format represents an adaptive track, meaning that the format of the
actual media data may change (e.g.
|
int |
bitrate
The average bandwidth in bits per second, or
Constants.NO_VALUE
if unknown or not applicable. |
int |
channelCount
The number of audio channels, or
Constants.NO_VALUE if unknown
or not applicable. |
static android.os.Parcelable.Creator<MediaFormat> |
CREATOR |
long |
durationUs
The duration in microseconds, or
Constants.UNKNOWN_TIME_US if
the duration is unknown, or Constants.MATCH_LONGEST_US if the
duration should match the duration of the longest track whose duration is known. |
int |
encoderDelay
The number of samples to trim from the start of the decoded audio stream.
|
int |
encoderPadding
The number of samples to trim from the end of the decoded audio stream.
|
int |
height
The height of the video in pixels, or
Constants.NO_VALUE if
unknown or not applicable. |
java.util.List<byte[]> |
initializationData
Initialization data that must be provided to the decoder.
|
java.lang.String |
language
The language of the track, or null if unknown or not applicable
|
int |
maxHeight
If the video is flagged
adaptive , this is the maximum height of the video in pixels
that will be encountered in the stream. |
int |
maxInputSize
The maximum size of a buffer of data (typically one sample) in the format, or
Constants.NO_VALUE if unknown or not applicable. |
int |
maxWidth
If the video is flagged
adaptive , this is the maximum width of the video in pixels
that will be encountered in the stream. |
java.lang.String |
mimeType
The mime type of the format.
|
static java.util.List<byte[]> |
NO_INITIALIZATION_DATA
Empty initialization data.
|
static long |
OFFSET_SAMPLE_RELATIVE
A value for
subSampleOffsetUs to indicate that sub-sample timestamps are relative to
the timestamps of their parent samples. |
int |
pcmEncoding
The encoding for PCM audio streams.
|
float |
pixelWidthHeightRatio
The width to height ratio of pixels in the video, or
Constants.NO_VALUE
if unknown or not applicable. |
byte[] |
projectionData
The projection data for 360/VR video, or null if not applicable.
|
int |
rotationDegrees
The clockwise rotation that should be applied to the video for it to be rendered in the
correct orientation, or
Constants.NO_VALUE if unknown or not
applicable. |
int |
sampleRate
The audio sampling rate in Hz, or
Constants.NO_VALUE if unknown
or not applicable. |
int |
stereoMode
The stereo layout for 360/3D/VR video, or NO_VALUE if not applicable.
|
long |
subSampleOffsetUs
For samples that contain sub-samples, this is an offset that should be added to sub-sample
timestamps.
|
java.lang.String |
trackId
The identifier for the track represented by the format, or null if unknown or not applicable.
|
int |
width
The width of the video in pixels, or
Constants.NO_VALUE if
unknown or not applicable. |
Modifier and Type | Method and Description |
---|---|
MediaFormat |
copyAsAdaptive(java.lang.String trackId) |
MediaFormat |
copyWithDurationUs(long durationUs) |
MediaFormat |
copyWithFixedTrackInfo(java.lang.String trackId,
int bitrate,
int width,
int height,
java.lang.String language) |
MediaFormat |
copyWithGaplessInfo(int encoderDelay,
int encoderPadding) |
MediaFormat |
copyWithLanguage(java.lang.String language) |
MediaFormat |
copyWithMaxInputSize(int maxInputSize) |
MediaFormat |
copyWithMaxVideoDimensions(int maxWidth,
int maxHeight) |
MediaFormat |
copyWithSubSampleOffsetUs(long subSampleOffsetUs) |
static MediaFormat |
createAudioFormat(java.lang.String trackId,
java.lang.String mimeType,
int bitrate,
int maxInputSize,
long durationUs,
int channelCount,
int sampleRate,
java.util.List<byte[]> initializationData,
java.lang.String language) |
static MediaFormat |
createAudioFormat(java.lang.String trackId,
java.lang.String mimeType,
int bitrate,
int maxInputSize,
long durationUs,
int channelCount,
int sampleRate,
java.util.List<byte[]> initializationData,
java.lang.String language,
int pcmEncoding) |
static MediaFormat |
createFormatForMimeType(java.lang.String trackId,
java.lang.String mimeType,
int bitrate,
long durationUs) |
static MediaFormat |
createId3Format() |
static MediaFormat |
createImageFormat(java.lang.String trackId,
java.lang.String mimeType,
int bitrate,
long durationUs,
java.util.List<byte[]> initializationData,
java.lang.String language) |
static MediaFormat |
createTextFormat(java.lang.String trackId,
java.lang.String mimeType,
int bitrate,
long durationUs,
java.lang.String language) |
static MediaFormat |
createTextFormat(java.lang.String trackId,
java.lang.String mimeType,
int bitrate,
long durationUs,
java.lang.String language,
long subSampleOffsetUs) |
static MediaFormat |
createVideoFormat(java.lang.String trackId,
java.lang.String mimeType,
int bitrate,
int maxInputSize,
long durationUs,
int width,
int height,
java.util.List<byte[]> initializationData) |
static MediaFormat |
createVideoFormat(java.lang.String trackId,
java.lang.String mimeType,
int bitrate,
int maxInputSize,
long durationUs,
int width,
int height,
java.util.List<byte[]> initializationData,
int rotationDegrees,
float pixelWidthHeightRatio) |
static MediaFormat |
createVideoFormat(java.lang.String trackId,
java.lang.String mimeType,
int bitrate,
int maxInputSize,
long durationUs,
int width,
int height,
java.util.List<byte[]> initializationData,
int rotationDegrees,
float pixelWidthHeightRatio,
byte[] projectionData,
int stereoMode) |
int |
describeContents() |
boolean |
equals(java.lang.Object obj) |
android.media.MediaFormat |
getFrameworkMediaFormatV16() |
int |
hashCode() |
java.lang.String |
toString() |
void |
writeToParcel(android.os.Parcel dest,
int flags) |
public static final long OFFSET_SAMPLE_RELATIVE
subSampleOffsetUs
to indicate that sub-sample timestamps are relative to
the timestamps of their parent samples.public static final java.util.List<byte[]> NO_INITIALIZATION_DATA
@Nullable public final java.lang.String trackId
@NonNull public final java.lang.String mimeType
public final int bitrate
Constants.NO_VALUE
if unknown or not applicable.public final int maxInputSize
Constants.NO_VALUE
if unknown or not applicable.public final long durationUs
Constants.UNKNOWN_TIME_US
if
the duration is unknown, or Constants.MATCH_LONGEST_US
if the
duration should match the duration of the longest track whose duration is known.@NonNull public final java.util.List<byte[]> initializationData
NO_INITIALIZATION_DATA
if there is initialization data.public final boolean adaptive
public final int width
Constants.NO_VALUE
if
unknown or not applicable.public final int height
Constants.NO_VALUE
if
unknown or not applicable.public final int maxWidth
adaptive
, this is the maximum width of the video in pixels
that will be encountered in the stream. Set to Constants.NO_VALUE
if unknown or not applicable.public final int maxHeight
adaptive
, this is the maximum height of the video in pixels
that will be encountered in the stream. Set to Constants.NO_VALUE
if unknown or not applicable.public final float pixelWidthHeightRatio
Constants.NO_VALUE
if unknown or not applicable.public final int stereoMode
public final int rotationDegrees
Constants.NO_VALUE
if unknown or not
applicable.@Nullable public final byte[] projectionData
public final int channelCount
Constants.NO_VALUE
if unknown
or not applicable.public final int sampleRate
Constants.NO_VALUE
if unknown
or not applicable.public final int pcmEncoding
public final int encoderDelay
public final int encoderPadding
@Nullable public final java.lang.String language
public final long subSampleOffsetUs
public static final android.os.Parcelable.Creator<MediaFormat> CREATOR
public static MediaFormat createVideoFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, java.util.List<byte[]> initializationData)
public static MediaFormat createVideoFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, java.util.List<byte[]> initializationData, int rotationDegrees, float pixelWidthHeightRatio)
public static MediaFormat createVideoFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, java.util.List<byte[]> initializationData, int rotationDegrees, float pixelWidthHeightRatio, byte[] projectionData, int stereoMode)
public static MediaFormat createAudioFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, int maxInputSize, long durationUs, int channelCount, int sampleRate, java.util.List<byte[]> initializationData, java.lang.String language)
public static MediaFormat createAudioFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, int maxInputSize, long durationUs, int channelCount, int sampleRate, java.util.List<byte[]> initializationData, java.lang.String language, int pcmEncoding)
public static MediaFormat createTextFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, long durationUs, java.lang.String language)
public static MediaFormat createTextFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, long durationUs, java.lang.String language, long subSampleOffsetUs)
public static MediaFormat createImageFormat(java.lang.String trackId, java.lang.String mimeType, int bitrate, long durationUs, java.util.List<byte[]> initializationData, java.lang.String language)
public static MediaFormat createFormatForMimeType(java.lang.String trackId, java.lang.String mimeType, int bitrate, long durationUs)
public static MediaFormat createId3Format()
public MediaFormat copyWithMaxInputSize(int maxInputSize)
public MediaFormat copyWithMaxVideoDimensions(int maxWidth, int maxHeight)
public MediaFormat copyWithSubSampleOffsetUs(long subSampleOffsetUs)
public MediaFormat copyWithDurationUs(long durationUs)
public MediaFormat copyWithLanguage(java.lang.String language)
public MediaFormat copyWithFixedTrackInfo(java.lang.String trackId, int bitrate, int width, int height, java.lang.String language)
public MediaFormat copyAsAdaptive(java.lang.String trackId)
public MediaFormat copyWithGaplessInfo(int encoderDelay, int encoderPadding)
public final android.media.MediaFormat getFrameworkMediaFormatV16()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int describeContents()
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel dest, int flags)
writeToParcel
in interface android.os.Parcelable