public final class MediaCodecInfo
extends java.lang.Object
MediaCodec for a given mime type.| Modifier and Type | Field and Description |
|---|---|
boolean |
adaptive
Whether the decoder supports seamless resolution switches.
|
android.media.MediaCodecInfo.CodecCapabilities |
capabilities
The capabilities of the decoder, like the profiles/levels it supports, or
null if this
is a passthrough codec. |
static int |
MAX_SUPPORTED_INSTANCES_UNKNOWN
The value returned by
getMaxSupportedInstances() if the upper bound on the maximum
number of supported instances is unknown. |
java.lang.String |
mimeType
The MIME type handled by the codec, or
null if this is a passthrough codec. |
java.lang.String |
name
The name of the decoder.
|
boolean |
passthrough
Whether this instance describes a passthrough codec.
|
boolean |
secure
Whether the decoder is secure.
|
static java.lang.String |
TAG |
boolean |
tunneling
Whether the decoder supports tunneling.
|
| Modifier and Type | Method and Description |
|---|---|
android.graphics.Point |
alignVideoSizeV21(int width,
int height)
Returns the smallest video size greater than or equal to a specified size that also satisfies
the
MediaCodec's width and height alignment requirements. |
int |
getMaxSupportedInstances()
Returns an upper bound on the maximum number of supported instances, or
MAX_SUPPORTED_INSTANCES_UNKNOWN if unknown. |
android.media.MediaCodecInfo.CodecProfileLevel[] |
getProfileLevels()
The profile levels supported by the decoder.
|
boolean |
isAudioChannelCountSupportedV21(int channelCount)
Whether the decoder supports audio with a given channel count.
|
boolean |
isAudioSampleRateSupportedV21(int sampleRate)
Whether the decoder supports audio with a given sample rate.
|
boolean |
isCodecSupported(java.lang.String codec)
Whether the decoder supports the given
codec. |
boolean |
isFormatSupported(Format format)
Returns whether the decoder may support decoding the given
format. |
boolean |
isSeamlessAdaptationSupported(Format format)
Returns whether it may be possible to adapt to playing a different format when the codec is
configured to play media in the specified
format. |
boolean |
isSeamlessAdaptationSupported(Format oldFormat,
Format newFormat,
boolean isNewFormatComplete)
Returns whether it is possible to adapt the decoder seamlessly from
oldFormat to newFormat. |
boolean |
isVideoSizeAndRateSupportedV21(int width,
int height,
double frameRate)
Whether the decoder supports video with a given width, height and frame rate.
|
static MediaCodecInfo |
newInstance(java.lang.String name,
java.lang.String mimeType,
android.media.MediaCodecInfo.CodecCapabilities capabilities)
Creates an instance.
|
static MediaCodecInfo |
newInstance(java.lang.String name,
java.lang.String mimeType,
android.media.MediaCodecInfo.CodecCapabilities capabilities,
boolean forceDisableAdaptive,
boolean forceSecure)
Creates an instance.
|
static MediaCodecInfo |
newPassthroughInstance(java.lang.String name)
Creates an instance representing an audio passthrough decoder.
|
java.lang.String |
toString() |
public static final java.lang.String TAG
public static final int MAX_SUPPORTED_INSTANCES_UNKNOWN
getMaxSupportedInstances() if the upper bound on the maximum
number of supported instances is unknown.public final java.lang.String name
May be passed to MediaCodec.createByCodecName(String) to create an instance of the
decoder.
@Nullable public final java.lang.String mimeType
null if this is a passthrough codec.@Nullable public final android.media.MediaCodecInfo.CodecCapabilities capabilities
null if this
is a passthrough codec.public final boolean adaptive
MediaCodecInfo.CodecCapabilities.isFeatureSupported(String),
MediaCodecInfo.CodecCapabilities.FEATURE_AdaptivePlaybackpublic final boolean tunneling
MediaCodecInfo.CodecCapabilities.isFeatureSupported(String),
MediaCodecInfo.CodecCapabilities.FEATURE_TunneledPlaybackpublic final boolean secure
MediaCodecInfo.CodecCapabilities.isFeatureSupported(String),
MediaCodecInfo.CodecCapabilities.FEATURE_SecurePlaybackpublic final boolean passthrough
public static MediaCodecInfo newPassthroughInstance(java.lang.String name)
name - The name of the MediaCodec.public static MediaCodecInfo newInstance(java.lang.String name, java.lang.String mimeType, android.media.MediaCodecInfo.CodecCapabilities capabilities)
name - The name of the MediaCodec.mimeType - A mime type supported by the MediaCodec.capabilities - The capabilities of the MediaCodec for the specified mime type.public static MediaCodecInfo newInstance(java.lang.String name, java.lang.String mimeType, android.media.MediaCodecInfo.CodecCapabilities capabilities, boolean forceDisableAdaptive, boolean forceSecure)
name - The name of the MediaCodec.mimeType - A mime type supported by the MediaCodec.capabilities - The capabilities of the MediaCodec for the specified mime type.forceDisableAdaptive - Whether adaptive should be forced to false.forceSecure - Whether secure should be forced to true.public java.lang.String toString()
toString in class java.lang.Objectpublic android.media.MediaCodecInfo.CodecProfileLevel[] getProfileLevels()
public int getMaxSupportedInstances()
MAX_SUPPORTED_INSTANCES_UNKNOWN if unknown. Applications should not expect to operate more
instances than the returned maximum.MediaCodecInfo.CodecCapabilities.getMaxSupportedInstances()public boolean isFormatSupported(Format format) throws MediaCodecUtil.DecoderQueryException
format.format - The input media format.format.MediaCodecUtil.DecoderQueryException - Thrown if an error occurs while querying decoders.public boolean isCodecSupported(java.lang.String codec)
codec. If there is insufficient information to
decide, returns true.codec - Codec string as defined in RFC 6381.public boolean isSeamlessAdaptationSupported(Format format)
format. For adaptation to succeed, the codec
must also be configured with appropriate maximum values and isSeamlessAdaptationSupported(Format, Format, boolean) must return true for the
old/new formats.format - The format of media for which the decoder will be configured.public boolean isSeamlessAdaptationSupported(Format oldFormat, Format newFormat, boolean isNewFormatComplete)
oldFormat to newFormat. If newFormat may not be completely populated, pass false for isNewFormatComplete.oldFormat - The format being decoded.newFormat - The new format.isNewFormatComplete - Whether newFormat is populated with format-specific
metadata.public boolean isVideoSizeAndRateSupportedV21(int width,
int height,
double frameRate)
Must not be called if the device SDK version is less than 21.
width - Width in pixels.height - Height in pixels.frameRate - Optional frame rate in frames per second. Ignored if set to
Format.NO_VALUE or any value less than or equal to 0.public android.graphics.Point alignVideoSizeV21(int width,
int height)
MediaCodec's width and height alignment requirements.
Must not be called if the device SDK version is less than 21.
width - Width in pixels.height - Height in pixels.MediaCodec's width and height alignment requirements, or null if not a video
codec.public boolean isAudioSampleRateSupportedV21(int sampleRate)
Must not be called if the device SDK version is less than 21.
sampleRate - The sample rate in Hz.public boolean isAudioChannelCountSupportedV21(int channelCount)
Must not be called if the device SDK version is less than 21.
channelCount - The channel count.