diff options
-rw-r--r-- | media/java/android/media/MediaFile.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/media/java/android/media/MediaFile.java b/media/java/android/media/MediaFile.java index ee2c1e8..a027bc6 100644 --- a/media/java/android/media/MediaFile.java +++ b/media/java/android/media/MediaFile.java @@ -141,7 +141,9 @@ public class MediaFile { private static boolean isWMAEnabled() { List<AudioDecoder> decoders = DecoderCapabilities.getAudioDecoders(); - for (AudioDecoder decoder: decoders) { + int count = decoders.size(); + for (int i = 0; i < count; i++) { + AudioDecoder decoder = decoders.get(i); if (decoder == AudioDecoder.AUDIO_DECODER_WMA) { return true; } @@ -149,6 +151,18 @@ public class MediaFile { return false; } + private static boolean isWMVEnabled() { + List<VideoDecoder> decoders = DecoderCapabilities.getVideoDecoders(); + int count = decoders.size(); + for (int i = 0; i < count; i++) { + VideoDecoder decoder = decoders.get(i); + if (decoder == VideoDecoder.VIDEO_DECODER_WMV) { + return true; + } + } + return false; + } + static { addFileType("MP3", FILE_TYPE_MP3, "audio/mpeg", MtpConstants.FORMAT_MP3); addFileType("M4A", FILE_TYPE_M4A, "audio/mp4", MtpConstants.FORMAT_MPEG); @@ -184,8 +198,10 @@ public class MediaFile { addFileType("WEBM", FILE_TYPE_MKV, "video/x-matroska"); addFileType("TS", FILE_TYPE_MP2TS, "video/mp2ts"); - addFileType("WMV", FILE_TYPE_WMV, "video/x-ms-wmv", MtpConstants.FORMAT_WMV); - addFileType("ASF", FILE_TYPE_ASF, "video/x-ms-asf"); + if (isWMVEnabled()) { + addFileType("WMV", FILE_TYPE_WMV, "video/x-ms-wmv", MtpConstants.FORMAT_WMV); + addFileType("ASF", FILE_TYPE_ASF, "video/x-ms-asf"); + } addFileType("JPG", FILE_TYPE_JPEG, "image/jpeg", MtpConstants.FORMAT_EXIF_JPEG); addFileType("JPEG", FILE_TYPE_JPEG, "image/jpeg", MtpConstants.FORMAT_EXIF_JPEG); |