| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ |
| 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "media/base/media_export.h" | 15 #include "media/base/media_export.h" |
| 16 | 16 |
| 17 class GURL; |
| 18 |
| 17 namespace media { | 19 namespace media { |
| 18 | 20 |
| 19 // Helper macro to skip the test if MediaCodecBridge isn't available. | 21 // Helper macro to skip the test if MediaCodecBridge isn't available. |
| 20 #define SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE() \ | 22 #define SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE() \ |
| 21 do { \ | 23 do { \ |
| 22 if (!MediaCodecUtil::IsMediaCodecAvailable()) { \ | 24 if (!MediaCodecUtil::IsMediaCodecAvailable()) { \ |
| 23 VLOG(0) << "Could not run test - not supported on device."; \ | 25 VLOG(0) << "Could not run test - not supported on device."; \ |
| 24 return; \ | 26 return; \ |
| 25 } \ | 27 } \ |
| 26 } while (0) | 28 } while (0) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 48 // Get a list of encoder supported color formats for |mime_type|. | 50 // Get a list of encoder supported color formats for |mime_type|. |
| 49 // The mapping of color format name and its value refers to | 51 // The mapping of color format name and its value refers to |
| 50 // MediaCodecInfo.CodecCapabilities. | 52 // MediaCodecInfo.CodecCapabilities. |
| 51 static std::set<int> GetEncoderColorFormats(const std::string& mime_type); | 53 static std::set<int> GetEncoderColorFormats(const std::string& mime_type); |
| 52 | 54 |
| 53 // Returns true if |mime_type| is known to be unaccelerated (i.e. backed by a | 55 // Returns true if |mime_type| is known to be unaccelerated (i.e. backed by a |
| 54 // software codec instead of a hardware one). | 56 // software codec instead of a hardware one). |
| 55 static bool IsKnownUnaccelerated(const std::string& mime_type, | 57 static bool IsKnownUnaccelerated(const std::string& mime_type, |
| 56 MediaCodecDirection direction); | 58 MediaCodecDirection direction); |
| 57 | 59 |
| 60 // Test whether the path of a URL ends with ".m3u8". |
| 61 static bool IsHLSURL(const GURL& url); |
| 62 |
| 63 // Test whether a URL contains "m3u8". (Using exactly the same logic as |
| 64 // NuPlayer does to determine if a stream is HLS.) |
| 65 static bool IsHLSPath(const GURL& url); |
| 66 |
| 58 static bool RegisterMediaCodecUtil(JNIEnv* env); | 67 static bool RegisterMediaCodecUtil(JNIEnv* env); |
| 59 }; | 68 }; |
| 60 | 69 |
| 61 } // namespace media | 70 } // namespace media |
| 62 | 71 |
| 63 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ | 72 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ |
| OLD | NEW |