| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_factory_impl.h" | 5 #include "content/common/gpu/media/gpu_video_decode_accelerator_factory_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | 8 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
| 9 #include "gpu/command_buffer/service/gpu_preferences.h" | 9 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 10 #include "media/gpu/ipc/common/gpu_video_accelerator_util.h" | 10 #include "media/gpu/ipc/common/gpu_video_accelerator_util.h" |
| 11 | 11 |
| 12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
| 13 #include "base/win/windows_version.h" | 13 #include "base/win/windows_version.h" |
| 14 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.h" | 14 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.h" |
| 15 #elif defined(OS_MACOSX) | 15 #elif defined(OS_MACOSX) |
| 16 #include "content/common/gpu/media/vt_video_decode_accelerator_mac.h" | 16 #include "content/common/gpu/media/vt_video_decode_accelerator_mac.h" |
| 17 #elif defined(OS_CHROMEOS) | 17 #elif (defined(OS_CHROMEOS) || defined(OS_LINUX)) |
| 18 #if defined(USE_V4L2_CODEC) | 18 #if defined(USE_V4L2_CODEC) |
| 19 #include "content/common/gpu/media/v4l2_device.h" | 19 #include "content/common/gpu/media/v4l2_device.h" |
| 20 #include "content/common/gpu/media/v4l2_slice_video_decode_accelerator.h" | 20 #include "content/common/gpu/media/v4l2_slice_video_decode_accelerator.h" |
| 21 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" | 21 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" |
| 22 #include "ui/gl/gl_surface_egl.h" | 22 #include "ui/gl/gl_surface_egl.h" |
| 23 #endif | 23 #endif |
| 24 #if defined(ARCH_CPU_X86_FAMILY) | 24 #if defined(ARCH_CPU_X86_FAMILY) |
| 25 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" | 25 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" |
| 26 #include "ui/gl/gl_implementation.h" | 26 #include "ui/gl/gl_implementation.h" |
| 27 #endif | 27 #endif |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // Query VDAs for their capabilities and construct a set of supported | 72 // Query VDAs for their capabilities and construct a set of supported |
| 73 // profiles for current platform. This must be done in the same order as in | 73 // profiles for current platform. This must be done in the same order as in |
| 74 // CreateVDA(), as we currently preserve additional capabilities (such as | 74 // CreateVDA(), as we currently preserve additional capabilities (such as |
| 75 // resolutions supported) only for the first VDA supporting the given codec | 75 // resolutions supported) only for the first VDA supporting the given codec |
| 76 // profile (instead of calculating a superset). | 76 // profile (instead of calculating a superset). |
| 77 // TODO(posciak,henryhsu): improve this so that we choose a superset of | 77 // TODO(posciak,henryhsu): improve this so that we choose a superset of |
| 78 // resolutions and other supported profile parameters. | 78 // resolutions and other supported profile parameters. |
| 79 #if defined(OS_WIN) | 79 #if defined(OS_WIN) |
| 80 capabilities.supported_profiles = | 80 capabilities.supported_profiles = |
| 81 DXVAVideoDecodeAccelerator::GetSupportedProfiles(); | 81 DXVAVideoDecodeAccelerator::GetSupportedProfiles(); |
| 82 #elif defined(OS_CHROMEOS) | 82 #elif defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 83 media::VideoDecodeAccelerator::SupportedProfiles vda_profiles; | 83 media::VideoDecodeAccelerator::SupportedProfiles vda_profiles; |
| 84 #if defined(USE_V4L2_CODEC) | 84 #if defined(USE_V4L2_CODEC) |
| 85 vda_profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles(); | 85 vda_profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles(); |
| 86 media::GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( | 86 media::GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( |
| 87 vda_profiles, &capabilities.supported_profiles); | 87 vda_profiles, &capabilities.supported_profiles); |
| 88 vda_profiles = V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(); | 88 vda_profiles = V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(); |
| 89 media::GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( | 89 media::GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( |
| 90 vda_profiles, &capabilities.supported_profiles); | 90 vda_profiles, &capabilities.supported_profiles); |
| 91 #endif | 91 #endif |
| 92 #if defined(ARCH_CPU_X86_FAMILY) | 92 #if defined(ARCH_CPU_X86_FAMILY) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 123 GpuVideoDecodeAcceleratorFactoryImpl::*)(const gpu::GpuPreferences&) | 123 GpuVideoDecodeAcceleratorFactoryImpl::*)(const gpu::GpuPreferences&) |
| 124 const; | 124 const; |
| 125 const CreateVDAFp create_vda_fps[] = { | 125 const CreateVDAFp create_vda_fps[] = { |
| 126 #if defined(OS_WIN) | 126 #if defined(OS_WIN) |
| 127 &GpuVideoDecodeAcceleratorFactoryImpl::CreateDXVAVDA, | 127 &GpuVideoDecodeAcceleratorFactoryImpl::CreateDXVAVDA, |
| 128 #endif | 128 #endif |
| 129 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) | 129 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) |
| 130 &GpuVideoDecodeAcceleratorFactoryImpl::CreateV4L2VDA, | 130 &GpuVideoDecodeAcceleratorFactoryImpl::CreateV4L2VDA, |
| 131 &GpuVideoDecodeAcceleratorFactoryImpl::CreateV4L2SVDA, | 131 &GpuVideoDecodeAcceleratorFactoryImpl::CreateV4L2SVDA, |
| 132 #endif | 132 #endif |
| 133 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 133 #if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) |
| 134 &GpuVideoDecodeAcceleratorFactoryImpl::CreateVaapiVDA, | 134 &GpuVideoDecodeAcceleratorFactoryImpl::CreateVaapiVDA, |
| 135 #endif | 135 #endif |
| 136 #if defined(OS_MACOSX) | 136 #if defined(OS_MACOSX) |
| 137 &GpuVideoDecodeAcceleratorFactoryImpl::CreateVTVDA, | 137 &GpuVideoDecodeAcceleratorFactoryImpl::CreateVTVDA, |
| 138 #endif | 138 #endif |
| 139 #if defined(OS_ANDROID) | 139 #if defined(OS_ANDROID) |
| 140 &GpuVideoDecodeAcceleratorFactoryImpl::CreateAndroidVDA, | 140 &GpuVideoDecodeAcceleratorFactoryImpl::CreateAndroidVDA, |
| 141 #endif | 141 #endif |
| 142 }; | 142 }; |
| 143 | 143 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | 188 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); |
| 189 if (device.get()) { | 189 if (device.get()) { |
| 190 decoder.reset(new V4L2SliceVideoDecodeAccelerator( | 190 decoder.reset(new V4L2SliceVideoDecodeAccelerator( |
| 191 device, gfx::GLSurfaceEGL::GetHardwareDisplay(), get_gl_context_cb_, | 191 device, gfx::GLSurfaceEGL::GetHardwareDisplay(), get_gl_context_cb_, |
| 192 make_context_current_cb_)); | 192 make_context_current_cb_)); |
| 193 } | 193 } |
| 194 return decoder; | 194 return decoder; |
| 195 } | 195 } |
| 196 #endif | 196 #endif |
| 197 | 197 |
| 198 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 198 #if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) |
| 199 std::unique_ptr<media::VideoDecodeAccelerator> | 199 std::unique_ptr<media::VideoDecodeAccelerator> |
| 200 GpuVideoDecodeAcceleratorFactoryImpl::CreateVaapiVDA( | 200 GpuVideoDecodeAcceleratorFactoryImpl::CreateVaapiVDA( |
| 201 const gpu::GpuPreferences& gpu_preferences) const { | 201 const gpu::GpuPreferences& gpu_preferences) const { |
| 202 std::unique_ptr<media::VideoDecodeAccelerator> decoder; | 202 std::unique_ptr<media::VideoDecodeAccelerator> decoder; |
| 203 decoder.reset(new VaapiVideoDecodeAccelerator(make_context_current_cb_, | 203 decoder.reset(new VaapiVideoDecodeAccelerator(make_context_current_cb_, |
| 204 bind_image_cb_)); | 204 bind_image_cb_)); |
| 205 return decoder; | 205 return decoder; |
| 206 } | 206 } |
| 207 #endif | 207 #endif |
| 208 | 208 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 234 const BindGLImageCallback& bind_image_cb, | 234 const BindGLImageCallback& bind_image_cb, |
| 235 const GetGLES2DecoderCallback& get_gles2_decoder_cb) | 235 const GetGLES2DecoderCallback& get_gles2_decoder_cb) |
| 236 : get_gl_context_cb_(get_gl_context_cb), | 236 : get_gl_context_cb_(get_gl_context_cb), |
| 237 make_context_current_cb_(make_context_current_cb), | 237 make_context_current_cb_(make_context_current_cb), |
| 238 bind_image_cb_(bind_image_cb), | 238 bind_image_cb_(bind_image_cb), |
| 239 get_gles2_decoder_cb_(get_gles2_decoder_cb) {} | 239 get_gles2_decoder_cb_(get_gles2_decoder_cb) {} |
| 240 | 240 |
| 241 GpuVideoDecodeAcceleratorFactoryImpl::~GpuVideoDecodeAcceleratorFactoryImpl() {} | 241 GpuVideoDecodeAcceleratorFactoryImpl::~GpuVideoDecodeAcceleratorFactoryImpl() {} |
| 242 | 242 |
| 243 } // namespace content | 243 } // namespace content |
| OLD | NEW |