Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Side by Side Diff: media/gpu/gpu_video_decode_accelerator_factory_impl.cc

Issue 1939683002: Test X11 header pollution (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
10 #include "media/gpu/media_gpu_export.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 "media/gpu/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 "media/gpu/vt_video_decode_accelerator_mac.h"
17 #elif defined(OS_CHROMEOS) 17 #elif defined(OS_CHROMEOS)
18 #if defined(USE_V4L2_CODEC) 18 #if defined(USE_V4L2_CODEC)
19 #include "content/common/gpu/media/v4l2_device.h" 19 #include "media/gpu/v4l2_device.h"
20 #include "content/common/gpu/media/v4l2_slice_video_decode_accelerator.h" 20 #include "media/gpu/v4l2_slice_video_decode_accelerator.h"
21 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" 21 #include "media/gpu/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 "media/gpu/vaapi_video_decode_accelerator.h"
26 #include "ui/gl/gl_implementation.h" 26 #include "ui/gl/gl_implementation.h"
27 #endif 27 #endif
28 #elif defined(OS_ANDROID) 28 #elif defined(OS_ANDROID)
29 #include "content/common/gpu/media/android_video_decode_accelerator.h" 29 #include "media/gpu/android_video_decode_accelerator.h"
30 #endif 30 #endif
31 31
32 namespace content { 32 namespace media {
33 33
34 // static 34 // static
35 std::unique_ptr<GpuVideoDecodeAcceleratorFactoryImpl> 35 MEDIA_GPU_EXPORT std::unique_ptr<GpuVideoDecodeAcceleratorFactoryImpl>
36 GpuVideoDecodeAcceleratorFactoryImpl::Create( 36 GpuVideoDecodeAcceleratorFactoryImpl::Create(
37 const GetGLContextCallback& get_gl_context_cb, 37 const GetGLContextCallback& get_gl_context_cb,
38 const MakeGLContextCurrentCallback& make_context_current_cb, 38 const MakeGLContextCurrentCallback& make_context_current_cb,
39 const BindGLImageCallback& bind_image_cb) { 39 const BindGLImageCallback& bind_image_cb) {
40 return base::WrapUnique(new GpuVideoDecodeAcceleratorFactoryImpl( 40 return base::WrapUnique(new GpuVideoDecodeAcceleratorFactoryImpl(
41 get_gl_context_cb, make_context_current_cb, bind_image_cb, 41 get_gl_context_cb, make_context_current_cb, bind_image_cb,
42 GetGLES2DecoderCallback())); 42 GetGLES2DecoderCallback()));
43 } 43 }
44 44
45 // static 45 // static
46 std::unique_ptr<GpuVideoDecodeAcceleratorFactoryImpl> 46 MEDIA_GPU_EXPORT std::unique_ptr<GpuVideoDecodeAcceleratorFactoryImpl>
47 GpuVideoDecodeAcceleratorFactoryImpl::CreateWithGLES2Decoder( 47 GpuVideoDecodeAcceleratorFactoryImpl::CreateWithGLES2Decoder(
48 const GetGLContextCallback& get_gl_context_cb, 48 const GetGLContextCallback& get_gl_context_cb,
49 const MakeGLContextCurrentCallback& make_context_current_cb, 49 const MakeGLContextCurrentCallback& make_context_current_cb,
50 const BindGLImageCallback& bind_image_cb, 50 const BindGLImageCallback& bind_image_cb,
51 const GetGLES2DecoderCallback& get_gles2_decoder_cb) { 51 const GetGLES2DecoderCallback& get_gles2_decoder_cb) {
52 return base::WrapUnique(new GpuVideoDecodeAcceleratorFactoryImpl( 52 return base::WrapUnique(new GpuVideoDecodeAcceleratorFactoryImpl(
53 get_gl_context_cb, make_context_current_cb, bind_image_cb, 53 get_gl_context_cb, make_context_current_cb, bind_image_cb,
54 get_gles2_decoder_cb)); 54 get_gles2_decoder_cb));
55 } 55 }
56 56
57 // static 57 // static
58 std::unique_ptr<GpuVideoDecodeAcceleratorFactoryImpl> 58 MEDIA_GPU_EXPORT std::unique_ptr<GpuVideoDecodeAcceleratorFactoryImpl>
59 GpuVideoDecodeAcceleratorFactoryImpl::CreateWithNoGL() { 59 GpuVideoDecodeAcceleratorFactoryImpl::CreateWithNoGL() {
60 return Create(GetGLContextCallback(), MakeGLContextCurrentCallback(), 60 return Create(GetGLContextCallback(), MakeGLContextCurrentCallback(),
61 BindGLImageCallback()); 61 BindGLImageCallback());
62 } 62 }
63 63
64 // static 64 // static
65 gpu::VideoDecodeAcceleratorCapabilities 65 MEDIA_GPU_EXPORT gpu::VideoDecodeAcceleratorCapabilities
66 GpuVideoDecodeAcceleratorFactoryImpl::GetDecoderCapabilities( 66 GpuVideoDecodeAcceleratorFactoryImpl::GetDecoderCapabilities(
67 const gpu::GpuPreferences& gpu_preferences) { 67 const gpu::GpuPreferences& gpu_preferences) {
68 media::VideoDecodeAccelerator::Capabilities capabilities; 68 media::VideoDecodeAccelerator::Capabilities capabilities;
69 if (gpu_preferences.disable_accelerated_video_decode) 69 if (gpu_preferences.disable_accelerated_video_decode)
70 return gpu::VideoDecodeAcceleratorCapabilities(); 70 return gpu::VideoDecodeAcceleratorCapabilities();
71 71
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)
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)
93 vda_profiles = VaapiVideoDecodeAccelerator::GetSupportedProfiles(); 93 vda_profiles = VaapiVideoDecodeAccelerator::GetSupportedProfiles();
94 media::GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles( 94 media::GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(
95 vda_profiles, &capabilities.supported_profiles); 95 vda_profiles, &capabilities.supported_profiles);
96 #endif 96 #endif
97 #elif defined(OS_MACOSX) 97 #elif defined(OS_MACOSX)
98 capabilities.supported_profiles = 98 capabilities.supported_profiles =
99 VTVideoDecodeAccelerator::GetSupportedProfiles(); 99 VTVideoDecodeAccelerator::GetSupportedProfiles();
100 #elif defined(OS_ANDROID) 100 #elif defined(OS_ANDROID)
101 capabilities = 101 capabilities =
102 AndroidVideoDecodeAccelerator::GetCapabilities(gpu_preferences); 102 AndroidVideoDecodeAccelerator::GetCapabilities(gpu_preferences);
103 #endif 103 #endif
104 return media::GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeCapabilities( 104 return media::GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeCapabilities(
105 capabilities); 105 capabilities);
106 } 106 }
107 107
108 std::unique_ptr<media::VideoDecodeAccelerator> 108 MEDIA_GPU_EXPORT std::unique_ptr<media::VideoDecodeAccelerator>
109 GpuVideoDecodeAcceleratorFactoryImpl::CreateVDA( 109 GpuVideoDecodeAcceleratorFactoryImpl::CreateVDA(
110 media::VideoDecodeAccelerator::Client* client, 110 media::VideoDecodeAccelerator::Client* client,
111 const media::VideoDecodeAccelerator::Config& config, 111 const media::VideoDecodeAccelerator::Config& config,
112 const gpu::GpuPreferences& gpu_preferences) { 112 const gpu::GpuPreferences& gpu_preferences) {
113 DCHECK(thread_checker_.CalledOnValidThread()); 113 DCHECK(thread_checker_.CalledOnValidThread());
114 114
115 if (gpu_preferences.disable_accelerated_video_decode) 115 if (gpu_preferences.disable_accelerated_video_decode)
116 return nullptr; 116 return nullptr;
117 117
118 // Array of Create..VDA() function pointers, potentially usable on current 118 // Array of Create..VDA() function pointers, potentially usable on current
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 const MakeGLContextCurrentCallback& make_context_current_cb, 233 const MakeGLContextCurrentCallback& make_context_current_cb,
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 media
OLDNEW
« no previous file with comments | « media/gpu/gpu_video_decode_accelerator_factory_impl.h ('k') | media/gpu/gpu_video_decode_accelerator_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698