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/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
14 | 14 |
15 #include "content/common/gpu/gpu_channel.h" | 15 #include "content/common/gpu/gpu_channel.h" |
16 #include "content/common/gpu/gpu_messages.h" | 16 #include "content/common/gpu/gpu_messages.h" |
17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
18 #include "gpu/command_buffer/common/command_buffer.h" | 18 #include "gpu/command_buffer/common/command_buffer.h" |
19 #include "ipc/ipc_message_macros.h" | 19 #include "ipc/ipc_message_macros.h" |
20 #include "ipc/ipc_message_utils.h" | 20 #include "ipc/ipc_message_utils.h" |
21 #include "ipc/message_filter.h" | 21 #include "ipc/message_filter.h" |
22 #include "media/base/limits.h" | 22 #include "media/base/limits.h" |
23 #include "ui/gl/gl_context.h" | 23 #include "ui/gl/gl_context.h" |
24 #include "ui/gl/gl_surface_egl.h" | 24 #include "ui/gl/gl_surface_egl.h" |
25 | 25 |
26 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
27 #include "base/win/windows_version.h" | 27 #include "base/win/windows_version.h" |
28 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" | 28 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
| 29 #elif defined(OS_MACOSX) |
| 30 #include "content/common/gpu/media/vt_video_decode_accelerator.h" |
29 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) | 31 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) |
30 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" | 32 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" |
31 #include "content/common/gpu/media/v4l2_video_device.h" | 33 #include "content/common/gpu/media/v4l2_video_device.h" |
32 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 34 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) |
33 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" | 35 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" |
34 #include "ui/gl/gl_context_glx.h" | 36 #include "ui/gl/gl_context_glx.h" |
35 #include "ui/gl/gl_implementation.h" | 37 #include "ui/gl/gl_implementation.h" |
36 #elif defined(OS_ANDROID) | 38 #elif defined(OS_ANDROID) |
37 #include "content/common/gpu/media/android_video_decode_accelerator.h" | 39 #include "content/common/gpu/media/android_video_decode_accelerator.h" |
38 #endif | 40 #endif |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 246 |
245 #if defined(OS_WIN) | 247 #if defined(OS_WIN) |
246 if (base::win::GetVersion() < base::win::VERSION_WIN7) { | 248 if (base::win::GetVersion() < base::win::VERSION_WIN7) { |
247 NOTIMPLEMENTED() << "HW video decode acceleration not available."; | 249 NOTIMPLEMENTED() << "HW video decode acceleration not available."; |
248 SendCreateDecoderReply(init_done_msg, false); | 250 SendCreateDecoderReply(init_done_msg, false); |
249 return; | 251 return; |
250 } | 252 } |
251 DVLOG(0) << "Initializing DXVA HW decoder for windows."; | 253 DVLOG(0) << "Initializing DXVA HW decoder for windows."; |
252 video_decode_accelerator_.reset( | 254 video_decode_accelerator_.reset( |
253 new DXVAVideoDecodeAccelerator(make_context_current_)); | 255 new DXVAVideoDecodeAccelerator(make_context_current_)); |
| 256 #elif defined(OS_MACOSX) |
| 257 video_decode_accelerator_.reset(new VTVideoDecodeAccelerator( |
| 258 static_cast<CGLContextObj>( |
| 259 stub_->decoder()->GetGLContext()->GetHandle()))); |
254 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) | 260 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) |
255 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | 261 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); |
256 if (!device.get()) { | 262 if (!device.get()) { |
257 SendCreateDecoderReply(init_done_msg, false); | 263 SendCreateDecoderReply(init_done_msg, false); |
258 return; | 264 return; |
259 } | 265 } |
260 video_decode_accelerator_.reset(new V4L2VideoDecodeAccelerator( | 266 video_decode_accelerator_.reset(new V4L2VideoDecodeAccelerator( |
261 gfx::GLSurfaceEGL::GetHardwareDisplay(), | 267 gfx::GLSurfaceEGL::GetHardwareDisplay(), |
262 stub_->decoder()->GetGLContext()->GetHandle(), | 268 stub_->decoder()->GetGLContext()->GetHandle(), |
263 weak_factory_for_io_.GetWeakPtr(), | 269 weak_factory_for_io_.GetWeakPtr(), |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 return stub_->channel()->Send(message); | 494 return stub_->channel()->Send(message); |
489 } | 495 } |
490 | 496 |
491 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, | 497 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, |
492 bool succeeded) { | 498 bool succeeded) { |
493 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); | 499 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); |
494 Send(message); | 500 Send(message); |
495 } | 501 } |
496 | 502 |
497 } // namespace content | 503 } // namespace content |
OLD | NEW |