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 | encoder-only |
KEY_FRAME_RATE | Integer or Float | encoder-only |
KEY_I_FRAME_INTERVAL | Integer | encoder-only |
Name | Value Type | Description |
---|---|---|
KEY_CHANNEL_COUNT | Integer | |
KEY_SAMPLE_RATE | Integer | |
KEY_IS_ADTS | Integer | optional, if content is AAC audio, 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_CHANNEL_MASK | Integer | A mask of audio channel assignments |
KEY_FLAC_COMPRESSION_LEVEL | Integer | encoder-only, optional, if content is FLAC audio, specifies the desired compression level. |
Modifier and Type | Field and Description |
---|---|
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_MAX_INPUT_SIZE
A key describing the maximum size in bytes of a buffer of data
described by this MediaFormat.
|
static String |
KEY_MIME
A key describing the mime type of the MediaFormat.
|
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_WIDTH
A key describing the width of the content in a video format.
|
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 |
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.
|
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()
Returns a string containing a concise, human-readable description of this
object.
|
public static final String KEY_MIME
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_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_STRIDE
public static final String KEY_SLICE_HEIGHT
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.CodecCapabilities
.public static final String KEY_FLAC_COMPRESSION_LEVEL
public final boolean containsKey(String name)
public final int getInteger(String name)
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 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
getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString
method
if you intend implementing your own toString
method.