Example usage for android.media MediaCodecInfo getName

List of usage examples for android.media MediaCodecInfo getName

Introduction

In this page you can find the example usage for android.media MediaCodecInfo getName.

Prototype

public final String getName() 

Source Link

Document

Retrieve the codec name.

Usage

From source file:org.xwalk.runtime.extension.api.device_capabilities.MediaCodec.java

public void getCodecsList() {
    int numCodecs = android.media.MediaCodecList.getCodecCount();
    for (int i = 0; i < numCodecs; i++) {
        android.media.MediaCodecInfo codecInfo = android.media.MediaCodecList.getCodecInfoAt(i);
        String name = codecInfo.getName().toUpperCase();
        boolean hasAdded = false;

        for (String nameListElement : AUDIO_CODEC_NAMES) {
            if (name.contains(nameListElement)) {
                mAudioCodecsSet.add(new AudioCodecElement(nameListElement));
                hasAdded = true;/* w  ww  .  j a v  a  2  s.c o m*/
                break;
            }
        }

        if (hasAdded) {
            continue;
        }

        for (String nameListElement : VIDEO_CODEC_NAMES) {
            if (name.contains(nameListElement)) {
                boolean isEncoder = codecInfo.isEncoder();
                // FIXME(fyraimar): Get the right hwAccel value.
                mVideoCodecsSet.add(new VideoCodecElement(nameListElement, isEncoder, false));
                break;
            }
        }
    }
}