diff options
author | Mike Lockwood <lockwood@android.com> | 2011-02-18 15:03:28 -0500 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2011-02-22 17:49:00 -0800 |
commit | 16dc3073a2f06a77d9873e536f633a4adf575fce (patch) | |
tree | 1464a17de5bab2cb0d33d0c01757a1c8d473e02f /media | |
parent | 5fb008e3800032be18c6d5f1e7ace4d7c2661e26 (diff) | |
download | frameworks_base-16dc3073a2f06a77d9873e536f633a4adf575fce.zip frameworks_base-16dc3073a2f06a77d9873e536f633a4adf575fce.tar.gz frameworks_base-16dc3073a2f06a77d9873e536f633a4adf575fce.tar.bz2 |
Don't treat WMV and ASF files as video files unless WMV is supported
Change-Id: I512d1db67e06273d9c23d10fa30d2d62f9f75a75
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'media')
-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); |