OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <dlfcn.h> | 8 #include <dlfcn.h> |
9 #include <map> | 9 #include <map> |
10 #include <queue> | 10 #include <queue> |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // current state (and outstanding state change) of the component. | 130 // current state (and outstanding state change) of the component. |
131 bool CanFillBuffer(); | 131 bool CanFillBuffer(); |
132 | 132 |
133 // Whenever port settings change, the first thing we must do is disable the | 133 // Whenever port settings change, the first thing we must do is disable the |
134 // port (see Figure 3-18 of the OpenMAX IL spec linked to above). When the | 134 // port (see Figure 3-18 of the OpenMAX IL spec linked to above). When the |
135 // port is disabled, the component will call us back here. We then re-enable | 135 // port is disabled, the component will call us back here. We then re-enable |
136 // the port once we have textures, and that's the second method below. | 136 // the port once we have textures, and that's the second method below. |
137 void OnOutputPortDisabled(); | 137 void OnOutputPortDisabled(); |
138 void OnOutputPortEnabled(); | 138 void OnOutputPortEnabled(); |
139 | 139 |
| 140 // Decode bitstream buffers that were queued (see queued_bitstream_buffers_). |
| 141 void DecodeQueuedBitstreamBuffers(); |
| 142 |
140 // IL-client state. | 143 // IL-client state. |
141 OMX_STATETYPE client_state_; | 144 OMX_STATETYPE client_state_; |
142 // See comment on CurrentStateChange above. | 145 // See comment on CurrentStateChange above. |
143 CurrentStateChange current_state_change_; | 146 CurrentStateChange current_state_change_; |
144 // TODO(fischman): come up with a better scheme than this. There must be some | 147 // TODO(fischman): come up with a better scheme than this. There must be some |
145 // way that OMX signals to its client that EmptyBufferDone/FillBufferDone | 148 // way that OMX signals to its client that EmptyBufferDone/FillBufferDone |
146 // callbacks are the result of port-flushing as opposed to normal operation. | 149 // callbacks are the result of port-flushing as opposed to normal operation. |
147 bool saw_eos_during_flush_; | 150 bool saw_eos_during_flush_; |
148 | 151 |
149 // Following are input port related variables. | 152 // Following are input port related variables. |
(...skipping 18 matching lines...) Expand all Loading... |
168 // For output buffer recycling cases. | 171 // For output buffer recycling cases. |
169 OutputPictureById pictures_; | 172 OutputPictureById pictures_; |
170 | 173 |
171 // To kick the component from Loaded to Idle before we know the real size of | 174 // To kick the component from Loaded to Idle before we know the real size of |
172 // the video (so can't yet ask for textures) we populate it with fake output | 175 // the video (so can't yet ask for textures) we populate it with fake output |
173 // buffers. Keep track of them here. | 176 // buffers. Keep track of them here. |
174 // TODO(fischman): do away with this madness. | 177 // TODO(fischman): do away with this madness. |
175 std::set<OMX_BUFFERHEADERTYPE*> fake_output_buffers_; | 178 std::set<OMX_BUFFERHEADERTYPE*> fake_output_buffers_; |
176 | 179 |
177 // Encoded bitstream buffers awaiting decode, queued while the decoder was | 180 // Encoded bitstream buffers awaiting decode, queued while the decoder was |
178 // Resetting and thus unable to accept them. This will be empty most of the | 181 // unable to accept them. |
179 // time, is populated when Decode()'s are received between Reset() is called | |
180 // and NotifyResetDone() is sent, and is drained right before | |
181 // NotifyResetDone() is sent. | |
182 typedef std::vector<media::BitstreamBuffer> BitstreamBufferList; | 182 typedef std::vector<media::BitstreamBuffer> BitstreamBufferList; |
183 BitstreamBufferList queued_bitstream_buffers_; | 183 BitstreamBufferList queued_bitstream_buffers_; |
184 // Available output picture buffers released during Reset() and awaiting | 184 // Available output picture buffers released during Reset() and awaiting |
185 // re-use once Reset is done. Is empty most of the time and drained right | 185 // re-use once Reset is done. Is empty most of the time and drained right |
186 // before NotifyResetDone is sent. | 186 // before NotifyResetDone is sent. |
187 std::vector<int> queued_picture_buffer_ids_; | 187 std::vector<int> queued_picture_buffer_ids_; |
188 | 188 |
189 // To expose client callbacks from VideoDecodeAccelerator. | 189 // To expose client callbacks from VideoDecodeAccelerator. |
190 // NOTE: all calls to this object *MUST* be executed in message_loop_. | 190 // NOTE: all calls to this object *MUST* be executed in message_loop_. |
191 Client* client_; | 191 Client* client_; |
(...skipping 23 matching lines...) Expand all Loading... |
215 OMX_PTR event_data); | 215 OMX_PTR event_data); |
216 static OMX_ERRORTYPE EmptyBufferCallback(OMX_HANDLETYPE component, | 216 static OMX_ERRORTYPE EmptyBufferCallback(OMX_HANDLETYPE component, |
217 OMX_PTR priv_data, | 217 OMX_PTR priv_data, |
218 OMX_BUFFERHEADERTYPE* buffer); | 218 OMX_BUFFERHEADERTYPE* buffer); |
219 static OMX_ERRORTYPE FillBufferCallback(OMX_HANDLETYPE component, | 219 static OMX_ERRORTYPE FillBufferCallback(OMX_HANDLETYPE component, |
220 OMX_PTR priv_data, | 220 OMX_PTR priv_data, |
221 OMX_BUFFERHEADERTYPE* buffer); | 221 OMX_BUFFERHEADERTYPE* buffer); |
222 }; | 222 }; |
223 | 223 |
224 #endif // CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ | 224 #endif // CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |