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_SDK_MEDIA_CODEC_BRIDGE_H_ | 5 #ifndef MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_ |
6 #define MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_ | 6 #define MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 int* index, | 57 int* index, |
58 size_t* offset, | 58 size_t* offset, |
59 size_t* size, | 59 size_t* size, |
60 base::TimeDelta* presentation_time, | 60 base::TimeDelta* presentation_time, |
61 bool* end_of_stream, | 61 bool* end_of_stream, |
62 bool* key_frame) override; | 62 bool* key_frame) override; |
63 void ReleaseOutputBuffer(int index, bool render) override; | 63 void ReleaseOutputBuffer(int index, bool render) override; |
64 MediaCodecStatus GetInputBuffer(int input_buffer_index, | 64 MediaCodecStatus GetInputBuffer(int input_buffer_index, |
65 uint8_t** data, | 65 uint8_t** data, |
66 size_t* capacity) override; | 66 size_t* capacity) override; |
67 MediaCodecStatus GetOutputBufferAddress(int index, | 67 MediaCodecStatus CopyFromOutputBuffer(int index, |
68 size_t offset, | 68 size_t offset, |
69 const uint8_t** addr, | 69 void* dst, |
70 size_t* capacity) override; | 70 size_t num) override; |
71 | 71 |
72 static bool RegisterSdkMediaCodecBridge(JNIEnv* env); | 72 static bool RegisterSdkMediaCodecBridge(JNIEnv* env); |
73 | 73 |
74 protected: | 74 protected: |
75 SdkMediaCodecBridge(const std::string& mime, | 75 SdkMediaCodecBridge(const std::string& mime, |
76 bool is_secure, | 76 bool is_secure, |
77 MediaCodecDirection direction); | 77 MediaCodecDirection direction); |
78 | 78 |
| 79 // Called to get the buffer address given the output buffer index and offset. |
| 80 // The size of available data to read is written to |*capacity| and the |
| 81 // address to read from is written to |*addr|. |
| 82 // Returns MEDIA_CODEC_ERROR if a error occurs, or MEDIA_CODEC_OK otherwise. |
| 83 MediaCodecStatus GetOutputBufferAddress(int index, |
| 84 size_t offset, |
| 85 void** addr, |
| 86 size_t* capacity); |
79 | 87 |
80 jobject media_codec() { return j_media_codec_.obj(); } | 88 jobject media_codec() { return j_media_codec_.obj(); } |
81 MediaCodecDirection direction_; | 89 MediaCodecDirection direction_; |
82 | 90 |
83 private: | 91 private: |
84 // Java MediaCodec instance. | 92 // Java MediaCodec instance. |
85 base::android::ScopedJavaGlobalRef<jobject> j_media_codec_; | 93 base::android::ScopedJavaGlobalRef<jobject> j_media_codec_; |
86 | 94 |
87 DISALLOW_COPY_AND_ASSIGN(SdkMediaCodecBridge); | 95 DISALLOW_COPY_AND_ASSIGN(SdkMediaCodecBridge); |
88 }; | 96 }; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 VideoCodecBridge(const std::string& mime, | 206 VideoCodecBridge(const std::string& mime, |
199 bool is_secure, | 207 bool is_secure, |
200 MediaCodecDirection direction); | 208 MediaCodecDirection direction); |
201 | 209 |
202 int adaptive_playback_supported_for_testing_; | 210 int adaptive_playback_supported_for_testing_; |
203 }; | 211 }; |
204 | 212 |
205 } // namespace media | 213 } // namespace media |
206 | 214 |
207 #endif // MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_ | 215 #endif // MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_ |
OLD | NEW |