1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.media; 18 19 import android.annotation.UnsupportedAppUsage; 20 import java.util.List; 21 import java.util.ArrayList; 22 23 /** 24 * {@hide} 25 * 26 * The DecoderCapabilities class is used to retrieve the types of the 27 * video and audio decoder(s) supported on a specific Android platform. 28 */ 29 public class DecoderCapabilities 30 { 31 /** 32 * The VideoDecoder class represents the type of a video decoder 33 * 34 */ 35 public enum VideoDecoder { 36 @UnsupportedAppUsage 37 VIDEO_DECODER_WMV, 38 }; 39 40 /** 41 * The AudioDecoder class represents the type of an audio decoder 42 */ 43 public enum AudioDecoder { 44 @UnsupportedAppUsage 45 AUDIO_DECODER_WMA, 46 }; 47 48 static { 49 System.loadLibrary("media_jni"); native_init()50 native_init(); 51 } 52 53 /** 54 * Returns the list of video decoder types 55 * @see android.media.DecoderCapabilities.VideoDecoder 56 */ 57 @UnsupportedAppUsage getVideoDecoders()58 public static List<VideoDecoder> getVideoDecoders() { 59 List<VideoDecoder> decoderList = new ArrayList<VideoDecoder>(); 60 int nDecoders = native_get_num_video_decoders(); 61 for (int i = 0; i < nDecoders; ++i) { 62 decoderList.add(VideoDecoder.values()[native_get_video_decoder_type(i)]); 63 } 64 return decoderList; 65 } 66 67 /** 68 * Returns the list of audio decoder types 69 * @see android.media.DecoderCapabilities.AudioDecoder 70 */ 71 @UnsupportedAppUsage getAudioDecoders()72 public static List<AudioDecoder> getAudioDecoders() { 73 List<AudioDecoder> decoderList = new ArrayList<AudioDecoder>(); 74 int nDecoders = native_get_num_audio_decoders(); 75 for (int i = 0; i < nDecoders; ++i) { 76 decoderList.add(AudioDecoder.values()[native_get_audio_decoder_type(i)]); 77 } 78 return decoderList; 79 } 80 DecoderCapabilities()81 private DecoderCapabilities() {} // Don't call me 82 83 // Implemented by JNI native_init()84 private static native final void native_init(); native_get_num_video_decoders()85 private static native final int native_get_num_video_decoders(); native_get_video_decoder_type(int index)86 private static native final int native_get_video_decoder_type(int index); native_get_num_audio_decoders()87 private static native final int native_get_num_audio_decoders(); native_get_audio_decoder_type(int index)88 private static native final int native_get_audio_decoder_type(int index); 89 } 90