Class MediaCodecInfo
- java.lang.Object
-
- com.google.android.exoplayer2.mediacodec.MediaCodecInfo
-
@Deprecated public final class MediaCodecInfo extends Object
Deprecated.com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.Information about aMediaCodecfor a given MIME type.
-
-
Field Summary
Fields Modifier and Type Field Description booleanadaptiveDeprecated.Whether the decoder supports seamless resolution switches.MediaCodecInfo.CodecCapabilitiescapabilitiesDeprecated.The capabilities of the decoder, like the profiles/levels it supports, ornullif not known.StringcodecMimeTypeDeprecated.The MIME type that the codec uses for media of typemimeType.booleanhardwareAcceleratedDeprecated.Whether the codec is hardware accelerated.static intMAX_SUPPORTED_INSTANCES_UNKNOWNDeprecated.The value returned bygetMaxSupportedInstances()if the upper bound on the maximum number of supported instances is unknown.StringmimeTypeDeprecated.The MIME type handled by the codec.StringnameDeprecated.The name of the decoder.booleansecureDeprecated.Whether the decoder is secure.booleansoftwareOnlyDeprecated.Whether the codec is software only.static StringTAGDeprecated.booleantunnelingDeprecated.Whether the decoder supports tunneling.booleanvendorDeprecated.Whether the codec is from the vendor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description PointalignVideoSizeV21(int width, int height)Deprecated.Returns the smallest video size greater than or equal to a specified size that also satisfies theMediaCodec's width and height alignment requirements.DecoderReuseEvaluationcanReuseCodec(Format oldFormat, Format newFormat)Deprecated.Evaluates whether it's possible to reuse an instance of this decoder that's currently decodingoldFormatto decodenewFormatinstead.intgetMaxSupportedInstances()Deprecated.Returns an upper bound on the maximum number of supported instances, orMAX_SUPPORTED_INSTANCES_UNKNOWNif unknown.MediaCodecInfo.CodecProfileLevel[]getProfileLevels()Deprecated.The profile levels supported by the decoder.booleanisAudioChannelCountSupportedV21(int channelCount)Deprecated.Whether the decoder supports audio with a given channel count.booleanisAudioSampleRateSupportedV21(int sampleRate)Deprecated.Whether the decoder supports audio with a given sample rate.booleanisFormatFunctionallySupported(Format format)Deprecated.Returns whether the decoder may functionally support decoding the givenformat.booleanisFormatSupported(Format format)Deprecated.Returns whether the decoder may support decoding the givenformatboth functionally and performantly.booleanisHdr10PlusOutOfBandMetadataSupported()Deprecated.Whether the codec handles HDR10+ out-of-band metadata.booleanisSeamlessAdaptationSupported(Format format)Deprecated.Returns whether it may be possible to adapt an instance of this decoder to playing a different format when the codec is configured to play media in the specifiedformat.booleanisSeamlessAdaptationSupported(Format oldFormat, Format newFormat, boolean isNewFormatComplete)booleanisVideoSizeAndRateSupportedV21(int width, int height, double frameRate)Deprecated.Whether the decoder supports video with a given width, height and frame rate.static MediaCodecInfonewInstance(String name, String mimeType, String codecMimeType, MediaCodecInfo.CodecCapabilities capabilities, boolean hardwareAccelerated, boolean softwareOnly, boolean vendor, boolean forceDisableAdaptive, boolean forceSecure)Deprecated.Creates an instance.StringtoString()Deprecated.
-
-
-
Field Detail
-
TAG
public static final String TAG
Deprecated.- See Also:
- Constant Field Values
-
MAX_SUPPORTED_INSTANCES_UNKNOWN
public static final int MAX_SUPPORTED_INSTANCES_UNKNOWN
Deprecated.The value returned bygetMaxSupportedInstances()if the upper bound on the maximum number of supported instances is unknown.- See Also:
- Constant Field Values
-
name
public final String name
Deprecated.The name of the decoder.May be passed to
MediaCodec.createByCodecName(String)to create an instance of the decoder.
-
mimeType
public final String mimeType
Deprecated.The MIME type handled by the codec.
-
codecMimeType
public final String codecMimeType
Deprecated.
-
capabilities
@Nullable public final MediaCodecInfo.CodecCapabilities capabilities
Deprecated.The capabilities of the decoder, like the profiles/levels it supports, ornullif not known.
-
adaptive
public final boolean adaptive
Deprecated.Whether the decoder supports seamless resolution switches.
-
tunneling
public final boolean tunneling
Deprecated.Whether the decoder supports tunneling.
-
secure
public final boolean secure
Deprecated.Whether the decoder is secure.
-
hardwareAccelerated
public final boolean hardwareAccelerated
Deprecated.Whether the codec is hardware accelerated.This could be an approximation as the exact information is only provided in API levels 29+.
- See Also:
MediaCodecInfo.isHardwareAccelerated()
-
softwareOnly
public final boolean softwareOnly
Deprecated.Whether the codec is software only.This could be an approximation as the exact information is only provided in API levels 29+.
- See Also:
MediaCodecInfo.isSoftwareOnly()
-
vendor
public final boolean vendor
Deprecated.Whether the codec is from the vendor.This could be an approximation as the exact information is only provided in API levels 29+.
- See Also:
MediaCodecInfo.isVendor()
-
-
Method Detail
-
newInstance
public static MediaCodecInfo newInstance(String name, String mimeType, String codecMimeType, @Nullable MediaCodecInfo.CodecCapabilities capabilities, boolean hardwareAccelerated, boolean softwareOnly, boolean vendor, boolean forceDisableAdaptive, boolean forceSecure)
Deprecated.Creates an instance.- Parameters:
name- The name of theMediaCodec.mimeType- A MIME type supported by theMediaCodec.codecMimeType- The MIME type that the codec uses for media of type#mimeType. Equal tomimeTypeunless the codec is known to use a non-standard MIME type alias.capabilities- The capabilities of theMediaCodecfor the specified MIME type, ornullif not known.hardwareAccelerated- Whether theMediaCodecis hardware accelerated.softwareOnly- Whether theMediaCodecis software only.vendor- Whether theMediaCodecis provided by the vendor.forceDisableAdaptive- Whetheradaptiveshould be forced tofalse.forceSecure- Whethersecureshould be forced totrue.- Returns:
- The created instance.
-
getProfileLevels
public MediaCodecInfo.CodecProfileLevel[] getProfileLevels()
Deprecated.The profile levels supported by the decoder.- Returns:
- The profile levels supported by the decoder.
-
getMaxSupportedInstances
public int getMaxSupportedInstances()
Deprecated.Returns an upper bound on the maximum number of supported instances, orMAX_SUPPORTED_INSTANCES_UNKNOWNif unknown. Applications should not expect to operate more instances than the returned maximum.
-
isFormatSupported
public boolean isFormatSupported(Format format) throws MediaCodecUtil.DecoderQueryException
Deprecated.Returns whether the decoder may support decoding the givenformatboth functionally and performantly.- Parameters:
format- The input media format.- Returns:
- Whether the decoder may support decoding the given
format. - Throws:
MediaCodecUtil.DecoderQueryException- Thrown if an error occurs while querying decoders.
-
isFormatFunctionallySupported
public boolean isFormatFunctionallySupported(Format format)
Deprecated.Returns whether the decoder may functionally support decoding the givenformat.- Parameters:
format- The input media format.- Returns:
- Whether the decoder may functionally support decoding the given
format.
-
isHdr10PlusOutOfBandMetadataSupported
public boolean isHdr10PlusOutOfBandMetadataSupported()
Deprecated.Whether the codec handles HDR10+ out-of-band metadata.
-
isSeamlessAdaptationSupported
public boolean isSeamlessAdaptationSupported(Format format)
Deprecated.Returns whether it may be possible to adapt an instance of this decoder to playing a different format when the codec is configured to play media in the specifiedformat.For adaptation to succeed, the codec must also be configured with appropriate maximum values and
isSeamlessAdaptationSupported(Format, Format, boolean)must returntruefor the old/new formats.- Parameters:
format- The format of media for which the decoder will be configured.- Returns:
- Whether adaptation may be possible
-
isSeamlessAdaptationSupported
@Deprecated public boolean isSeamlessAdaptationSupported(Format oldFormat, Format newFormat, boolean isNewFormatComplete)
Deprecated.Returns whether it is possible to adapt an instance of this decoder seamlessly fromoldFormattonewFormat. IfnewFormatmay not be completely populated, passfalseforisNewFormatComplete.For adaptation to succeed, the codec must also be configured with maximum values that are compatible with the new format.
- Parameters:
oldFormat- The format being decoded.newFormat- The new format.isNewFormatComplete- WhethernewFormatis populated with format-specific metadata.- Returns:
- Whether it is possible to adapt the decoder seamlessly.
-
canReuseCodec
public DecoderReuseEvaluation canReuseCodec(Format oldFormat, Format newFormat)
Deprecated.Evaluates whether it's possible to reuse an instance of this decoder that's currently decodingoldFormatto decodenewFormatinstead.For adaptation to succeed, the codec must also be configured with maximum values that are compatible with the new format.
- Parameters:
oldFormat- The format being decoded.newFormat- The new format.- Returns:
- The result of the evaluation.
-
isVideoSizeAndRateSupportedV21
@RequiresApi(21) public boolean isVideoSizeAndRateSupportedV21(int width, int height, double frameRate)Deprecated.Whether the decoder supports video with a given width, height and frame rate.- Parameters:
width- Width in pixels.height- Height in pixels.frameRate- Optional frame rate in frames per second. Ignored if set toFormat.NO_VALUEor any value less than or equal to 0.- Returns:
- Whether the decoder supports video with the given width, height and frame rate.
-
alignVideoSizeV21
@Nullable @RequiresApi(21) public Point alignVideoSizeV21(int width, int height)
Deprecated.Returns the smallest video size greater than or equal to a specified size that also satisfies theMediaCodec's width and height alignment requirements.Must not be called if the device SDK version is less than 21.
- Parameters:
width- Width in pixels.height- Height in pixels.- Returns:
- The smallest video size greater than or equal to the specified size that also satisfies
the
MediaCodec's width and height alignment requirements, or null if not a video codec.
-
isAudioSampleRateSupportedV21
@RequiresApi(21) public boolean isAudioSampleRateSupportedV21(int sampleRate)
Deprecated.Whether the decoder supports audio with a given sample rate.Must not be called if the device SDK version is less than 21.
- Parameters:
sampleRate- The sample rate in Hz.- Returns:
- Whether the decoder supports audio with the given sample rate.
-
isAudioChannelCountSupportedV21
@RequiresApi(21) public boolean isAudioChannelCountSupportedV21(int channelCount)
Deprecated.Whether the decoder supports audio with a given channel count.Must not be called if the device SDK version is less than 21.
- Parameters:
channelCount- The channel count.- Returns:
- Whether the decoder supports audio with the given channel count.
-
-