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" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "media/base/limits.h" | 27 #include "media/base/limits.h" |
28 #include "ui/gl/gl_context.h" | 28 #include "ui/gl/gl_context.h" |
29 #include "ui/gl/gl_image.h" | 29 #include "ui/gl/gl_image.h" |
30 #include "ui/gl/gl_surface_egl.h" | 30 #include "ui/gl/gl_surface_egl.h" |
31 | 31 |
32 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
33 #include "base/win/windows_version.h" | 33 #include "base/win/windows_version.h" |
34 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.h" | 34 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.h" |
35 #elif defined(OS_MACOSX) | 35 #elif defined(OS_MACOSX) |
36 #include "content/common/gpu/media/vt_video_decode_accelerator_mac.h" | 36 #include "content/common/gpu/media/vt_video_decode_accelerator_mac.h" |
37 #elif defined(OS_CHROMEOS) | 37 #elif defined(OS_LINUX) |
38 #if defined(USE_V4L2_CODEC) | 38 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) |
39 #include "content/common/gpu/media/v4l2_device.h" | 39 #include "content/common/gpu/media/v4l2_device.h" |
40 #include "content/common/gpu/media/v4l2_slice_video_decode_accelerator.h" | 40 #include "content/common/gpu/media/v4l2_slice_video_decode_accelerator.h" |
41 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" | 41 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" |
42 #endif | 42 #endif |
43 #if defined(ARCH_CPU_X86_FAMILY) | 43 #if defined(ARCH_CPU_X86_FAMILY) |
44 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" | 44 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" |
45 #include "ui/gl/gl_implementation.h" | 45 #include "ui/gl/gl_implementation.h" |
46 #endif | 46 #endif |
47 #elif defined(USE_OZONE) | 47 #if !defined(OS_CHROMEOS) && defined(USE_OZONE) |
48 #include "media/ozone/media_ozone_platform.h" | 48 #include "media/ozone/media_ozone_platform.h" |
| 49 #endif |
49 #elif defined(OS_ANDROID) | 50 #elif defined(OS_ANDROID) |
50 #include "content/common/gpu/media/android_video_decode_accelerator.h" | 51 #include "content/common/gpu/media/android_video_decode_accelerator.h" |
51 #endif | 52 #endif |
52 | 53 |
53 #include "ui/gfx/geometry/size.h" | 54 #include "ui/gfx/geometry/size.h" |
54 | 55 |
55 namespace content { | 56 namespace content { |
56 | 57 |
57 static bool MakeDecoderContextCurrent( | 58 static bool MakeDecoderContextCurrent( |
58 const base::WeakPtr<GpuCommandBufferStub> stub) { | 59 const base::WeakPtr<GpuCommandBufferStub> stub) { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 158 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
158 if (cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) | 159 if (cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) |
159 return gpu::VideoDecodeAcceleratorCapabilities(); | 160 return gpu::VideoDecodeAcceleratorCapabilities(); |
160 | 161 |
161 // Query supported profiles for each VDA. The order of querying VDAs should | 162 // Query supported profiles for each VDA. The order of querying VDAs should |
162 // be the same as the order of initializing VDAs. Then the returned profile | 163 // be the same as the order of initializing VDAs. Then the returned profile |
163 // can be initialized by corresponding VDA successfully. | 164 // can be initialized by corresponding VDA successfully. |
164 #if defined(OS_WIN) | 165 #if defined(OS_WIN) |
165 capabilities.supported_profiles = | 166 capabilities.supported_profiles = |
166 DXVAVideoDecodeAccelerator::GetSupportedProfiles(); | 167 DXVAVideoDecodeAccelerator::GetSupportedProfiles(); |
167 #elif defined(OS_CHROMEOS) | 168 #elif defined(OS_LINUX) |
168 media::VideoDecodeAccelerator::SupportedProfiles vda_profiles; | 169 media::VideoDecodeAccelerator::SupportedProfiles vda_profiles; |
169 #if defined(USE_V4L2_CODEC) | 170 #if defined(USE_V4L2_CODEC) |
170 vda_profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles(); | 171 vda_profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles(); |
171 GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( | 172 GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( |
172 vda_profiles, &capabilities.supported_profiles); | 173 vda_profiles, &capabilities.supported_profiles); |
173 vda_profiles = V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(); | 174 vda_profiles = V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(); |
174 GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( | 175 GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( |
175 vda_profiles, &capabilities.supported_profiles); | 176 vda_profiles, &capabilities.supported_profiles); |
176 #endif | 177 #endif |
177 #if defined(ARCH_CPU_X86_FAMILY) | 178 #if defined(ARCH_CPU_X86_FAMILY) |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 gpu::gles2::TextureRef* ref = texture_manager->GetTexture(client_texture_id); | 438 gpu::gles2::TextureRef* ref = texture_manager->GetTexture(client_texture_id); |
438 if (ref) { | 439 if (ref) { |
439 texture_manager->SetLevelImage(ref, texture_target, 0, image.get(), | 440 texture_manager->SetLevelImage(ref, texture_target, 0, image.get(), |
440 gpu::gles2::Texture::BOUND); | 441 gpu::gles2::Texture::BOUND); |
441 } | 442 } |
442 } | 443 } |
443 | 444 |
444 scoped_ptr<media::VideoDecodeAccelerator> | 445 scoped_ptr<media::VideoDecodeAccelerator> |
445 GpuVideoDecodeAccelerator::CreateVaapiVDA() { | 446 GpuVideoDecodeAccelerator::CreateVaapiVDA() { |
446 scoped_ptr<media::VideoDecodeAccelerator> decoder; | 447 scoped_ptr<media::VideoDecodeAccelerator> decoder; |
447 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 448 #if defined(OS_LINUX) && defined(ARCH_CPU_X86_FAMILY) |
448 decoder.reset(new VaapiVideoDecodeAccelerator( | 449 decoder.reset(new VaapiVideoDecodeAccelerator( |
449 make_context_current_, base::Bind(&GpuVideoDecodeAccelerator::BindImage, | 450 make_context_current_, base::Bind(&GpuVideoDecodeAccelerator::BindImage, |
450 base::Unretained(this)))); | 451 base::Unretained(this)))); |
451 #endif | 452 #endif |
452 return decoder; | 453 return decoder; |
453 } | 454 } |
454 | 455 |
455 scoped_ptr<media::VideoDecodeAccelerator> | 456 scoped_ptr<media::VideoDecodeAccelerator> |
456 GpuVideoDecodeAccelerator::CreateVTVDA() { | 457 GpuVideoDecodeAccelerator::CreateVTVDA() { |
457 scoped_ptr<media::VideoDecodeAccelerator> decoder; | 458 scoped_ptr<media::VideoDecodeAccelerator> decoder; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 uncleared_textures_.erase(it); | 623 uncleared_textures_.erase(it); |
623 } | 624 } |
624 | 625 |
625 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, | 626 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, |
626 bool succeeded) { | 627 bool succeeded) { |
627 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); | 628 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); |
628 Send(message); | 629 Send(message); |
629 } | 630 } |
630 | 631 |
631 } // namespace content | 632 } // namespace content |
OLD | NEW |