Chromium Code Reviews| 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 21 matching lines...) Expand all Loading... | |
| 32 INFO_TRY_AGAIN_LATER = -1, | 32 INFO_TRY_AGAIN_LATER = -1, |
| 33 INFO_MEDIA_CODEC_ERROR = -1000, | 33 INFO_MEDIA_CODEC_ERROR = -1000, |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 static const base::TimeDelta kTimeOutInfinity; | 36 static const base::TimeDelta kTimeOutInfinity; |
| 37 static const base::TimeDelta kTimeOutNoWait; | 37 static const base::TimeDelta kTimeOutNoWait; |
| 38 | 38 |
| 39 // Returns true if MediaCodec is available on the device. | 39 // Returns true if MediaCodec is available on the device. |
| 40 static bool IsAvailable(); | 40 static bool IsAvailable(); |
| 41 | 41 |
| 42 // Returns if MediaCodecBridge can play |mime| type in |secure| mode. | |
|
ddorwin
2013/08/27 18:14:19
1) Is |mime| the correct name?
2) Who is converti
xhwang
2013/08/28 01:21:24
Current code uses AudioCodecToMimeType and VideoCo
ddorwin
2013/08/28 02:28:50
I think we should hide these platform-specific str
xhwang
2013/08/28 18:19:15
I agree that we should not expose this non-standar
| |
| 43 static bool CanPlayType(const char* mime, bool secure); | |
|
ddorwin
2013/08/27 18:14:19
Why not use "const std::string&" ?
xhwang
2013/08/28 01:21:24
Done.
| |
| 44 | |
| 42 virtual ~MediaCodecBridge(); | 45 virtual ~MediaCodecBridge(); |
| 43 | 46 |
| 44 // Resets both input and output, all indices previously returned in calls to | 47 // Resets both input and output, all indices previously returned in calls to |
| 45 // DequeueInputBuffer() and DequeueOutputBuffer() become invalid. | 48 // DequeueInputBuffer() and DequeueOutputBuffer() become invalid. |
| 46 // Please note that this clears all the inputs in the media codec. In other | 49 // Please note that this clears all the inputs in the media codec. In other |
| 47 // words, there will be no outputs until new input is provided. | 50 // words, there will be no outputs until new input is provided. |
| 48 void Reset(); | 51 void Reset(); |
| 49 | 52 |
| 50 // Finishes the decode/encode session. The instance remains active | 53 // Finishes the decode/encode session. The instance remains active |
| 51 // and ready to be StartAudio/Video()ed again. HOWEVER, due to the buggy | 54 // and ready to be StartAudio/Video()ed again. HOWEVER, due to the buggy |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 // when configuring this video decoder you can optionally render the buffer. | 96 // when configuring this video decoder you can optionally render the buffer. |
| 94 void ReleaseOutputBuffer(int index, bool render); | 97 void ReleaseOutputBuffer(int index, bool render); |
| 95 | 98 |
| 96 // Gets output buffers from media codec and keeps them inside the java class. | 99 // Gets output buffers from media codec and keeps them inside the java class. |
| 97 // To access them, use DequeueOutputBuffer(). | 100 // To access them, use DequeueOutputBuffer(). |
| 98 void GetOutputBuffers(); | 101 void GetOutputBuffers(); |
| 99 | 102 |
| 100 static bool RegisterMediaCodecBridge(JNIEnv* env); | 103 static bool RegisterMediaCodecBridge(JNIEnv* env); |
| 101 | 104 |
| 102 protected: | 105 protected: |
| 103 explicit MediaCodecBridge(const char* mime); | 106 explicit MediaCodecBridge(const char* mime); |
|
ddorwin
2013/08/27 18:14:19
same x2
And the Audio/Video subclasses.
xhwang
2013/08/28 01:21:24
ditto
| |
| 104 | 107 |
| 105 // Calls start() against the media codec instance. Used in StartXXX() after | 108 // Calls start() against the media codec instance. Used in StartXXX() after |
| 106 // configuring media codec. | 109 // configuring media codec. |
| 107 void StartInternal(); | 110 void StartInternal(); |
| 108 | 111 |
| 109 jobject media_codec() { return j_media_codec_.obj(); } | 112 jobject media_codec() { return j_media_codec_.obj(); } |
| 110 | 113 |
| 111 private: | 114 private: |
| 112 // Fills a particular input buffer and returns the size of copied data. | 115 // Fills a particular input buffer and returns the size of copied data. |
| 113 size_t FillInputBuffer(int index, const uint8* data, int data_size); | 116 size_t FillInputBuffer(int index, const uint8* data, int data_size); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 jobject media_crypto); | 159 jobject media_crypto); |
| 157 | 160 |
| 158 private: | 161 private: |
| 159 explicit VideoCodecBridge(const char* mime); | 162 explicit VideoCodecBridge(const char* mime); |
| 160 }; | 163 }; |
| 161 | 164 |
| 162 } // namespace media | 165 } // namespace media |
| 163 | 166 |
| 164 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 167 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
| 165 | 168 |
| OLD | NEW |