OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/common/gpu/media/gpu_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 #endif | 163 #endif |
164 | 164 |
165 #if defined(OS_WIN) | 165 #if defined(OS_WIN) |
166 if (base::win::GetVersion() < base::win::VERSION_WIN7) { | 166 if (base::win::GetVersion() < base::win::VERSION_WIN7) { |
167 NOTIMPLEMENTED() << "HW video decode acceleration not available."; | 167 NOTIMPLEMENTED() << "HW video decode acceleration not available."; |
168 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 168 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
169 return; | 169 return; |
170 } | 170 } |
171 DLOG(INFO) << "Initializing DXVA HW decoder for windows."; | 171 DLOG(INFO) << "Initializing DXVA HW decoder for windows."; |
172 scoped_ptr<DXVAVideoDecodeAccelerator> video_decoder( | 172 video_decode_accelerator_.reset(new DXVAVideoDecodeAccelerator(this)); |
173 new DXVAVideoDecodeAccelerator(this)); | |
174 video_decode_accelerator_ = video_decoder.Pass(); | |
175 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 173 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
176 scoped_ptr<OmxVideoDecodeAccelerator> video_decoder( | 174 video_decode_accelerator_.reset(new OmxVideoDecodeAccelerator( |
177 new OmxVideoDecodeAccelerator(this)); | |
178 video_decoder->SetEglState( | |
179 gfx::GLSurfaceEGL::GetHardwareDisplay(), | 175 gfx::GLSurfaceEGL::GetHardwareDisplay(), |
180 stub_->decoder()->GetGLContext()->GetHandle()); | 176 stub_->decoder()->GetGLContext()->GetHandle(), |
181 video_decode_accelerator_ = video_decoder.Pass(); | 177 this)); |
182 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 178 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
183 scoped_ptr<VaapiVideoDecodeAccelerator> video_decoder( | |
184 new VaapiVideoDecodeAccelerator(this, make_context_current_)); | |
185 gfx::GLContextGLX* glx_context = | 179 gfx::GLContextGLX* glx_context = |
186 static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext()); | 180 static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext()); |
187 GLXContext glx_context_handle = | 181 GLXContext glx_context_handle = |
188 static_cast<GLXContext>(glx_context->GetHandle()); | 182 static_cast<GLXContext>(glx_context->GetHandle()); |
189 video_decoder->SetGlxState(glx_context->display(), glx_context_handle); | 183 video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator( |
190 video_decode_accelerator_ = video_decoder.Pass(); | 184 glx_context->display(), glx_context_handle, this, |
| 185 make_context_current_)); |
191 #elif defined(OS_MACOSX) | 186 #elif defined(OS_MACOSX) |
192 scoped_ptr<MacVideoDecodeAccelerator> video_decoder( | 187 video_decode_accelerator_.reset(new MacVideoDecodeAccelerator( |
193 new MacVideoDecodeAccelerator(this)); | 188 static_cast<CGLContextObj>( |
194 video_decoder->SetCGLContext(static_cast<CGLContextObj>( | 189 stub_->decoder()->GetGLContext()->GetHandle()), |
195 stub_->decoder()->GetGLContext()->GetHandle())); | 190 this)); |
196 video_decode_accelerator_ = video_decoder.Pass(); | |
197 #else | 191 #else |
198 NOTIMPLEMENTED() << "HW video decode acceleration not available."; | 192 NOTIMPLEMENTED() << "HW video decode acceleration not available."; |
199 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 193 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
200 return; | 194 return; |
201 #endif | 195 #endif |
202 | 196 |
203 if (!video_decode_accelerator_->Initialize(profile)) | 197 if (!video_decode_accelerator_->Initialize(profile)) |
204 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 198 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
205 } | 199 } |
206 | 200 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 if (stub_) { | 295 if (stub_) { |
302 stub_->RemoveDestructionObserver(this); | 296 stub_->RemoveDestructionObserver(this); |
303 stub_.reset(); | 297 stub_.reset(); |
304 } | 298 } |
305 } | 299 } |
306 | 300 |
307 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { | 301 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { |
308 DCHECK(sender_); | 302 DCHECK(sender_); |
309 return sender_->Send(message); | 303 return sender_->Send(message); |
310 } | 304 } |
OLD | NEW |