public final class MediaFormat extends Object
Name | Value Type | Description |
---|---|---|
KEY_MIME | String | The type of the format. |
KEY_MAX_INPUT_SIZE | Integer | optional, maximum size of a buffer of input data |
KEY_BIT_RATE | Integer | encoder-only, desired bitrate in bits/second |
Name | Value Type | Description |
---|---|---|
KEY_WIDTH | Integer | |
KEY_HEIGHT | Integer | |
KEY_COLOR_FORMAT | Integer | set by the user for encoders, readable in the output format of decoders |
KEY_FRAME_RATE | Integer or Float | required for encoders, optional for decoders |
KEY_CAPTURE_RATE | Integer | |
KEY_I_FRAME_INTERVAL | Integer (or Float) | encoder-only,
time-interval between key frames.
Float support added in Build.VERSION_CODES.N_MR1 |
KEY_INTRA_REFRESH_PERIOD | Integer | encoder-only, optional |
KEY_MAX_WIDTH | Integer | decoder-only, optional, max-resolution width |
KEY_MAX_HEIGHT | Integer | decoder-only, optional, max-resolution height |
KEY_REPEAT_PREVIOUS_FRAME_AFTER | Long | encoder in surface-mode only, optional |
KEY_PUSH_BLANK_BUFFERS_ON_STOP | Integer(1) | decoder rendering to a surface only, optional |
KEY_TEMPORAL_LAYERING | String | encoder only, optional, temporal-layering schema |
KEY_MAX_WIDTH
and KEY_MAX_HEIGHT
to enable
adaptive playback (seamless resolution change) for a video decoder that
supports it (MediaCodecInfo.CodecCapabilities.FEATURE_AdaptivePlayback
).
The values are used as hints for the codec: they are the maximum expected
resolution to prepare for. Depending on codec support, preparing for larger
maximum resolution may require more memory even if that resolution is never
reached. These fields have no effect for codecs that do not support adaptive
playback.Name | Value Type | Description |
---|---|---|
KEY_CHANNEL_COUNT | Integer | |
KEY_SAMPLE_RATE | Integer | |
KEY_PCM_ENCODING | Integer | optional |
KEY_IS_ADTS | Integer | optional, if decoding AAC audio content, setting this key to 1 indicates that each audio frame is prefixed by the ADTS header. |
KEY_AAC_PROFILE | Integer | encoder-only, optional, if content is AAC audio, specifies the desired profile. |
KEY_AAC_SBR_MODE | Integer | encoder-only, optional, if content is AAC audio, specifies the desired SBR mode. |
KEY_AAC_DRC_TARGET_REFERENCE_LEVEL | Integer | decoder-only, optional, if content is AAC audio, specifies the target reference level. |
KEY_AAC_ENCODED_TARGET_LEVEL | Integer | decoder-only, optional, if content is AAC audio, specifies the target reference level used at encoder. |
KEY_AAC_DRC_BOOST_FACTOR | Integer | decoder-only, optional, if content is AAC audio, specifies the DRC boost factor. |
KEY_AAC_DRC_ATTENUATION_FACTOR | Integer | decoder-only, optional, if content is AAC audio, specifies the DRC attenuation factor. |
KEY_AAC_DRC_HEAVY_COMPRESSION | Integer | decoder-only, optional, if content is AAC audio, specifies whether to use heavy compression. |
KEY_AAC_MAX_OUTPUT_CHANNEL_COUNT | Integer | decoder-only, optional, if content is AAC audio, specifies the maximum number of channels the decoder outputs. |
KEY_CHANNEL_MASK | Integer | optional, a mask of audio channel assignments |
KEY_FLAC_COMPRESSION_LEVEL | Integer | encoder-only, optional, if content is FLAC audio, specifies the desired compression level. |
KEY_MIME | String | The type of the format. |
KEY_LANGUAGE | String | The language of the content. |
Modifier and Type | Class and Description |
---|---|
static interface |
MediaFormat.ColorRange |
static interface |
MediaFormat.ColorStandard |
static interface |
MediaFormat.ColorTransfer |
Modifier and Type | Field and Description |
---|---|
static int |
COLOR_RANGE_FULL
Full range.
|
static int |
COLOR_RANGE_LIMITED
Limited range.
|
static int |
COLOR_STANDARD_BT2020
BT.2020 color chromacity coordinates with KR = 0.2627, KB = 0.0593.
|
static int |
COLOR_STANDARD_BT601_NTSC
BT.601 525 color chromacity coordinates with KR = 0.299, KB = 0.114.
|
static int |
COLOR_STANDARD_BT601_PAL
BT.601 625 color chromacity coordinates with KR = 0.299, KB = 0.114.
|
static int |
COLOR_STANDARD_BT709
BT.709 color chromacity coordinates with KR = 0.2126, KB = 0.0722.
|
static int |
COLOR_TRANSFER_HLG
ARIB STD-B67 hybrid-log-gamma transfer function.
|
static int |
COLOR_TRANSFER_LINEAR
Linear transfer characteristic curve.
|
static int |
COLOR_TRANSFER_SDR_VIDEO
SMPTE 170M transfer characteristic curve used by BT.601/BT.709/BT.2020.
|
static int |
COLOR_TRANSFER_ST2084
SMPTE ST 2084 transfer function.
|
static String |
KEY_AAC_DRC_ATTENUATION_FACTOR
A key describing the attenuation factor allowing to adapt the dynamics of the output to the
actual listening requirements.
|
static String |
KEY_AAC_DRC_BOOST_FACTOR
A key describing the boost factor allowing to adapt the dynamics of the output to the
actual listening requirements.
|
static String |
KEY_AAC_DRC_HEAVY_COMPRESSION
A key describing the selection of the heavy compression profile for DRC.
|
static String |
KEY_AAC_DRC_TARGET_REFERENCE_LEVEL
A key describing a gain to be applied so that the output loudness matches the
Target Reference Level.
|
static String |
KEY_AAC_ENCODED_TARGET_LEVEL
A key describing the target reference level that was assumed at the encoder for
calculation of attenuation gains for clipping prevention.
|
static String |
KEY_AAC_MAX_OUTPUT_CHANNEL_COUNT
A key describing the maximum number of channels that can be output by the AAC decoder.
|
static String |
KEY_AAC_PROFILE
A key describing the AAC profile to be used (AAC audio formats only).
|
static String |
KEY_AAC_SBR_MODE
A key describing the AAC SBR mode to be used (AAC audio formats only).
|
static String |
KEY_AUDIO_SESSION_ID
A key describing the audio session ID of the AudioTrack associated
to a tunneled video codec.
|
static String |
KEY_BIT_RATE
A key describing the average bitrate in bits/sec.
|
static String |
KEY_BITRATE_MODE
A key describing the desired bitrate mode to be used by an encoder.
|
static String |
KEY_CAPTURE_RATE
A key describing the capture rate of a video format in frames/sec.
|
static String |
KEY_CHANNEL_COUNT
A key describing the number of channels in an audio format.
|
static String |
KEY_CHANNEL_MASK
A key describing the channel composition of audio content.
|
static String |
KEY_COLOR_FORMAT
A key describing the color format of the content in a video format.
|
static String |
KEY_COLOR_RANGE
An optional key describing the range of the component values of the video content.
|
static String |
KEY_COLOR_STANDARD
An optional key describing the color primaries, white point and
luminance factors for video content.
|
static String |
KEY_COLOR_TRANSFER
An optional key describing the opto-electronic transfer function used
for the video content.
|
static String |
KEY_COMPLEXITY
A key describing the encoding complexity.
|
static String |
KEY_DURATION
A key describing the duration (in microseconds) of the content.
|
static String |
KEY_FEATURE_
A key prefix used together with a
MediaCodecInfo.CodecCapabilities
feature name describing a required or optional feature for a codec capabilities
query. |
static String |
KEY_FLAC_COMPRESSION_LEVEL
A key describing the FLAC compression level to be used (FLAC audio format only).
|
static String |
KEY_FRAME_RATE
A key describing the frame rate of a video format in frames/sec.
|
static String |
KEY_HDR_STATIC_INFO
An optional key describing the static metadata of HDR (high-dynamic-range) video content.
|
static String |
KEY_HEIGHT
A key describing the height of the content in a video format.
|
static String |
KEY_I_FRAME_INTERVAL
A key describing the frequency of key frames expressed in seconds between key frames.
|
static String |
KEY_INTRA_REFRESH_PERIOD
An optional key describing the period of intra refresh in frames.
|
static String |
KEY_IS_ADTS
A key mapping to a value of 1 if the content is AAC audio and
audio frames are prefixed with an ADTS header.
|
static String |
KEY_IS_AUTOSELECT
A key for boolean AUTOSELECT behavior for the track.
|
static String |
KEY_IS_DEFAULT
A key for boolean DEFAULT behavior for the track.
|
static String |
KEY_IS_FORCED_SUBTITLE
A key for the FORCED field for subtitle tracks.
|
static String |
KEY_IS_TIMED_TEXT |
static String |
KEY_LANGUAGE
A key describing the language of the content, using either ISO 639-1
or 639-2/T codes.
|
static String |
KEY_LEVEL
A key describing the desired profile to be used by an encoder.
|
static String |
KEY_MAX_BIT_RATE
A key describing the max bitrate in bits/sec.
|
static String |
KEY_MAX_HEIGHT
A key describing the maximum expected height of the content in a video
decoder format, in case there are resolution changes in the video content.
|
static String |
KEY_MAX_INPUT_SIZE
A key describing the maximum size in bytes of a buffer of data
described by this MediaFormat.
|
static String |
KEY_MAX_WIDTH
A key describing the maximum expected width of the content in a video
decoder format, in case there are resolution changes in the video content.
|
static String |
KEY_MIME
A key describing the mime type of the MediaFormat.
|
static String |
KEY_OPERATING_RATE
A key describing the desired operating frame rate for video or sample rate for audio
that the codec will need to operate at.
|
static String |
KEY_PCM_ENCODING
A key describing the raw audio sample encoding/format.
|
static String |
KEY_PRIORITY
A key describing the desired codec priority.
|
static String |
KEY_PROFILE
A key describing the desired profile to be used by an encoder.
|
static String |
KEY_PUSH_BLANK_BUFFERS_ON_STOP
If specified when configuring a video decoder rendering to a surface,
causes the decoder to output "blank", i.e. black frames to the surface
when stopped to clear out any previously displayed contents.
|
static String |
KEY_QUALITY
A key describing the desired encoding quality.
|
static String |
KEY_REPEAT_PREVIOUS_FRAME_AFTER
Applies only when configuring a video encoder in "surface-input" mode.
|
static String |
KEY_ROTATION
A key describing the desired clockwise rotation on an output surface.
|
static String |
KEY_SAMPLE_RATE
A key describing the sample rate of an audio format.
|
static String |
KEY_SLICE_HEIGHT
A key describing the plane height of a multi-planar (YUV) video bytebuffer layout.
|
static String |
KEY_STRIDE
A key describing the stride of the video bytebuffer layout.
|
static String |
KEY_TEMPORAL_LAYERING
A key describing the temporal layering schema.
|
static String |
KEY_TRACK_ID
A key describing a unique ID for the content of a media track.
|
static String |
KEY_WIDTH
A key describing the width of the content in a video format.
|
static String |
MIMETYPE_AUDIO_AAC |
static String |
MIMETYPE_AUDIO_AC3 |
static String |
MIMETYPE_AUDIO_AMR_NB |
static String |
MIMETYPE_AUDIO_AMR_WB |
static String |
MIMETYPE_AUDIO_EAC3 |
static String |
MIMETYPE_AUDIO_FLAC |
static String |
MIMETYPE_AUDIO_G711_ALAW |
static String |
MIMETYPE_AUDIO_G711_MLAW |
static String |
MIMETYPE_AUDIO_MPEG |
static String |
MIMETYPE_AUDIO_MSGSM |
static String |
MIMETYPE_AUDIO_OPUS |
static String |
MIMETYPE_AUDIO_QCELP |
static String |
MIMETYPE_AUDIO_RAW |
static String |
MIMETYPE_AUDIO_VORBIS |
static String |
MIMETYPE_TEXT_CEA_608
MIME type for CEA-608 closed caption data.
|
static String |
MIMETYPE_TEXT_VTT
MIME type for WebVTT subtitle data.
|
static String |
MIMETYPE_VIDEO_AVC |
static String |
MIMETYPE_VIDEO_DOLBY_VISION |
static String |
MIMETYPE_VIDEO_H263 |
static String |
MIMETYPE_VIDEO_HEVC |
static String |
MIMETYPE_VIDEO_MPEG2 |
static String |
MIMETYPE_VIDEO_MPEG4 |
static String |
MIMETYPE_VIDEO_RAW |
static String |
MIMETYPE_VIDEO_VP8 |
static String |
MIMETYPE_VIDEO_VP9 |
Constructor and Description |
---|
MediaFormat()
Creates an empty MediaFormat
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(String name)
Returns true iff a key of the given name exists in the format.
|
static MediaFormat |
createAudioFormat(String mime,
int sampleRate,
int channelCount)
Creates a minimal audio format.
|
static MediaFormat |
createSubtitleFormat(String mime,
String language)
Creates a minimal subtitle format.
|
static MediaFormat |
createVideoFormat(String mime,
int width,
int height)
Creates a minimal video format.
|
ByteBuffer |
getByteBuffer(String name)
Returns the value of a ByteBuffer key.
|
boolean |
getFeatureEnabled(String feature)
Returns whether a feature is to be enabled (
true ) or disabled
(false ). |
float |
getFloat(String name)
Returns the value of a float key.
|
int |
getInteger(String name)
Returns the value of an integer key.
|
int |
getInteger(String name,
int defaultValue)
Returns the value of an integer key, or the default value if the
key is missing or is for another type value.
|
long |
getLong(String name)
Returns the value of a long key.
|
String |
getString(String name)
Returns the value of a string key.
|
void |
setByteBuffer(String name,
ByteBuffer bytes)
Sets the value of a ByteBuffer key.
|
void |
setFeatureEnabled(String feature,
boolean enabled)
Sets whether a feature is to be enabled (
true ) or disabled
(false ). |
void |
setFloat(String name,
float value)
Sets the value of a float key.
|
void |
setInteger(String name,
int value)
Sets the value of an integer key.
|
void |
setLong(String name,
long value)
Sets the value of a long key.
|
void |
setString(String name,
String value)
Sets the value of a string key.
|
String |
toString()
Returns a string representation of the object.
|
public static final String MIMETYPE_VIDEO_VP8
public static final String MIMETYPE_VIDEO_VP9
public static final String MIMETYPE_VIDEO_AVC
public static final String MIMETYPE_VIDEO_HEVC
public static final String MIMETYPE_VIDEO_MPEG4
public static final String MIMETYPE_VIDEO_H263
public static final String MIMETYPE_VIDEO_MPEG2
public static final String MIMETYPE_VIDEO_RAW
public static final String MIMETYPE_AUDIO_AMR_NB
public static final String MIMETYPE_AUDIO_AMR_WB
public static final String MIMETYPE_AUDIO_MPEG
public static final String MIMETYPE_AUDIO_AAC
public static final String MIMETYPE_AUDIO_QCELP
public static final String MIMETYPE_AUDIO_VORBIS
public static final String MIMETYPE_AUDIO_OPUS
public static final String MIMETYPE_AUDIO_G711_ALAW
public static final String MIMETYPE_AUDIO_G711_MLAW
public static final String MIMETYPE_AUDIO_RAW
public static final String MIMETYPE_AUDIO_FLAC
public static final String MIMETYPE_AUDIO_MSGSM
public static final String MIMETYPE_AUDIO_AC3
public static final String MIMETYPE_AUDIO_EAC3
public static final String MIMETYPE_VIDEO_DOLBY_VISION
public static final String MIMETYPE_TEXT_VTT
public static final String MIMETYPE_TEXT_CEA_608
public static final String KEY_MIME
public static final String KEY_LANGUAGE
public static final String KEY_SAMPLE_RATE
public static final String KEY_CHANNEL_COUNT
public static final String KEY_WIDTH
public static final String KEY_HEIGHT
public static final String KEY_MAX_WIDTH
public static final String KEY_MAX_HEIGHT
public static final String KEY_MAX_INPUT_SIZE
public static final String KEY_BIT_RATE
public static final String KEY_MAX_BIT_RATE
public static final String KEY_COLOR_FORMAT
MediaCodecInfo.CodecCapabilities
.public static final String KEY_FRAME_RATE
MediaExtractor
provides an integer
value corresponding to the frame rate information of the track if specified and non-zero.
Otherwise, this key is not present. MediaCodec
accepts both
float and integer values. This represents the desired operating frame rate if the
KEY_OPERATING_RATE
is not present and KEY_PRIORITY
is 0
(realtime). For video encoders this value corresponds to the intended frame rate,
although encoders are expected
to support variable frame rate based on buffer timestamp
. This key is not used in the MediaCodec
input
/output
formats,
nor by MediaMuxer
.public static final String KEY_PCM_ENCODING
The associated value is an integer, using one of the
AudioFormat
.ENCODING_PCM_ values.
This is an optional key for audio decoders and encoders specifying the
desired raw audio sample format during MediaCodec.configure(…)
call. Use MediaCodec.getInput
/OutputFormat(…)
to confirm the actual format. For the PCM decoder this key specifies both
input and output sample encodings.
This key is also used by MediaExtractor
to specify the sample
format of audio data, if it is specified.
If this key is missing, the raw audio sample format is signed 16-bit short.
public static final String KEY_CAPTURE_RATE
When capture rate is different than the frame rate, it means that the video is acquired at a different rate than the playback, which produces slow motion or timelapse effect during playback. Application can use the value of this key to tell the relative speed ratio between capture and playback rates when the video was recorded.
The associated value is an integer or a float.
public static final String KEY_I_FRAME_INTERVAL
This key is used by video encoders. A negative value means no key frames are requested after the first frame. A zero value means a stream containing all key frames is requested.
Most video encoders will convert this value of the number of non-key-frames between key-frames, using the frame rate information; therefore, if the actual frame rate differs (e.g. input frames are dropped or the frame rate changes), the time interval between key frames will not be the configured value.
The associated value is an integer (or float since
Build.VERSION_CODES.N_MR1
).
public static final String KEY_INTRA_REFRESH_PERIOD
MediaCodecInfo.CodecCapabilities.FEATURE_IntraRefresh
), the whole
frame is completely refreshed after the specified period. Also for each frame,
a fix subset of macroblocks must be intra coded which leads to more constant bitrate
than inserting a key frame. This key is recommended for video streaming applications
as it provides low-delay and good error-resilience. This key is ignored if the
video encoder does not support the intra refresh feature. Use the output format to
verify that this feature was enabled.
The associated value is an integer.public static final String KEY_TEMPORAL_LAYERING
MediaCodec.getOutputFormat()
after configure
to query if the encoder supports
the desired schema. Supported values are webrtc.vp8.N-layer
,
android.generic.N
, android.generic.N+M
and none
, where
N
denotes the total number of non-bidirectional layers (which must be at least 1)
and M
denotes the total number of bidirectional layers (which must be non-negative).
android.generic.*
schemas have been added in Build.VERSION_CODES.N_MR1
.
The encoder may support fewer temporal layers, in which case the output format will contain the configured schema. If the encoder does not support temporal layering, the output format will not have an entry with this key. The associated value is a string.
public static final String KEY_STRIDE
public static final String KEY_SLICE_HEIGHT
public static final String KEY_REPEAT_PREVIOUS_FRAME_AFTER
public static final String KEY_PUSH_BLANK_BUFFERS_ON_STOP
public static final String KEY_DURATION
public static final String KEY_IS_ADTS
public static final String KEY_CHANNEL_MASK
AudioFormat
.
The associated value is an integer.public static final String KEY_AAC_PROFILE
MediaCodecInfo.CodecProfileLevel
.public static final String KEY_AAC_SBR_MODE
This key is only used during encoding.
public static final String KEY_AAC_MAX_OUTPUT_CHANNEL_COUNT
Values larger than the number of channels in the content to decode are ignored.
This key is only used during decoding.
public static final String KEY_AAC_DRC_TARGET_REFERENCE_LEVEL
The value is given as an integer value between 0 and 127, and is calculated as -0.25 * Target Reference Level in dBFS. Therefore, it represents the range of Full Scale (0 dBFS) to -31.75 dBFS.
This key is only used during decoding.
public static final String KEY_AAC_ENCODED_TARGET_LEVEL
The value is given as an integer value between 0 and 127, and is calculated as -0.25 * Target Reference Level in dBFS. Therefore, it represents the range of Full Scale (0 dBFS) to -31.75 dBFS. The default value is the worst-case assumption of 127.
The value is ignored when heavy compression is used (see
KEY_AAC_DRC_HEAVY_COMPRESSION
).
This key is only used during decoding.
public static final String KEY_AAC_DRC_BOOST_FACTOR
Positive gains (boost) and negative gains (attenuation, see
KEY_AAC_DRC_ATTENUATION_FACTOR
) can be controlled separately for a better match
to different use-cases.
Typically, attenuation gains are sent for loud signal segments, and boost gains are sent for soft signal segments. If the output is listened to in a noisy environment, for example, the boost factor is used to enable the positive gains, i.e. to amplify soft signal segments beyond the noise floor. But for listening late at night, the attenuation factor is used to enable the negative gains, to prevent loud signal from surprising the listener. In applications which generally need a low dynamic range, both the boost factor and the attenuation factor are used in order to enable all DRC gains.
In order to prevent clipping, it is also recommended to apply the attenuation factors in case of a downmix and/or loudness normalization to high target reference levels.
Both the boost and the attenuation factor parameters are given as integer values between 0 and 127, representing the range of the factor of 0 (i.e. don't apply) to 1 (i.e. fully apply boost/attenuation factors respectively).
This key is only used during decoding.
public static final String KEY_AAC_DRC_ATTENUATION_FACTOR
KEY_AAC_DRC_BOOST_FACTOR
for a description of the role of this attenuation
factor and the value range.
This key is only used during decoding.
public static final String KEY_AAC_DRC_HEAVY_COMPRESSION
KEY_AAC_DRC_BOOST_FACTOR
and KEY_AAC_DRC_ATTENUATION_FACTOR
for the
boost and attenuation factors, and frequency-selective (multiband) DRC.
Light compression usually contains clipping prevention for stereo downmixing while heavy
compression, if additionally provided in the bitstream, is usually stronger, and contains
clipping prevention for stereo and mono downmixing.
The default is light compression.
This key is only used during decoding.
public static final String KEY_FLAC_COMPRESSION_LEVEL
public static final String KEY_COMPLEXITY
public static final String KEY_QUALITY
public static final String KEY_PRIORITY
The associated value is an integer. Higher value means lower priority.
Currently, only two levels are supported:
0: realtime priority - meaning that the codec shall support the given
performance configuration (e.g. framerate) at realtime. This should
only be used by media playback, capture, and possibly by realtime
communication scenarios if best effort performance is not suitable.
1: non-realtime priority (best effort).
This is a hint used at codec configuration and resource planning - to understand the realtime requirements of the application; however, due to the nature of media components, performance is not guaranteed.
public static final String KEY_OPERATING_RATE
The associated value is an integer or a float representing frames-per-second or samples-per-second
This is used for cases like high-speed/slow-motion video capture, where the video encoder format contains the target playback rate (e.g. 30fps), but the component must be able to handle the high operating capture rate (e.g. 240fps).
This rate will be used by codec for resource planning and setting the operating points.
public static final String KEY_PROFILE
MediaCodecInfo.CodecProfileLevel
.
This key is used as a hint, and is only supported for codecs
that specify a profile. Note: Codecs are free to use all the available
coding tools at the specified profile.public static final String KEY_LEVEL
MediaCodecInfo.CodecProfileLevel
.
This key is used as a further hint when specifying a desired profile,
and is only supported for codecs that specify a level.
This key is ignored if the profile
is not specified.
public static final String KEY_ROTATION
public static final String KEY_BITRATE_MODE
MediaCodecInfo.CodecCapabilities
.public static final String KEY_AUDIO_SESSION_ID
public static final String KEY_IS_AUTOSELECT
public static final String KEY_IS_DEFAULT
public static final String KEY_IS_FORCED_SUBTITLE
public static final String KEY_IS_TIMED_TEXT
public static final String KEY_COLOR_STANDARD
public static final int COLOR_STANDARD_BT709
public static final int COLOR_STANDARD_BT601_PAL
public static final int COLOR_STANDARD_BT601_NTSC
public static final int COLOR_STANDARD_BT2020
public static final String KEY_COLOR_TRANSFER
public static final int COLOR_TRANSFER_LINEAR
public static final int COLOR_TRANSFER_SDR_VIDEO
public static final int COLOR_TRANSFER_ST2084
public static final int COLOR_TRANSFER_HLG
public static final String KEY_COLOR_RANGE
public static final int COLOR_RANGE_LIMITED
public static final int COLOR_RANGE_FULL
public static final String KEY_HDR_STATIC_INFO
public static final String KEY_TRACK_ID
This key is used by MediaExtractor
. Some extractors provide multiple encodings
of the same track (e.g. float audio tracks for FLAC and WAV may be expressed as two
tracks via MediaExtractor: a normal PCM track for backward compatibility, and a float PCM
track for added fidelity. Similarly, Dolby Vision extractor may provide a baseline SDR
version of a DV track.) This key can be used to identify which MediaExtractor tracks refer
to the same underlying content.
public static final String KEY_FEATURE_
MediaCodecInfo.CodecCapabilities
feature name describing a required or optional feature for a codec capabilities
query.
The associated value is an integer, where non-0 value means the feature is
requested to be present, while 0 value means the feature is requested to be not
present.public final boolean containsKey(String name)
public final int getInteger(String name)
public final int getInteger(String name, int defaultValue)
public final long getLong(String name)
public final float getFloat(String name)
public final ByteBuffer getByteBuffer(String name)
public boolean getFeatureEnabled(String feature)
true
) or disabled
(false
).feature
- the name of a MediaCodecInfo.CodecCapabilities
feature.IllegalArgumentException
- if the feature was neither set to be enabled
nor to be disabled.public final void setInteger(String name, int value)
public final void setLong(String name, long value)
public final void setFloat(String name, float value)
public final void setByteBuffer(String name, ByteBuffer bytes)
public void setFeatureEnabled(String feature, boolean enabled)
true
) or disabled
(false
).
If enabled
is true
, the feature is requested to be present.
Otherwise, the feature is requested to be not present.feature
- the name of a MediaCodecInfo.CodecCapabilities
feature.MediaCodecList.findDecoderForFormat(android.media.MediaFormat)
,
MediaCodecList.findEncoderForFormat(android.media.MediaFormat)
,
MediaCodecInfo.CodecCapabilities.isFormatSupported(android.media.MediaFormat)
public static final MediaFormat createAudioFormat(String mime, int sampleRate, int channelCount)
mime
- The mime type of the content.sampleRate
- The sampling rate of the content.channelCount
- The number of audio channels in the content.public static final MediaFormat createSubtitleFormat(String mime, String language)
mime
- The mime type of the content.language
- The language of the content, using either ISO 639-1 or 639-2/T
codes. Specify null or "und" if language information is only included
in the content. (This will also work if there are multiple language
tracks in the content.)public static final MediaFormat createVideoFormat(String mime, int width, int height)
mime
- The mime type of the content.width
- The width of the content (in pixels)height
- The height of the content (in pixels)public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())