| 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/android/media_codec_direction.h" |
| 15 #include "media/base/media_export.h" | 16 #include "media/base/media_export.h" |
| 16 | 17 |
| 17 class GURL; | 18 class GURL; |
| 18 | 19 |
| 19 namespace media { | 20 namespace media { |
| 20 | 21 |
| 21 // Helper macro to skip the test if MediaCodecBridge isn't available. | 22 // Helper macro to skip the test if MediaCodecBridge isn't available. |
| 22 #define SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE() \ | 23 #define SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE() \ |
| 23 do { \ | 24 do { \ |
| 24 if (!MediaCodecUtil::IsMediaCodecAvailable()) { \ | 25 if (!MediaCodecUtil::IsMediaCodecAvailable()) { \ |
| 25 VLOG(0) << "Could not run test - not supported on device."; \ | 26 VLOG(0) << "Could not run test - not supported on device."; \ |
| 26 return; \ | 27 return; \ |
| 27 } \ | 28 } \ |
| 28 } while (0) | 29 } while (0) |
| 29 | 30 |
| 30 // Helper macro to skip the test if VP8 decoding isn't supported. | 31 // Helper macro to skip the test if VP8 decoding isn't supported. |
| 31 #define SKIP_TEST_IF_VP8_DECODER_IS_NOT_SUPPORTED() \ | 32 #define SKIP_TEST_IF_VP8_DECODER_IS_NOT_SUPPORTED() \ |
| 32 do { \ | 33 do { \ |
| 33 if (!MediaCodecUtil::IsVp8DecoderAvailable()) { \ | 34 if (!MediaCodecUtil::IsVp8DecoderAvailable()) { \ |
| 34 VLOG(0) << "Could not run test - not supported on device."; \ | 35 VLOG(0) << "Could not run test - not supported on device."; \ |
| 35 return; \ | 36 return; \ |
| 36 } \ | 37 } \ |
| 37 } while (0) | 38 } while (0) |
| 38 | 39 |
| 39 // Codec direction. Keep this in sync with MediaCodecUtil.java. | |
| 40 enum MediaCodecDirection { | |
| 41 MEDIA_CODEC_DECODER, | |
| 42 MEDIA_CODEC_ENCODER, | |
| 43 }; | |
| 44 | |
| 45 class MEDIA_EXPORT MediaCodecUtil { | 40 class MEDIA_EXPORT MediaCodecUtil { |
| 46 public: | 41 public: |
| 47 // Returns true if MediaCodec is available on the device. | 42 // Returns true if MediaCodec is available on the device. |
| 48 // All other static methods check IsAvailable() internally. There's no need | 43 // All other static methods check IsAvailable() internally. There's no need |
| 49 // to check IsAvailable() explicitly before calling them. | 44 // to check IsAvailable() explicitly before calling them. |
| 50 static bool IsMediaCodecAvailable(); | 45 static bool IsMediaCodecAvailable(); |
| 51 | 46 |
| 52 // Returns true if MediaCodec.setParameters() is available on the device. | 47 // Returns true if MediaCodec.setParameters() is available on the device. |
| 53 static bool SupportsSetParameters(); | 48 static bool SupportsSetParameters(); |
| 54 | 49 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 82 // Indicates if the vp9 decoder is available on this device. | 77 // Indicates if the vp9 decoder is available on this device. |
| 83 static bool IsVp9DecoderAvailable(); | 78 static bool IsVp9DecoderAvailable(); |
| 84 | 79 |
| 85 // Indicates if SurfaceView and MediaCodec work well together on this device. | 80 // Indicates if SurfaceView and MediaCodec work well together on this device. |
| 86 static bool IsSurfaceViewOutputSupported(); | 81 static bool IsSurfaceViewOutputSupported(); |
| 87 }; | 82 }; |
| 88 | 83 |
| 89 } // namespace media | 84 } // namespace media |
| 90 | 85 |
| 91 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ | 86 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ |
| OLD | NEW |