Class 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 a MediaCodec for a given MIME type.
    • 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 the MediaCodec.
        mimeType - A MIME type supported by the MediaCodec.
        codecMimeType - The MIME type that the codec uses for media of type #mimeType. Equal to mimeType unless the codec is known to use a non-standard MIME type alias.
        capabilities - The capabilities of the MediaCodec for the specified MIME type, or null if not known.
        hardwareAccelerated - Whether the MediaCodec is hardware accelerated.
        softwareOnly - Whether the MediaCodec is software only.
        vendor - Whether the MediaCodec is provided by the vendor.
        forceDisableAdaptive - Whether adaptive should be forced to false.
        forceSecure - Whether secure should be forced to true.
        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.
      • isFormatSupported

        public boolean isFormatSupported​(Format format)
                                  throws MediaCodecUtil.DecoderQueryException
        Deprecated.
        Returns whether the decoder may support decoding the given format both 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 given format.
        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 specified 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.

        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)
        Returns whether it is possible to adapt an instance of this decoder seamlessly from oldFormat to newFormat. If newFormat may not be completely populated, pass false for isNewFormatComplete.

        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 - Whether newFormat is 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 decoding oldFormat to decode newFormat instead.

        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 to Format.NO_VALUE or 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 the MediaCodec'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.