| 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 "media/gpu/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" | |
| 9 #include "gpu/command_buffer/service/gpu_preferences.h" | 8 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 10 #include "media/gpu/ipc/common/gpu_video_accelerator_util.h" | 9 #include "media/gpu/gpu_video_accelerator_util.h" |
| 11 | 10 |
| 12 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
| 13 #include "base/win/windows_version.h" | 12 #include "base/win/windows_version.h" |
| 14 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.h" | 13 #include "media/gpu/dxva_video_decode_accelerator_win.h" |
| 15 #elif defined(OS_MACOSX) | 14 #elif defined(OS_MACOSX) |
| 16 #include "content/common/gpu/media/vt_video_decode_accelerator_mac.h" | 15 #include "media/gpu/vt_video_decode_accelerator_mac.h" |
| 17 #elif defined(OS_CHROMEOS) | 16 #elif defined(OS_CHROMEOS) |
| 18 #if defined(USE_V4L2_CODEC) | 17 #if defined(USE_V4L2_CODEC) |
| 19 #include "content/common/gpu/media/v4l2_device.h" | 18 #include "media/gpu/v4l2_device.h" |
| 20 #include "content/common/gpu/media/v4l2_slice_video_decode_accelerator.h" | 19 #include "media/gpu/v4l2_slice_video_decode_accelerator.h" |
| 21 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" | 20 #include "media/gpu/v4l2_video_decode_accelerator.h" |
| 22 #include "ui/gl/gl_surface_egl.h" | 21 #include "ui/gl/gl_surface_egl.h" |
| 23 #endif | 22 #endif |
| 24 #if defined(ARCH_CPU_X86_FAMILY) | 23 #if defined(ARCH_CPU_X86_FAMILY) |
| 25 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" | 24 #include "media/gpu/vaapi_video_decode_accelerator.h" |
| 26 #include "ui/gl/gl_implementation.h" | 25 #include "ui/gl/gl_implementation.h" |
| 27 #endif | 26 #endif |
| 28 #elif defined(OS_ANDROID) | 27 #elif defined(OS_ANDROID) |
| 29 #include "content/common/gpu/media/android_video_decode_accelerator.h" | 28 #include "media/gpu/android_video_decode_accelerator.h" |
| 30 #endif | 29 #endif |
| 31 | 30 |
| 32 namespace content { | 31 namespace media { |
| 33 | 32 |
| 34 // static | 33 // static |
| 35 std::unique_ptr<GpuVideoDecodeAcceleratorFactoryImpl> | 34 std::unique_ptr<GpuVideoDecodeAcceleratorFactoryImpl> |
| 36 GpuVideoDecodeAcceleratorFactoryImpl::Create( | 35 GpuVideoDecodeAcceleratorFactoryImpl::Create( |
| 37 const GetGLContextCallback& get_gl_context_cb, | 36 const GetGLContextCallback& get_gl_context_cb, |
| 38 const MakeGLContextCurrentCallback& make_context_current_cb, | 37 const MakeGLContextCurrentCallback& make_context_current_cb, |
| 39 const BindGLImageCallback& bind_image_cb) { | 38 const BindGLImageCallback& bind_image_cb) { |
| 40 return base::WrapUnique(new GpuVideoDecodeAcceleratorFactoryImpl( | 39 return base::WrapUnique(new GpuVideoDecodeAcceleratorFactoryImpl( |
| 41 get_gl_context_cb, make_context_current_cb, bind_image_cb, | 40 get_gl_context_cb, make_context_current_cb, bind_image_cb, |
| 42 GetGLES2DecoderCallback())); | 41 GetGLES2DecoderCallback())); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 62 } | 61 } |
| 63 | 62 |
| 64 // static | 63 // static |
| 65 gpu::VideoDecodeAcceleratorCapabilities | 64 gpu::VideoDecodeAcceleratorCapabilities |
| 66 GpuVideoDecodeAcceleratorFactoryImpl::GetDecoderCapabilities( | 65 GpuVideoDecodeAcceleratorFactoryImpl::GetDecoderCapabilities( |
| 67 const gpu::GpuPreferences& gpu_preferences) { | 66 const gpu::GpuPreferences& gpu_preferences) { |
| 68 media::VideoDecodeAccelerator::Capabilities capabilities; | 67 media::VideoDecodeAccelerator::Capabilities capabilities; |
| 69 if (gpu_preferences.disable_accelerated_video_decode) | 68 if (gpu_preferences.disable_accelerated_video_decode) |
| 70 return gpu::VideoDecodeAcceleratorCapabilities(); | 69 return gpu::VideoDecodeAcceleratorCapabilities(); |
| 71 | 70 |
| 72 // Query VDAs for their capabilities and construct a set of supported | 71 // 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 | 72 // profiles for current platform. This must be done in the same order as in |
| 74 // CreateVDA(), as we currently preserve additional capabilities (such as | 73 // CreateVDA(), as we currently preserve additional capabilities (such as |
| 75 // resolutions supported) only for the first VDA supporting the given codec | 74 // resolutions supported) only for the first VDA supporting the given codec |
| 76 // profile (instead of calculating a superset). | 75 // profile (instead of calculating a superset). |
| 77 // TODO(posciak,henryhsu): improve this so that we choose a superset of | 76 // TODO(posciak,henryhsu): improve this so that we choose a superset of |
| 78 // resolutions and other supported profile parameters. | 77 // resolutions and other supported profile parameters. |
| 79 #if defined(OS_WIN) | 78 #if defined(OS_WIN) |
| 80 capabilities.supported_profiles = | 79 capabilities.supported_profiles = |
| 81 DXVAVideoDecodeAccelerator::GetSupportedProfiles(); | 80 DXVAVideoDecodeAccelerator::GetSupportedProfiles(); |
| 82 #elif defined(OS_CHROMEOS) | 81 #elif defined(OS_CHROMEOS) |
| 83 media::VideoDecodeAccelerator::SupportedProfiles vda_profiles; | 82 media::VideoDecodeAccelerator::SupportedProfiles vda_profiles; |
| 84 #if defined(USE_V4L2_CODEC) | 83 #if defined(USE_V4L2_CODEC) |
| 85 vda_profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles(); | 84 vda_profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles(); |
| 86 media::GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( | 85 media::GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( |
| 87 vda_profiles, &capabilities.supported_profiles); | 86 vda_profiles, &capabilities.supported_profiles); |
| 88 vda_profiles = V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(); | 87 vda_profiles = V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 const MakeGLContextCurrentCallback& make_context_current_cb, | 232 const MakeGLContextCurrentCallback& make_context_current_cb, |
| 234 const BindGLImageCallback& bind_image_cb, | 233 const BindGLImageCallback& bind_image_cb, |
| 235 const GetGLES2DecoderCallback& get_gles2_decoder_cb) | 234 const GetGLES2DecoderCallback& get_gles2_decoder_cb) |
| 236 : get_gl_context_cb_(get_gl_context_cb), | 235 : get_gl_context_cb_(get_gl_context_cb), |
| 237 make_context_current_cb_(make_context_current_cb), | 236 make_context_current_cb_(make_context_current_cb), |
| 238 bind_image_cb_(bind_image_cb), | 237 bind_image_cb_(bind_image_cb), |
| 239 get_gles2_decoder_cb_(get_gles2_decoder_cb) {} | 238 get_gles2_decoder_cb_(get_gles2_decoder_cb) {} |
| 240 | 239 |
| 241 GpuVideoDecodeAcceleratorFactoryImpl::~GpuVideoDecodeAcceleratorFactoryImpl() {} | 240 GpuVideoDecodeAcceleratorFactoryImpl::~GpuVideoDecodeAcceleratorFactoryImpl() {} |
| 242 | 241 |
| 243 } // namespace content | 242 } // namespace media |
| OLD | NEW |