Sdílet prostřednictvím


MediaCodec.CreateDecoderByType(String) Method

Definition

Instantiate the preferred decoder supporting input data of the given mime type.

[Android.Runtime.Register("createDecoderByType", "(Ljava/lang/String;)Landroid/media/MediaCodec;", "")]
public static Android.Media.MediaCodec CreateDecoderByType (string type);
[<Android.Runtime.Register("createDecoderByType", "(Ljava/lang/String;)Landroid/media/MediaCodec;", "")>]
static member CreateDecoderByType : string -> Android.Media.MediaCodec

Parameters

type
String

The mime type of the input data.

Returns

Attributes

Exceptions

if the codec cannot be created.

if type is not a valid mime type.

if type is null.

Remarks

Instantiate the preferred decoder supporting input data of the given mime type.

The following is a partial list of defined mime types and their semantics: <ul> <li>"video/x-vnd.on2.vp8" - VP8 video (i.e. video in .webm) <li>"video/x-vnd.on2.vp9" - VP9 video (i.e. video in .webm) <li>"video/avc" - H.264/AVC video <li>"video/hevc" - H.265/HEVC video <li>"video/mp4v-es" - MPEG4 video <li>"video/3gpp" - H.263 video <li>"audio/3gpp" - AMR narrowband audio <li>"audio/amr-wb" - AMR wideband audio <li>"audio/mpeg" - MPEG1/2 audio layer III <li>"audio/mp4a-latm" - AAC audio (note, this is raw AAC packets, not packaged in LATM!) <li>"audio/vorbis" - vorbis audio <li>"audio/g711-alaw" - G.711 alaw audio <li>"audio/g711-mlaw" - G.711 ulaw audio </ul>

<strong>Note:</strong> It is preferred to use MediaCodecList#findDecoderForFormat and #createByCodecName to ensure that the resulting codec can handle a given format.

Java documentation for android.media.MediaCodec.createDecoderByType(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to