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