OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "media/filters/omx_video_decoder.h" | 5 #include "media/filters/omx_video_decoder.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "media/base/callback.h" | 9 #include "media/base/callback.h" |
10 #include "media/base/filter_host.h" | 10 #include "media/base/filter_host.h" |
11 #include "media/base/limits.h" | 11 #include "media/base/limits.h" |
12 #include "media/ffmpeg/ffmpeg_common.h" | 12 #include "media/ffmpeg/ffmpeg_common.h" |
13 #include "media/filters/ffmpeg_interfaces.h" | 13 #include "media/filters/ffmpeg_interfaces.h" |
14 #include "media/video/omx_video_decode_engine.h" | 14 #include "media/video/omx_video_decode_engine.h" |
15 | 15 |
16 namespace media { | 16 namespace media { |
17 | 17 |
18 OmxVideoDecoder::OmxVideoDecoder( | 18 OmxVideoDecoder::OmxVideoDecoder( |
| 19 MessageLoop* message_loop, |
19 VideoDecodeContext* context) | 20 VideoDecodeContext* context) |
20 : decode_engine_(new OmxVideoDecodeEngine()), | 21 : message_loop_(message_loop), |
| 22 decode_engine_(new OmxVideoDecodeEngine()), |
21 decode_context_(context), | 23 decode_context_(context), |
22 width_(0), height_(0) { | 24 width_(0), height_(0) { |
23 DCHECK(decode_engine_.get()); | 25 DCHECK(decode_engine_.get()); |
24 memset(&info_, 0, sizeof(info_)); | 26 memset(&info_, 0, sizeof(info_)); |
25 } | 27 } |
26 | 28 |
27 OmxVideoDecoder::~OmxVideoDecoder() { | 29 OmxVideoDecoder::~OmxVideoDecoder() { |
28 // TODO(hclam): Make sure OmxVideoDecodeEngine is stopped. | 30 // TODO(hclam): Make sure OmxVideoDecodeEngine is stopped. |
29 } | 31 } |
30 | 32 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 void OmxVideoDecoder::DemuxCompleteTask(Buffer* buffer) { | 229 void OmxVideoDecoder::DemuxCompleteTask(Buffer* buffer) { |
228 // We simply delicate the buffer to the right message loop. | 230 // We simply delicate the buffer to the right message loop. |
229 scoped_refptr<Buffer> ref_buffer = buffer; | 231 scoped_refptr<Buffer> ref_buffer = buffer; |
230 DCHECK(decode_engine_.get()); | 232 DCHECK(decode_engine_.get()); |
231 message_loop()->PostTask( | 233 message_loop()->PostTask( |
232 FROM_HERE, | 234 FROM_HERE, |
233 NewRunnableMethod(decode_engine_.get(), | 235 NewRunnableMethod(decode_engine_.get(), |
234 &VideoDecodeEngine::ConsumeVideoSample, ref_buffer)); | 236 &VideoDecodeEngine::ConsumeVideoSample, ref_buffer)); |
235 } | 237 } |
236 | 238 |
| 239 MessageLoop* OmxVideoDecoder::message_loop() { |
| 240 return message_loop_; |
| 241 } |
| 242 |
237 } // namespace media | 243 } // namespace media |
238 | 244 |
239 // Disable refcounting for the decode engine because it only lives on the | 245 // Disable refcounting for the decode engine because it only lives on the |
240 // video decoder thread. | 246 // video decoder thread. |
241 DISABLE_RUNNABLE_METHOD_REFCOUNT(media::VideoDecodeEngine); | 247 DISABLE_RUNNABLE_METHOD_REFCOUNT(media::VideoDecodeEngine); |
OLD | NEW |