public final class MediaFormat extends Object
KEY_MAX_WIDTH and KEY_MAX_HEIGHT to enable
adaptive playback (seamless resolution change) for a video decoder that
supports it
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.| 限定符和类型 | 字段和说明 |
|---|---|
static String |
KEY_AAC_PROFILE
A key describing the AAC profile to be used (AAC audio formats only).
|
static String |
KEY_BIT_RATE
A key describing the bitrate in bits/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_DURATION
A key describing the duration (in microseconds) of the content.
|
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_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 I frames expressed in secs
between I 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_LANGUAGE
A key describing the language of the content, using either ISO 639-1
or 639-2/T codes.
|
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_PATH
A key describing the external subtitle path
|
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_REPEAT_PREVIOUS_FRAME_AFTER
Applies only when configuring a video encoder in "surface-input" mode.
|
static String |
KEY_SAMPLE_RATE
A key describing the sample rate of an audio format.
|
static String |
KEY_SLICE_HEIGHT |
static String |
KEY_STRIDE |
static String |
KEY_TITLE
A key describing the title of the content
|
static String |
KEY_WIDTH
A key describing the width of the content in a video format.
|
| 构造器和说明 |
|---|
MediaFormat()
Creates an empty MediaFormat
|
| 限定符和类型 | 方法和说明 |
|---|---|
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 title,
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.
|
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 |
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() |
public static final String KEY_MIME
public static final String KEY_LANGUAGE
public static final String KEY_TITLE
public static final String KEY_PATH
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_COLOR_FORMAT
MediaCodecInfo.CodecCapabilities.public static final String KEY_FRAME_RATE
public static final String KEY_I_FRAME_INTERVAL
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_FLAC_COMPRESSION_LEVEL
public static final String KEY_IS_AUTOSELECT
public static final String KEY_IS_DEFAULT
public static final String KEY_IS_FORCED_SUBTITLE
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 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 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 title, String language)
title - The content of the Subtitlelanguage - 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)