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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/stl_util-inl.h" | 6 #include "base/stl_util-inl.h" |
7 #include "media/omx/input_buffer.h" | 7 #include "media/omx/input_buffer.h" |
8 #include "media/omx/omx_video_decoder.h" | 8 #include "media/omx/omx_video_decoder.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
(...skipping 17 matching lines...) Expand all Loading... |
28 OmxVideoDecoder::~OmxVideoDecoder() { | 28 OmxVideoDecoder::~OmxVideoDecoder() { |
29 DCHECK(state_ == kError || state_ == kEmpty); | 29 DCHECK(state_ == kError || state_ == kEmpty); |
30 DCHECK_EQ(0u, input_buffers_.size()); | 30 DCHECK_EQ(0u, input_buffers_.size()); |
31 DCHECK_EQ(0u, output_buffers_.size()); | 31 DCHECK_EQ(0u, output_buffers_.size()); |
32 DCHECK(available_input_buffers_.empty()); | 32 DCHECK(available_input_buffers_.empty()); |
33 DCHECK(available_output_buffers_.empty()); | 33 DCHECK(available_output_buffers_.empty()); |
34 DCHECK(input_queue_.empty()); | 34 DCHECK(input_queue_.empty()); |
35 DCHECK(output_queue_.empty()); | 35 DCHECK(output_queue_.empty()); |
36 } | 36 } |
37 | 37 |
38 void OmxVideoDecoder::Setup(Codec codec) { | 38 void OmxVideoDecoder::Setup(const char* component, Codec codec) { |
39 DCHECK_EQ(kEmpty, GetState()); | 39 DCHECK_EQ(kEmpty, state_); |
| 40 component_ = component; |
40 codec_ = codec; | 41 codec_ = codec; |
41 } | 42 } |
42 | 43 |
43 void OmxVideoDecoder::SetErrorCallback(Callback* callback) { | 44 void OmxVideoDecoder::SetErrorCallback(Callback* callback) { |
44 DCHECK_EQ(kEmpty, GetState()); | 45 DCHECK_EQ(kEmpty, state_); |
45 error_callback_.reset(callback); | 46 error_callback_.reset(callback); |
46 } | 47 } |
47 | 48 |
48 void OmxVideoDecoder::Start() { | 49 void OmxVideoDecoder::Start() { |
49 DCHECK_NE(kCodecNone, codec_); | 50 DCHECK_NE(kCodecNone, codec_); |
50 | 51 |
51 message_loop_->PostTask( | 52 message_loop_->PostTask( |
52 FROM_HERE, | 53 FROM_HERE, |
53 NewRunnableMethod(this, &OmxVideoDecoder::StartTask)); | 54 NewRunnableMethod(this, &OmxVideoDecoder::StartTask)); |
54 } | 55 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // TODO(hclam): move this out. | 272 // TODO(hclam): move this out. |
272 OMX_ERRORTYPE omxresult = OMX_Init(); | 273 OMX_ERRORTYPE omxresult = OMX_Init(); |
273 if (omxresult != OMX_ErrorNone) { | 274 if (omxresult != OMX_ErrorNone) { |
274 printf("Error - Failed to Init OpenMAX core\n"); | 275 printf("Error - Failed to Init OpenMAX core\n"); |
275 StateTransitionTask(kError); | 276 StateTransitionTask(kError); |
276 return; | 277 return; |
277 } | 278 } |
278 | 279 |
279 // 2. Get the handle to the component. After OMX_GetHandle(), | 280 // 2. Get the handle to the component. After OMX_GetHandle(), |
280 // the component is in loaded state. | 281 // the component is in loaded state. |
281 component = GetComponentName(codec_); | 282 // TODO(hclam): We should have a list of componant names instead. |
| 283 component = component_; |
282 omxresult = OMX_GetHandle((OMX_HANDLETYPE*)(&decoder_handle_), | 284 omxresult = OMX_GetHandle((OMX_HANDLETYPE*)(&decoder_handle_), |
283 (OMX_STRING)component, this, &callback); | 285 (OMX_STRING)component, this, &callback); |
284 if (omxresult != OMX_ErrorNone) { | 286 if (omxresult != OMX_ErrorNone) { |
285 printf("Failed to Load the component: %s\n", component); | 287 printf("Failed to Load the component: %s\n", component); |
286 StateTransitionTask(kError); | 288 StateTransitionTask(kError); |
287 return; | 289 return; |
288 } | 290 } |
289 | 291 |
290 // 3. Get the port information. This will obtain information about the | 292 // 3. Get the port information. This will obtain information about the |
291 // number of ports and index of the first port. | 293 // number of ports and index of the first port. |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 OMX_ERRORTYPE OmxVideoDecoder::FillBufferCallback( | 1091 OMX_ERRORTYPE OmxVideoDecoder::FillBufferCallback( |
1090 OMX_HANDLETYPE component, | 1092 OMX_HANDLETYPE component, |
1091 OMX_PTR priv_data, | 1093 OMX_PTR priv_data, |
1092 OMX_BUFFERHEADERTYPE* buffer) { | 1094 OMX_BUFFERHEADERTYPE* buffer) { |
1093 OmxVideoDecoder* decoder = static_cast<OmxVideoDecoder*>(priv_data); | 1095 OmxVideoDecoder* decoder = static_cast<OmxVideoDecoder*>(priv_data); |
1094 decoder->FillBufferCallbackInternal(component, buffer); | 1096 decoder->FillBufferCallbackInternal(component, buffer); |
1095 return OMX_ErrorNone; | 1097 return OMX_ErrorNone; |
1096 } | 1098 } |
1097 | 1099 |
1098 } // namespace media | 1100 } // namespace media |
OLD | NEW |