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 "media/base/callback.h" | 8 #include "media/base/callback.h" |
9 #include "media/base/factory.h" | 9 #include "media/base/factory.h" |
10 #include "media/base/filter_host.h" | 10 #include "media/base/filter_host.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 | 66 |
67 void OmxVideoDecoder::FillThisBuffer(scoped_refptr<VideoFrame> frame) { | 67 void OmxVideoDecoder::FillThisBuffer(scoped_refptr<VideoFrame> frame) { |
68 DCHECK(omx_engine_.get()); | 68 DCHECK(omx_engine_.get()); |
69 message_loop()->PostTask( | 69 message_loop()->PostTask( |
70 FROM_HERE, | 70 FROM_HERE, |
71 NewRunnableMethod(omx_engine_.get(), | 71 NewRunnableMethod(omx_engine_.get(), |
72 &OmxVideoDecodeEngine::FillThisBuffer, frame)); | 72 &OmxVideoDecodeEngine::FillThisBuffer, frame)); |
73 } | 73 } |
74 | 74 |
| 75 bool OmxVideoDecoder::ProvidesBuffer() { |
| 76 if (!omx_engine_.get()) return false; |
| 77 return omx_engine_->ProvidesBuffer(); |
| 78 } |
| 79 |
75 void OmxVideoDecoder::Stop(FilterCallback* callback) { | 80 void OmxVideoDecoder::Stop(FilterCallback* callback) { |
76 omx_engine_->Stop( | 81 omx_engine_->Stop( |
77 NewRunnableMethod(this, | 82 NewRunnableMethod(this, |
78 &OmxVideoDecoder::StopCompleteTask, callback)); | 83 &OmxVideoDecoder::StopCompleteTask, callback)); |
79 } | 84 } |
80 | 85 |
81 void OmxVideoDecoder::StopCompleteTask(FilterCallback* callback) { | 86 void OmxVideoDecoder::StopCompleteTask(FilterCallback* callback) { |
82 AutoCallbackRunner done_runner(callback); | 87 AutoCallbackRunner done_runner(callback); |
83 } | 88 } |
84 | 89 |
85 void OmxVideoDecoder::Pause(FilterCallback* callback) { | 90 void OmxVideoDecoder::Pause(FilterCallback* callback) { |
86 omx_engine_->Pause( | 91 omx_engine_->Pause( |
87 NewRunnableMethod(this, | 92 NewRunnableMethod(this, |
88 &OmxVideoDecoder::PauseCompleteTask, callback)); | 93 &OmxVideoDecoder::PauseCompleteTask, callback)); |
89 } | 94 } |
90 | 95 |
91 void OmxVideoDecoder::PauseCompleteTask(FilterCallback* callback) { | 96 void OmxVideoDecoder::PauseCompleteTask(FilterCallback* callback) { |
92 AutoCallbackRunner done_runner(callback); | 97 AutoCallbackRunner done_runner(callback); |
93 } | 98 } |
94 | 99 |
| 100 void OmxVideoDecoder::Flush(FilterCallback* callback) { |
| 101 omx_engine_->Flush( |
| 102 NewRunnableMethod(this, |
| 103 &OmxVideoDecoder::FlushCompleteTask, callback)); |
| 104 } |
| 105 |
| 106 void OmxVideoDecoder::FlushCompleteTask(FilterCallback* callback) { |
| 107 AutoCallbackRunner done_runner(callback); |
| 108 } |
| 109 |
95 void OmxVideoDecoder::Seek(base::TimeDelta time, | 110 void OmxVideoDecoder::Seek(base::TimeDelta time, |
96 FilterCallback* callback) { | 111 FilterCallback* callback) { |
97 omx_engine_->Flush( | 112 omx_engine_->Seek( |
98 NewRunnableMethod(this, | 113 NewRunnableMethod(this, |
99 &OmxVideoDecoder::SeekCompleteTask, callback)); | 114 &OmxVideoDecoder::SeekCompleteTask, callback)); |
100 } | 115 } |
101 | 116 |
102 void OmxVideoDecoder::SeekCompleteTask(FilterCallback* callback) { | 117 void OmxVideoDecoder::SeekCompleteTask(FilterCallback* callback) { |
103 AutoCallbackRunner done_runner(callback); | 118 AutoCallbackRunner done_runner(callback); |
104 } | 119 } |
105 | 120 |
106 void OmxVideoDecoder::DoInitialize(DemuxerStream* demuxer_stream, | 121 void OmxVideoDecoder::DoInitialize(DemuxerStream* demuxer_stream, |
107 FilterCallback* callback) { | 122 FilterCallback* callback) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // We simply delicate the buffer to the right message loop. | 192 // We simply delicate the buffer to the right message loop. |
178 scoped_refptr<Buffer> ref_buffer = buffer; | 193 scoped_refptr<Buffer> ref_buffer = buffer; |
179 DCHECK(omx_engine_.get()); | 194 DCHECK(omx_engine_.get()); |
180 message_loop()->PostTask( | 195 message_loop()->PostTask( |
181 FROM_HERE, | 196 FROM_HERE, |
182 NewRunnableMethod(omx_engine_.get(), | 197 NewRunnableMethod(omx_engine_.get(), |
183 &OmxVideoDecodeEngine::EmptyThisBuffer, ref_buffer)); | 198 &OmxVideoDecodeEngine::EmptyThisBuffer, ref_buffer)); |
184 } | 199 } |
185 | 200 |
186 } // namespace media | 201 } // namespace media |
OLD | NEW |