| 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/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 | 13 |
| 14 #include "content/common/gpu/gpu_channel.h" | 14 #include "content/common/gpu/gpu_channel.h" |
| 15 #include "content/common/gpu/gpu_messages.h" | 15 #include "content/common/gpu/gpu_messages.h" |
| 16 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 17 #include "gpu/command_buffer/common/command_buffer.h" | 17 #include "gpu/command_buffer/common/command_buffer.h" |
| 18 #include "ipc/ipc_message_macros.h" | 18 #include "ipc/ipc_message_macros.h" |
| 19 #include "ipc/ipc_message_utils.h" | 19 #include "ipc/ipc_message_utils.h" |
| 20 #include "ui/gl/gl_context.h" | 20 #include "ui/gl/gl_context.h" |
| 21 #include "ui/gl/gl_surface_egl.h" | 21 #include "ui/gl/gl_surface_egl.h" |
| 22 | 22 |
| 23 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
| 24 #include "base/win/windows_version.h" | 24 #include "base/win/windows_version.h" |
| 25 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" | 25 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
| 26 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) | 26 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) |
| 27 #include "content/common/gpu/media/exynos_video_decode_accelerator.h" | 27 #include "content/common/gpu/media/exynos_video_decode_accelerator.h" |
| 28 #include "content/common/gpu/media/omx_video_decode_accelerator.h" | |
| 29 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 28 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) |
| 30 #include "ui/gl/gl_context_glx.h" | 29 #include "ui/gl/gl_context_glx.h" |
| 31 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" | 30 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" |
| 32 #elif defined(OS_ANDROID) | 31 #elif defined(OS_ANDROID) |
| 33 #include "content/common/gpu/media/android_video_decode_accelerator.h" | 32 #include "content/common/gpu/media/android_video_decode_accelerator.h" |
| 34 #endif | 33 #endif |
| 35 | 34 |
| 36 #include "gpu/command_buffer/service/texture_manager.h" | 35 #include "gpu/command_buffer/service/texture_manager.h" |
| 37 #include "ui/gfx/size.h" | 36 #include "ui/gfx/size.h" |
| 38 | 37 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 #if defined(OS_WIN) | 168 #if defined(OS_WIN) |
| 170 if (base::win::GetVersion() < base::win::VERSION_WIN7) { | 169 if (base::win::GetVersion() < base::win::VERSION_WIN7) { |
| 171 NOTIMPLEMENTED() << "HW video decode acceleration not available."; | 170 NOTIMPLEMENTED() << "HW video decode acceleration not available."; |
| 172 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 171 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 173 return; | 172 return; |
| 174 } | 173 } |
| 175 DLOG(INFO) << "Initializing DXVA HW decoder for windows."; | 174 DLOG(INFO) << "Initializing DXVA HW decoder for windows."; |
| 176 video_decode_accelerator_.reset(new DXVAVideoDecodeAccelerator( | 175 video_decode_accelerator_.reset(new DXVAVideoDecodeAccelerator( |
| 177 this, make_context_current_)); | 176 this, make_context_current_)); |
| 178 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) | 177 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) |
| 179 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseExynosVda)) { | 178 video_decode_accelerator_.reset(new ExynosVideoDecodeAccelerator( |
| 180 video_decode_accelerator_.reset(new ExynosVideoDecodeAccelerator( | 179 gfx::GLSurfaceEGL::GetHardwareDisplay(), |
| 181 gfx::GLSurfaceEGL::GetHardwareDisplay(), | 180 stub_->decoder()->GetGLContext()->GetHandle(), |
| 182 stub_->decoder()->GetGLContext()->GetHandle(), | 181 this, |
| 183 this, | 182 make_context_current_)); |
| 184 make_context_current_)); | |
| 185 } else { | |
| 186 video_decode_accelerator_.reset(new OmxVideoDecodeAccelerator( | |
| 187 gfx::GLSurfaceEGL::GetHardwareDisplay(), | |
| 188 stub_->decoder()->GetGLContext()->GetHandle(), | |
| 189 this, | |
| 190 make_context_current_)); | |
| 191 } | |
| 192 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 183 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) |
| 193 gfx::GLContextGLX* glx_context = | 184 gfx::GLContextGLX* glx_context = |
| 194 static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext()); | 185 static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext()); |
| 195 GLXContext glx_context_handle = | 186 GLXContext glx_context_handle = |
| 196 static_cast<GLXContext>(glx_context->GetHandle()); | 187 static_cast<GLXContext>(glx_context->GetHandle()); |
| 197 video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator( | 188 video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator( |
| 198 glx_context->display(), glx_context_handle, this, | 189 glx_context->display(), glx_context_handle, this, |
| 199 make_context_current_)); | 190 make_context_current_)); |
| 200 #elif defined(OS_ANDROID) | 191 #elif defined(OS_ANDROID) |
| 201 video_decode_accelerator_.reset(new AndroidVideoDecodeAccelerator( | 192 video_decode_accelerator_.reset(new AndroidVideoDecodeAccelerator( |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 void GpuVideoDecodeAccelerator::OnWillDestroyStub() { | 331 void GpuVideoDecodeAccelerator::OnWillDestroyStub() { |
| 341 delete this; | 332 delete this; |
| 342 } | 333 } |
| 343 | 334 |
| 344 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { | 335 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { |
| 345 DCHECK(stub_); | 336 DCHECK(stub_); |
| 346 return stub_->channel()->Send(message); | 337 return stub_->channel()->Send(message); |
| 347 } | 338 } |
| 348 | 339 |
| 349 } // namespace content | 340 } // namespace content |
| OLD | NEW |