FileDocCategorySizeDatePackage
MediaProfileReader.javaAPI DocAndroid 5.1 API5099Thu Mar 12 22:22:30 GMT 2015com.android.mediaframeworktest

MediaProfileReader

public class MediaProfileReader extends Object

Fields Summary
private static final List
videoDecoders
private static final List
audioDecoders
private static final List
videoEncoders
private static final List
audioEncoders
private static final HashMap
videoEncoderMap
private static final HashMap
audioEncoderMap
Constructors Summary
private MediaProfileReader()

Methods Summary
public static java.lang.StringgetAudioCodecName(int audioEncoder)

        if (audioEncoder != MediaRecorder.AudioEncoder.AMR_NB &&
            audioEncoder != MediaRecorder.AudioEncoder.AMR_WB &&
            audioEncoder != MediaRecorder.AudioEncoder.AAC &&
            audioEncoder != MediaRecorder.AudioEncoder.HE_AAC &&
            audioEncoder != MediaRecorder.AudioEncoder.AAC_ELD) {
            throw new IllegalArgumentException("Unsupported audio encodeer " + audioEncoder);
        }
        return audioEncoderMap.get(audioEncoder);
    
public static java.util.ListgetAudioEncoders()

        return audioEncoders;
    
public static java.lang.StringgetDeviceType()

        // push all the property into one big table
        String s;
        s = SystemProperties.get("ro.product.name");
        return s;
    
public static intgetMaxFrameRateForCodec(int codec)

        return getMinOrMaxFrameRateForCodec(codec, true);
    
public static intgetMinFrameRateForCodec(int codec)

        return getMinOrMaxFrameRateForCodec(codec, false);
    
private static intgetMinOrMaxFrameRateForCodec(int codec, boolean max)

        for (VideoEncoderCap cap: videoEncoders) {
            if (cap.mCodec == codec) {
                if (max) return cap.mMaxFrameRate;
                else return cap.mMinFrameRate;
            }
        }
        // Should never reach here
        throw new IllegalArgumentException("Unsupported video codec " + codec);
    
public static java.lang.StringgetVideoCodecName(int videoEncoder)

        if (videoEncoder != MediaRecorder.VideoEncoder.H263 &&
            videoEncoder != MediaRecorder.VideoEncoder.H264 &&
            videoEncoder != MediaRecorder.VideoEncoder.MPEG_4_SP) {
            throw new IllegalArgumentException("Unsupported video encoder " + videoEncoder);
        }
        return videoEncoderMap.get(videoEncoder);
    
public static java.util.ListgetVideoEncoders()


     
        initAudioEncoderMap();
        initVideoEncoderMap();
    
        return videoEncoders;
    
public static booleangetWMAEnable()

        for (AudioDecoder decoder: audioDecoders) {
            if (decoder == AudioDecoder.AUDIO_DECODER_WMA) {
                return true;
            }
        }
        return false;
    
public static booleangetWMVEnable()

        for (VideoDecoder decoder: videoDecoders) {
            if (decoder == VideoDecoder.VIDEO_DECODER_WMV) {
                return true;
            }
        }
        return false;
    
private static voidinitAudioEncoderMap()

        // audio encoders
        audioEncoderMap.put(MediaRecorder.AudioEncoder.AMR_NB, "amrnb");
        audioEncoderMap.put(MediaRecorder.AudioEncoder.AMR_WB, "amrwb");
        audioEncoderMap.put(MediaRecorder.AudioEncoder.AAC, "aac");
        audioEncoderMap.put(MediaRecorder.AudioEncoder.HE_AAC, "heaac");
        audioEncoderMap.put(MediaRecorder.AudioEncoder.AAC_ELD, "aaceld");
    
private static voidinitVideoEncoderMap()

        // video encoders
        videoEncoderMap.put(MediaRecorder.VideoEncoder.H263, "h263");
        videoEncoderMap.put(MediaRecorder.VideoEncoder.H264, "h264");
        videoEncoderMap.put(MediaRecorder.VideoEncoder.MPEG_4_SP, "m4v");