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 "chrome/renderer/media/ipc_video_decoder.h" | 5 #include "chrome/renderer/media/ipc_video_decoder.h" |
6 | 6 |
7 #include "base/task.h" | 7 #include "base/task.h" |
8 #include "chrome/common/child_process.h" | 8 #include "chrome/common/child_process.h" |
9 #include "chrome/renderer/ggl/ggl.h" | 9 #include "chrome/renderer/ggl/ggl.h" |
10 #include "media/base/callback.h" | 10 #include "media/base/callback.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 memset(¶m, 0, sizeof(param)); | 69 memset(¶m, 0, sizeof(param)); |
70 param.width = width_; | 70 param.width = width_; |
71 param.height = height_; | 71 param.height = height_; |
72 | 72 |
73 // VideoDecodeEngine will perform initialization on the message loop | 73 // VideoDecodeEngine will perform initialization on the message loop |
74 // given to it so it doesn't matter on which thread we are calling this. | 74 // given to it so it doesn't matter on which thread we are calling this. |
75 decode_engine_->Initialize(ChildProcess::current()->io_message_loop(), this, | 75 decode_engine_->Initialize(ChildProcess::current()->io_message_loop(), this, |
76 decode_context_.get(), param); | 76 decode_context_.get(), param); |
77 } | 77 } |
78 | 78 |
| 79 const media::MediaFormat& IpcVideoDecoder::media_format() { |
| 80 return media_format_; |
| 81 } |
| 82 |
79 void IpcVideoDecoder::Stop(media::FilterCallback* callback) { | 83 void IpcVideoDecoder::Stop(media::FilterCallback* callback) { |
80 stop_callback_.reset(callback); | 84 stop_callback_.reset(callback); |
81 decode_engine_->Uninitialize(); | 85 decode_engine_->Uninitialize(); |
82 } | 86 } |
83 | 87 |
84 void IpcVideoDecoder::Pause(media::FilterCallback* callback) { | 88 void IpcVideoDecoder::Pause(media::FilterCallback* callback) { |
85 // TODO(hclam): It looks like that pause is not necessary so implement this | 89 // TODO(hclam): It looks like that pause is not necessary so implement this |
86 // later. | 90 // later. |
87 callback->Run(); | 91 callback->Run(); |
88 delete callback; | 92 delete callback; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // occur as soon as refcount goes to 0. | 172 // occur as soon as refcount goes to 0. |
169 } | 173 } |
170 | 174 |
171 // This method is called by VideoRenderer. We delegate the method call to | 175 // This method is called by VideoRenderer. We delegate the method call to |
172 // VideoDecodeEngine. | 176 // VideoDecodeEngine. |
173 void IpcVideoDecoder::ProduceVideoFrame( | 177 void IpcVideoDecoder::ProduceVideoFrame( |
174 scoped_refptr<media::VideoFrame> video_frame) { | 178 scoped_refptr<media::VideoFrame> video_frame) { |
175 decode_engine_->ProduceVideoFrame(video_frame); | 179 decode_engine_->ProduceVideoFrame(video_frame); |
176 } | 180 } |
177 | 181 |
| 182 bool IpcVideoDecoder::ProvidesBuffer() { |
| 183 return true; |
| 184 } |
| 185 |
178 // This method is called by VideoDecodeEngine that a video frame is produced. | 186 // This method is called by VideoDecodeEngine that a video frame is produced. |
179 // This is then passed to VideoRenderer. | 187 // This is then passed to VideoRenderer. |
180 void IpcVideoDecoder::ConsumeVideoFrame( | 188 void IpcVideoDecoder::ConsumeVideoFrame( |
181 scoped_refptr<media::VideoFrame> video_frame) { | 189 scoped_refptr<media::VideoFrame> video_frame) { |
182 DCHECK(video_frame); | 190 DCHECK(video_frame); |
183 VideoFrameReady(video_frame); | 191 VideoFrameReady(video_frame); |
184 } | 192 } |
185 | 193 |
186 // This method is called by VideoDecodeEngine to request a video frame. The | 194 // This method is called by VideoDecodeEngine to request a video frame. The |
187 // request is passed to demuxer. | 195 // request is passed to demuxer. |
188 void IpcVideoDecoder::ProduceVideoSample(scoped_refptr<media::Buffer> buffer) { | 196 void IpcVideoDecoder::ProduceVideoSample(scoped_refptr<media::Buffer> buffer) { |
189 demuxer_stream_->Read(NewCallback(this, &IpcVideoDecoder::OnReadComplete)); | 197 demuxer_stream_->Read(NewCallback(this, &IpcVideoDecoder::OnReadComplete)); |
190 } | 198 } |
OLD | NEW |