Chromium Code Reviews| Index: media/base/android/java/src/org/chromium/media/MediaCodecBridge.java |
| diff --git a/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java b/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java |
| index ac2f73359b5b99d14054c85ad13923916e4df7f3..2aabe92c8d65f69ad9e68e1cd0663a21630c51ae 100644 |
| --- a/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java |
| +++ b/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java |
| @@ -206,6 +206,30 @@ class MediaCodecBridge { |
| return codecName; |
| } |
| + /** |
| + * Get a list of encoder supported color formats for specified mime type. |
| + */ |
| + @CalledByNative |
| + private static int[] getEncoderColorFormatsForMime(String mime) { |
| + int count = MediaCodecList.getCodecCount(); |
| + for (int i = 0; i < count; ++i) { |
|
mcasas
2014/10/10 08:16:16
Range-based for loop? Same below on l.222
changbin
2014/10/10 08:55:51
It's java code. We may use 'for each' loop, while
|
| + MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i); |
| + if (!info.isEncoder()) { |
|
mcasas
2014/10/10 08:16:16
Put in a single line?
changbin
2014/10/10 08:55:51
Done.
|
| + continue; |
| + } |
| + |
| + String[] supportedTypes = info.getSupportedTypes(); |
| + for (int j = 0; j < supportedTypes.length; ++j) { |
| + if (supportedTypes[j].equalsIgnoreCase(mime)) { |
| + MediaCodecInfo.CodecCapabilities capabilities = |
| + info.getCapabilitiesForType(mime); |
| + return capabilities.colorFormats; |
| + } |
| + } |
| + } |
| + return null; |
| + } |
| + |
| @SuppressWarnings("deprecation") |
| private static String getDecoderNameForMime(String mime) { |
| int count = MediaCodecList.getCodecCount(); |