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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 // Returns the buffer to the codec. If you previously specified a surface when | 150 // Returns the buffer to the codec. If you previously specified a surface when |
151 // configuring this video decoder you can optionally render the buffer. | 151 // configuring this video decoder you can optionally render the buffer. |
152 virtual void ReleaseOutputBuffer(int index, bool render) = 0; | 152 virtual void ReleaseOutputBuffer(int index, bool render) = 0; |
153 | 153 |
154 // Returns an input buffer's base pointer and capacity. | 154 // Returns an input buffer's base pointer and capacity. |
155 virtual MediaCodecStatus GetInputBuffer(int input_buffer_index, | 155 virtual MediaCodecStatus GetInputBuffer(int input_buffer_index, |
156 uint8_t** data, | 156 uint8_t** data, |
157 size_t* capacity) = 0; | 157 size_t* capacity) = 0; |
158 | 158 |
159 // Copy |num| bytes from output buffer |index|'s |offset| into the memory | 159 // Gives the access to buffer's data which is referenced by |index| and |
| 160 // |offset|. The size of available data for reading is written to |*capacity| |
| 161 // and the address is written to |*addr|. |
| 162 // Returns MEDIA_CODEC_ERROR if a error occurs, or MEDIA_CODEC_OK otherwise. |
| 163 virtual MediaCodecStatus GetOutputBufferAddress(int index, |
| 164 size_t offset, |
| 165 const uint8_t** addr, |
| 166 size_t* capacity) = 0; |
| 167 |
| 168 // Copies |num| bytes from output buffer |index|'s |offset| into the memory |
160 // region pointed to by |dst|. To avoid overflows, the size of both source | 169 // region pointed to by |dst|. To avoid overflows, the size of both source |
161 // and destination must be at least |num| bytes, and should not overlap. | 170 // and destination must be at least |num| bytes, and should not overlap. |
162 // Returns MEDIA_CODEC_ERROR if an error occurs, or MEDIA_CODEC_OK otherwise. | 171 // Returns MEDIA_CODEC_ERROR if an error occurs, or MEDIA_CODEC_OK otherwise. |
163 virtual MediaCodecStatus CopyFromOutputBuffer(int index, | 172 MediaCodecStatus CopyFromOutputBuffer(int index, |
164 size_t offset, | 173 size_t offset, |
165 void* dst, | 174 void* dst, |
166 size_t num) = 0; | 175 size_t num); |
167 | 176 |
168 protected: | 177 protected: |
169 MediaCodecBridge(); | 178 MediaCodecBridge(); |
170 | 179 |
171 // Fills a particular input buffer; returns false if |data_size| exceeds the | 180 // Fills a particular input buffer; returns false if |data_size| exceeds the |
172 // input buffer's capacity (and doesn't touch the input buffer in that case). | 181 // input buffer's capacity (and doesn't touch the input buffer in that case). |
173 bool FillInputBuffer(int index, | 182 bool FillInputBuffer(int index, |
174 const uint8_t* data, | 183 const uint8_t* data, |
175 size_t data_size) WARN_UNUSED_RESULT; | 184 size_t data_size) WARN_UNUSED_RESULT; |
176 | 185 |
177 DISALLOW_COPY_AND_ASSIGN(MediaCodecBridge); | 186 DISALLOW_COPY_AND_ASSIGN(MediaCodecBridge); |
178 }; | 187 }; |
179 | 188 |
180 } // namespace media | 189 } // namespace media |
181 | 190 |
182 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 191 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
OLD | NEW |