Chromium Code Reviews| Index: media/base/android/media_codec_util.h |
| diff --git a/media/base/android/media_codec_util.h b/media/base/android/media_codec_util.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1df7a2a5388dbc91f683d7a56c6c072dc4dac278 |
| --- /dev/null |
| +++ b/media/base/android/media_codec_util.h |
| @@ -0,0 +1,66 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ |
| +#define MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ |
| + |
| +#include <jni.h> |
| +#include <set> |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/compiler_specific.h" |
| +#include "base/macros.h" |
| +#include "media/base/media_export.h" |
| + |
| +namespace media { |
| + |
| +// Helper macro to skip the test if MediaCodecBridge isn't available. |
| +#define SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE() \ |
| + do { \ |
| + if (!MediaCodecUtil::IsMediaCodecAvailable()) { \ |
| + VLOG(0) << "Could not run test - not supported on device."; \ |
| + return; \ |
| + } \ |
| + } while (0) |
| + |
| +// Codec direction. Keep this in sync with MediaCodecUtil.java. |
| +enum MediaCodecDirection { |
| + MEDIA_CODEC_DECODER, |
| + MEDIA_CODEC_ENCODER, |
| +}; |
| + |
| +class MEDIA_EXPORT MediaCodecUtil { |
|
Tima Vaisburd
2015/12/04 02:04:48
[Q] This is a general question. This class contain
xhwang
2015/12/04 18:07:58
We don't use an additional namespace for this purp
Tima Vaisburd
2015/12/04 18:52:18
In the original CL they were part of MediaCodecBri
|
| + public: |
| + // Returns true if MediaCodec is available on the device. |
| + // All other static methods check IsAvailable() internally. There's no need |
| + // to check IsAvailable() explicitly before calling them. |
| + static bool IsMediaCodecAvailable(); |
| + |
| + // Returns true if MediaCodec.setParameters() is available on the device. |
| + static bool SupportsSetParameters(); |
| + |
| + // Returns whether MediaCodecBridge has a decoder that |is_secure| and can |
| + // decode |codec| type. |
| + static bool CanDecode(const std::string& codec, bool is_secure); |
| + |
| + // Get a list of encoder supported color formats for |mime_type|. |
| + // The mapping of color format name and its value refers to |
| + // MediaCodecInfo.CodecCapabilities. |
| + static std::set<int> GetEncoderColorFormats(const std::string& mime_type); |
| + |
| + // Returns true if |mime_type| is known to be unaccelerated (i.e. backed by a |
| + // software codec instead of a hardware one). |
| + static bool IsKnownUnaccelerated(const std::string& mime_type, |
| + MediaCodecDirection direction); |
| + |
| + static bool RegisterMediaCodecUtil(JNIEnv* env); |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(MediaCodecUtil); |
|
Tima Vaisburd
2015/12/04 02:04:48
I would just drop the DISALLOW, it seems the class
qinmin
2015/12/04 20:26:04
Done.
|
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_ |