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 // Gives the access to buffer's data which is referenced by |index| and | 159 // Copy |num| bytes from output buffer |index|'s |offset| into the memory |
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 | |
169 // region pointed to by |dst|. To avoid overflows, the size of both source | 160 // region pointed to by |dst|. To avoid overflows, the size of both source |
170 // and destination must be at least |num| bytes, and should not overlap. | 161 // and destination must be at least |num| bytes, and should not overlap. |
171 // Returns MEDIA_CODEC_ERROR if an error occurs, or MEDIA_CODEC_OK otherwise. | 162 // Returns MEDIA_CODEC_ERROR if an error occurs, or MEDIA_CODEC_OK otherwise. |
172 MediaCodecStatus CopyFromOutputBuffer(int index, | 163 virtual MediaCodecStatus CopyFromOutputBuffer(int index, |
173 size_t offset, | 164 size_t offset, |
174 void* dst, | 165 void* dst, |
175 size_t num); | 166 size_t num) = 0; |
176 | 167 |
177 protected: | 168 protected: |
178 MediaCodecBridge(); | 169 MediaCodecBridge(); |
179 | 170 |
180 // Fills a particular input buffer; returns false if |data_size| exceeds the | 171 // Fills a particular input buffer; returns false if |data_size| exceeds the |
181 // input buffer's capacity (and doesn't touch the input buffer in that case). | 172 // input buffer's capacity (and doesn't touch the input buffer in that case). |
182 bool FillInputBuffer(int index, | 173 bool FillInputBuffer(int index, |
183 const uint8_t* data, | 174 const uint8_t* data, |
184 size_t data_size) WARN_UNUSED_RESULT; | 175 size_t data_size) WARN_UNUSED_RESULT; |
185 | 176 |
186 DISALLOW_COPY_AND_ASSIGN(MediaCodecBridge); | 177 DISALLOW_COPY_AND_ASSIGN(MediaCodecBridge); |
187 }; | 178 }; |
188 | 179 |
189 } // namespace media | 180 } // namespace media |
190 | 181 |
191 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 182 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
OLD | NEW |