| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_BRIDGE_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
| 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 class MEDIA_EXPORT MediaCodecBridge { | 51 class MEDIA_EXPORT MediaCodecBridge { |
| 52 public: | 52 public: |
| 53 // Returns true if MediaCodec is available on the device. | 53 // Returns true if MediaCodec is available on the device. |
| 54 // All other static methods check IsAvailable() internally. There's no need | 54 // All other static methods check IsAvailable() internally. There's no need |
| 55 // to check IsAvailable() explicitly before calling them. | 55 // to check IsAvailable() explicitly before calling them. |
| 56 static bool IsAvailable(); | 56 static bool IsAvailable(); |
| 57 | 57 |
| 58 // Returns true if MediaCodec.setParameters() is available on the device. | 58 // Returns true if MediaCodec.setParameters() is available on the device. |
| 59 static bool SupportsSetParameters(); | 59 static bool SupportsSetParameters(); |
| 60 | 60 |
| 61 // Returns true if MediaCodec.getName() is available on the device. |
| 62 static bool SupportsGetName(); |
| 63 |
| 61 // Returns whether MediaCodecBridge has a decoder that |is_secure| and can | 64 // Returns whether MediaCodecBridge has a decoder that |is_secure| and can |
| 62 // decode |codec| type. | 65 // decode |codec| type. |
| 63 static bool CanDecode(const std::string& codec, bool is_secure); | 66 static bool CanDecode(const std::string& codec, bool is_secure); |
| 64 | 67 |
| 65 // Represents supported codecs on android. | 68 // Represents supported codecs on android. |
| 66 // TODO(qinmin): Currently the codecs string only contains one codec. Do we | 69 // TODO(qinmin): Currently the codecs string only contains one codec. Do we |
| 67 // need to support codecs separated by comma. (e.g. "vp8" -> "vp8, vp8.0")? | 70 // need to support codecs separated by comma. (e.g. "vp8" -> "vp8, vp8.0")? |
| 68 struct CodecsInfo { | 71 struct CodecsInfo { |
| 69 std::string codecs; // E.g. "vp8" or "avc1". | 72 std::string codecs; // E.g. "vp8" or "avc1". |
| 70 std::string name; // E.g. "OMX.google.vp8.decoder". | 73 std::string name; // E.g. "OMX.google.vp8.decoder". |
| 71 MediaCodecDirection direction; | 74 MediaCodecDirection direction; |
| 72 }; | 75 }; |
| 73 | 76 |
| 74 // Get a list of supported codecs. | 77 // Get a list of supported codecs. |
| 75 static std::vector<CodecsInfo> GetCodecsInfo(); | 78 static std::vector<CodecsInfo> GetCodecsInfo(); |
| 76 | 79 |
| 80 // Get default codec name for |mime_type|. |
| 81 static std::string GetDefaultCodecName(const std::string& mime_type, |
| 82 MediaCodecDirection direction); |
| 83 |
| 77 virtual ~MediaCodecBridge(); | 84 virtual ~MediaCodecBridge(); |
| 78 | 85 |
| 79 // Resets both input and output, all indices previously returned in calls to | 86 // Resets both input and output, all indices previously returned in calls to |
| 80 // DequeueInputBuffer() and DequeueOutputBuffer() become invalid. | 87 // DequeueInputBuffer() and DequeueOutputBuffer() become invalid. |
| 81 // Please note that this clears all the inputs in the media codec. In other | 88 // Please note that this clears all the inputs in the media codec. In other |
| 82 // words, there will be no outputs until new input is provided. | 89 // words, there will be no outputs until new input is provided. |
| 83 // Returns MEDIA_CODEC_ERROR if an unexpected error happens, or Media_CODEC_OK | 90 // Returns MEDIA_CODEC_ERROR if an unexpected error happens, or Media_CODEC_OK |
| 84 // otherwise. | 91 // otherwise. |
| 85 MediaCodecStatus Reset(); | 92 MediaCodecStatus Reset(); |
| 86 | 93 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 VideoCodecBridge(const std::string& mime, | 288 VideoCodecBridge(const std::string& mime, |
| 282 bool is_secure, | 289 bool is_secure, |
| 283 MediaCodecDirection direction); | 290 MediaCodecDirection direction); |
| 284 | 291 |
| 285 int adaptive_playback_supported_for_testing_; | 292 int adaptive_playback_supported_for_testing_; |
| 286 }; | 293 }; |
| 287 | 294 |
| 288 } // namespace media | 295 } // namespace media |
| 289 | 296 |
| 290 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 297 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
| OLD | NEW |