Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(748)

Unified Diff: media/base/android/media_codec_util.h

Issue 1472943002: Refactor MediaCodecBridge to add support for NDK APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add media_codec_util.cc(h) Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..841c9559994f5551239b7d2bccb699736a62b008
--- /dev/null
+++ b/media/base/android/media_codec_util.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
xhwang 2015/11/30 23:11:50 2015
qinmin 2015/12/03 22:46:23 Done.
+// 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 "media/base/media_export.h"
+
+namespace media {
+
+// Codec direction. Keep this in sync with MediaCodecUtil.java.
+enum MediaCodecDirection {
+ MEDIA_CODEC_DECODER,
+ MEDIA_CODEC_ENCODER,
+};
+
+// Convert Android MIME type to codec type.
+const std::string AndroidMimeTypeToCodecType(const std::string& mime);
+
+// 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.
+bool MEDIA_EXPORT IsMediaCodecAvailable();
+
+// Returns true if MediaCodec.setParameters() is available on the device.
+bool MEDIA_EXPORT SupportsSetParameters();
+
+// Returns true if MediaCodec.getName() is available on the device.
+bool MEDIA_EXPORT SupportsGetName();
xhwang 2015/11/30 23:11:50 Some functions in this file, e.g. media::SupportsG
qinmin 2015/12/03 22:46:23 Done.
+
+// Returns whether MediaCodecBridge has a decoder that |is_secure| and can
+// decode |codec| type.
+bool MEDIA_EXPORT CanDecode(const std::string& codec, bool is_secure);
+
+// Represents supported codecs on android.
+// TODO(qinmin): Currently the codecs string only contains one codec. Do we
+// need to support codecs separated by comma. (e.g. "vp8" -> "vp8, vp8.0")?
+struct CodecsInfo {
+ std::string codecs; // E.g. "vp8" or "avc1".
+ std::string name; // E.g. "OMX.google.vp8.decoder".
+ MediaCodecDirection direction;
+};
+
+// Get a list of supported codecs.
+std::vector<CodecsInfo> MEDIA_EXPORT GetCodecsInfo();
+
+// Get default codec name for |mime_type|.
+std::string MEDIA_EXPORT GetDefaultCodecName(const std::string& mime_type,
+ MediaCodecDirection direction);
+
+// Get a list of encoder supported color formats for |mime_type|.
+// The mapping of color format name and its value refers to
+// MediaCodecInfo.CodecCapabilities.
+std::set<int> MEDIA_EXPORT GetEncoderColorFormats(const std::string& mime_type);
+
+bool RegisterMediaCodecUtil(JNIEnv* env);
+
+} // namespace media
+
+#endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_

Powered by Google App Engine
This is Rietveld 408576698