public final class MediaFormat extends Object implements Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
boolean |
adaptive
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
NO_VALUE if unknown or not applicable. |
int |
channelCount
The number of audio channels, or
NO_VALUE if unknown or not applicable. |
static Parcelable.Creator<MediaFormat> |
CREATOR |
long |
durationUs
The duration in microseconds, or
C.UNKNOWN_TIME_US if the duration is unknown, or
C.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
NO_VALUE if unknown or not applicable. |
List<byte[]> |
initializationData
Initialization data that must be provided to the decoder.
|
String |
language
The language of the track, or null if unknown or not applicable.
|
int |
maxHeight
For formats that belong to an adaptive video track (either describing the track, or describing
a specific format within it), 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
NO_VALUE
if unknown or not applicable. |
int |
maxWidth
For formats that belong to an adaptive video track (either describing the track, or describing
a specific format within it), this is the maximum width of the video in pixels that will be
encountered in the stream.
|
String |
mimeType
The mime type of the format.
|
static int |
NO_VALUE |
static long |
OFFSET_SAMPLE_RELATIVE
A value for
subsampleOffsetUs to indicate that subsample 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
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
NO_VALUE if unknown or not applicable. |
int |
sampleRate
The audio sampling rate in Hz, or
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 subsamples, this is an offset that should be added to subsample
timestamps.
|
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
NO_VALUE if unknown or not applicable. |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Modifier and Type | Method and Description |
---|---|
MediaFormat |
copyAsAdaptive(String trackId) |
MediaFormat |
copyWithDurationUs(long durationUs) |
MediaFormat |
copyWithFixedTrackInfo(String trackId,
int bitrate,
int width,
int height,
String language) |
MediaFormat |
copyWithGaplessInfo(int encoderDelay,
int encoderPadding) |
MediaFormat |
copyWithLanguage(String language) |
MediaFormat |
copyWithMaxInputSize(int maxInputSize) |
MediaFormat |
copyWithMaxVideoDimensions(int maxWidth,
int maxHeight) |
MediaFormat |
copyWithSubsampleOffsetUs(long subsampleOffsetUs) |
static MediaFormat |
createAudioFormat(String trackId,
String mimeType,
int bitrate,
int maxInputSize,
long durationUs,
int channelCount,
int sampleRate,
List<byte[]> initializationData,
String language) |
static MediaFormat |
createAudioFormat(String trackId,
String mimeType,
int bitrate,
int maxInputSize,
long durationUs,
int channelCount,
int sampleRate,
List<byte[]> initializationData,
String language,
int pcmEncoding) |
static MediaFormat |
createFormatForMimeType(String trackId,
String mimeType,
int bitrate,
long durationUs) |
static MediaFormat |
createId3Format() |
static MediaFormat |
createImageFormat(String trackId,
String mimeType,
int bitrate,
long durationUs,
List<byte[]> initializationData,
String language) |
static MediaFormat |
createTextFormat(String trackId,
String mimeType,
int bitrate,
long durationUs,
String language) |
static MediaFormat |
createTextFormat(String trackId,
String mimeType,
int bitrate,
long durationUs,
String language,
long subsampleOffsetUs) |
static MediaFormat |
createVideoFormat(String trackId,
String mimeType,
int bitrate,
int maxInputSize,
long durationUs,
int width,
int height,
List<byte[]> initializationData) |
static MediaFormat |
createVideoFormat(String trackId,
String mimeType,
int bitrate,
int maxInputSize,
long durationUs,
int width,
int height,
List<byte[]> initializationData,
int rotationDegrees,
float pixelWidthHeightRatio) |
static MediaFormat |
createVideoFormat(String trackId,
String mimeType,
int bitrate,
int maxInputSize,
long durationUs,
int width,
int height,
List<byte[]> initializationData,
int rotationDegrees,
float pixelWidthHeightRatio,
byte[] projectionData,
int stereoMode) |
int |
describeContents() |
boolean |
equals(Object obj) |
MediaFormat |
getFrameworkMediaFormatV16() |
int |
hashCode() |
String |
toString() |
void |
writeToParcel(Parcel dest,
int flags) |
public static final int NO_VALUE
public static final long OFFSET_SAMPLE_RELATIVE
subsampleOffsetUs
to indicate that subsample timestamps are relative to
the timestamps of their parent samples.public final String trackId
public final String mimeType
public final int bitrate
NO_VALUE
if unknown or not applicable.public final int maxInputSize
NO_VALUE
if unknown or not applicable.public final long durationUs
C.UNKNOWN_TIME_US
if the duration is unknown, or
C.MATCH_LONGEST_US
if the duration should match the duration of the longest track whose
duration is known.public final List<byte[]> initializationData
public final boolean adaptive
public final int width
NO_VALUE
if unknown or not applicable.public final int height
NO_VALUE
if unknown or not applicable.public final int maxWidth
NO_VALUE
if unknown or not applicable.public final int maxHeight
NO_VALUE
if unknown or not applicable.public final int rotationDegrees
NO_VALUE
if unknown or not applicable. Only 0, 90, 180 and 270 are
supported.public final float pixelWidthHeightRatio
NO_VALUE
if unknown or not
applicable.public final int stereoMode
NO_VALUE
if not applicable. Valid stereo
modes are C.STEREO_MODE_MONO
, C.STEREO_MODE_TOP_BOTTOM
, C.STEREO_MODE_LEFT_RIGHT
.public final byte[] projectionData
public final int channelCount
NO_VALUE
if unknown or not applicable.public final int sampleRate
NO_VALUE
if unknown or not applicable.public final int pcmEncoding
mimeType
is MimeTypes.AUDIO_RAW
then
one of C.ENCODING_PCM_8BIT
, C.ENCODING_PCM_16BIT
, C.ENCODING_PCM_24BIT
and C.ENCODING_PCM_32BIT
. Set to NO_VALUE
for other media types.public final int encoderDelay
public final int encoderPadding
public final String language
public final long subsampleOffsetUs
OFFSET_SAMPLE_RELATIVE
indicates that subsample timestamps are
relative to the timestamps of their parent samples.public static final Parcelable.Creator<MediaFormat> CREATOR
public static MediaFormat createVideoFormat(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, List<byte[]> initializationData)
public static MediaFormat createVideoFormat(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, List<byte[]> initializationData, int rotationDegrees, float pixelWidthHeightRatio)
public static MediaFormat createVideoFormat(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int width, int height, List<byte[]> initializationData, int rotationDegrees, float pixelWidthHeightRatio, byte[] projectionData, int stereoMode)
public static MediaFormat createAudioFormat(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int channelCount, int sampleRate, List<byte[]> initializationData, String language)
public static MediaFormat createAudioFormat(String trackId, String mimeType, int bitrate, int maxInputSize, long durationUs, int channelCount, int sampleRate, List<byte[]> initializationData, String language, int pcmEncoding)
public static MediaFormat createTextFormat(String trackId, String mimeType, int bitrate, long durationUs, String language)
public static MediaFormat createTextFormat(String trackId, String mimeType, int bitrate, long durationUs, String language, long subsampleOffsetUs)
public static MediaFormat createImageFormat(String trackId, String mimeType, int bitrate, long durationUs, List<byte[]> initializationData, String language)
public static MediaFormat createFormatForMimeType(String trackId, 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(String language)
public MediaFormat copyWithFixedTrackInfo(String trackId, int bitrate, int width, int height, String language)
public MediaFormat copyAsAdaptive(String trackId)
public MediaFormat copyWithGaplessInfo(int encoderDelay, int encoderPadding)
public final MediaFormat getFrameworkMediaFormatV16()
MediaFormat
representation of this format.public int describeContents()
describeContents
in interface Parcelable
public void writeToParcel(Parcel dest, int flags)
writeToParcel
in interface Parcelable