OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #include "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
8 #include "media/omx/input_buffer.h" | 8 #include "media/omx/input_buffer.h" |
9 #include "media/omx/omx_video_decoder.h" | 9 #include "media/omx/omx_video_decoder.h" |
10 | 10 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 // 4. Device specific configurations. | 264 // 4. Device specific configurations. |
265 // 5. General configuration of input port. | 265 // 5. General configuration of input port. |
266 // 6. General configuration of output port. | 266 // 6. General configuration of output port. |
267 // 7. Get Parameters about input port. | 267 // 7. Get Parameters about input port. |
268 // 8. Get Parameters about output port. | 268 // 8. Get Parameters about output port. |
269 // 9. Codec specific configurations. | 269 // 9. Codec specific configurations. |
270 void OmxVideoDecoder::Transition_EmptyToLoaded() { | 270 void OmxVideoDecoder::Transition_EmptyToLoaded() { |
271 DCHECK_EQ(message_loop_, MessageLoop::current()); | 271 DCHECK_EQ(message_loop_, MessageLoop::current()); |
272 DCHECK_EQ(kEmpty, GetState()); | 272 DCHECK_EQ(kEmpty, GetState()); |
273 | 273 |
274 const char* component; | |
275 OMX_CALLBACKTYPE callback = { &EventHandler, | 274 OMX_CALLBACKTYPE callback = { &EventHandler, |
276 &EmptyBufferCallback, | 275 &EmptyBufferCallback, |
277 &FillBufferCallback }; | 276 &FillBufferCallback }; |
278 | 277 |
279 // 1. Initialize the OpenMAX Core. | 278 // 1. Initialize the OpenMAX Core. |
280 // TODO(hclam): move this out. | 279 // TODO(hclam): move this out. |
281 OMX_ERRORTYPE omxresult = OMX_Init(); | 280 OMX_ERRORTYPE omxresult = OMX_Init(); |
282 if (omxresult != OMX_ErrorNone) { | 281 if (omxresult != OMX_ErrorNone) { |
283 LOG(ERROR) << "Error - Failed to Init OpenMAX core"; | 282 LOG(ERROR) << "Error - Failed to Init OpenMAX core"; |
284 StateTransitionTask(kError); | 283 StateTransitionTask(kError); |
285 return; | 284 return; |
286 } | 285 } |
287 | 286 |
288 // 2. Get the handle to the component. After OMX_GetHandle(), | 287 // 2. Get the handle to the component. After OMX_GetHandle(), |
289 // the component is in loaded state. | 288 // the component is in loaded state. |
290 // TODO(hclam): We should have a list of componant names instead. | 289 // TODO(hclam): We should have a list of componant names instead. |
291 component = component_; | 290 OMX_STRING component = const_cast<OMX_STRING>(component_); |
292 omxresult = OMX_GetHandle((OMX_HANDLETYPE*)(&decoder_handle_), | 291 OMX_HANDLETYPE handle = reinterpret_cast<OMX_HANDLETYPE>(decoder_handle_); |
293 (OMX_STRING)component, this, &callback); | 292 omxresult = OMX_GetHandle(&handle, component, this, &callback); |
| 293 decoder_handle_ = reinterpret_cast<OMX_COMPONENTTYPE*>(handle); |
294 if (omxresult != OMX_ErrorNone) { | 294 if (omxresult != OMX_ErrorNone) { |
295 LOG(ERROR) << "Failed to Load the component: " << component; | 295 LOG(ERROR) << "Failed to Load the component: " << component; |
296 StateTransitionTask(kError); | 296 StateTransitionTask(kError); |
297 return; | 297 return; |
298 } | 298 } |
299 | 299 |
300 // 3. Get the port information. This will obtain information about the | 300 // 3. Get the port information. This will obtain information about the |
301 // number of ports and index of the first port. | 301 // number of ports and index of the first port. |
302 OMX_PORT_PARAM_TYPE port_param; | 302 OMX_PORT_PARAM_TYPE port_param; |
303 ResetPortHeader(*this, &port_param); | 303 ResetPortHeader(*this, &port_param); |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 OMX_ERRORTYPE OmxVideoDecoder::FillBufferCallback( | 1094 OMX_ERRORTYPE OmxVideoDecoder::FillBufferCallback( |
1095 OMX_HANDLETYPE component, | 1095 OMX_HANDLETYPE component, |
1096 OMX_PTR priv_data, | 1096 OMX_PTR priv_data, |
1097 OMX_BUFFERHEADERTYPE* buffer) { | 1097 OMX_BUFFERHEADERTYPE* buffer) { |
1098 OmxVideoDecoder* decoder = static_cast<OmxVideoDecoder*>(priv_data); | 1098 OmxVideoDecoder* decoder = static_cast<OmxVideoDecoder*>(priv_data); |
1099 decoder->FillBufferCallbackInternal(component, buffer); | 1099 decoder->FillBufferCallbackInternal(component, buffer); |
1100 return OMX_ErrorNone; | 1100 return OMX_ErrorNone; |
1101 } | 1101 } |
1102 | 1102 |
1103 } // namespace media | 1103 } // namespace media |
OLD | NEW |