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

Side by Side 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 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 unified diff | Download patch
OLDNEW
(Empty)
1 // 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.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_
7
8 #include <jni.h>
9 #include <set>
10 #include <string>
11 #include <vector>
12
13 #include "base/compiler_specific.h"
14 #include "media/base/media_export.h"
15
16 namespace media {
17
18 // Codec direction. Keep this in sync with MediaCodecUtil.java.
19 enum MediaCodecDirection {
20 MEDIA_CODEC_DECODER,
21 MEDIA_CODEC_ENCODER,
22 };
23
24 // Convert Android MIME type to codec type.
25 const std::string AndroidMimeTypeToCodecType(const std::string& mime);
26
27 // Returns true if MediaCodec is available on the device.
28 // All other static methods check IsAvailable() internally. There's no need
29 // to check IsAvailable() explicitly before calling them.
30 bool MEDIA_EXPORT IsMediaCodecAvailable();
31
32 // Returns true if MediaCodec.setParameters() is available on the device.
33 bool MEDIA_EXPORT SupportsSetParameters();
34
35 // Returns true if MediaCodec.getName() is available on the device.
36 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.
37
38 // Returns whether MediaCodecBridge has a decoder that |is_secure| and can
39 // decode |codec| type.
40 bool MEDIA_EXPORT CanDecode(const std::string& codec, bool is_secure);
41
42 // Represents supported codecs on android.
43 // TODO(qinmin): Currently the codecs string only contains one codec. Do we
44 // need to support codecs separated by comma. (e.g. "vp8" -> "vp8, vp8.0")?
45 struct CodecsInfo {
46 std::string codecs; // E.g. "vp8" or "avc1".
47 std::string name; // E.g. "OMX.google.vp8.decoder".
48 MediaCodecDirection direction;
49 };
50
51 // Get a list of supported codecs.
52 std::vector<CodecsInfo> MEDIA_EXPORT GetCodecsInfo();
53
54 // Get default codec name for |mime_type|.
55 std::string MEDIA_EXPORT GetDefaultCodecName(const std::string& mime_type,
56 MediaCodecDirection direction);
57
58 // Get a list of encoder supported color formats for |mime_type|.
59 // The mapping of color format name and its value refers to
60 // MediaCodecInfo.CodecCapabilities.
61 std::set<int> MEDIA_EXPORT GetEncoderColorFormats(const std::string& mime_type);
62
63 bool RegisterMediaCodecUtil(JNIEnv* env);
64
65 } // namespace media
66
67 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698