OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/public/gpu/gpu_video_decode_accelerator_factory.h" | |
6 | |
7 #include "base/memory/ptr_util.h" | |
8 #include "content/gpu/gpu_child_thread.h" | |
9 #include "media/gpu/gpu_video_decode_accelerator_factory_impl.h" | |
10 | |
11 namespace content { | |
12 | |
13 GpuVideoDecodeAcceleratorFactory::~GpuVideoDecodeAcceleratorFactory() {} | |
14 | |
15 // static | |
16 std::unique_ptr<GpuVideoDecodeAcceleratorFactory> | |
17 GpuVideoDecodeAcceleratorFactory::Create( | |
18 const GetGLContextCallback& get_gl_context_cb, | |
19 const MakeGLContextCurrentCallback& make_context_current_cb, | |
20 const BindGLImageCallback& bind_image_cb) { | |
21 auto gvdafactory_impl = media::GpuVideoDecodeAcceleratorFactoryImpl::Create( | |
22 get_gl_context_cb, make_context_current_cb, bind_image_cb); | |
23 if (!gvdafactory_impl) | |
24 return nullptr; | |
25 | |
26 return base::WrapUnique( | |
27 new GpuVideoDecodeAcceleratorFactory(std::move(gvdafactory_impl))); | |
28 } | |
29 | |
30 // static | |
31 std::unique_ptr<GpuVideoDecodeAcceleratorFactory> | |
32 GpuVideoDecodeAcceleratorFactory::CreateWithGLES2Decoder( | |
33 const GetGLContextCallback& get_gl_context_cb, | |
34 const MakeGLContextCurrentCallback& make_context_current_cb, | |
35 const BindGLImageCallback& bind_image_cb, | |
36 const GetGLES2DecoderCallback& get_gles2_decoder_cb) { | |
37 auto gvdafactory_impl = | |
38 media::GpuVideoDecodeAcceleratorFactoryImpl::CreateWithGLES2Decoder( | |
39 get_gl_context_cb, make_context_current_cb, bind_image_cb, | |
40 get_gles2_decoder_cb); | |
41 if (!gvdafactory_impl) | |
42 return nullptr; | |
43 | |
44 return base::WrapUnique( | |
45 new GpuVideoDecodeAcceleratorFactory(std::move(gvdafactory_impl))); | |
46 } | |
47 | |
48 // static | |
49 std::unique_ptr<GpuVideoDecodeAcceleratorFactory> | |
50 GpuVideoDecodeAcceleratorFactory::CreateWithNoGL() { | |
51 auto gvdafactory_impl = | |
52 media::GpuVideoDecodeAcceleratorFactoryImpl::CreateWithNoGL(); | |
53 if (!gvdafactory_impl) | |
54 return nullptr; | |
55 | |
56 return base::WrapUnique( | |
57 new GpuVideoDecodeAcceleratorFactory(std::move(gvdafactory_impl))); | |
58 } | |
59 | |
60 // static | |
61 gpu::VideoDecodeAcceleratorCapabilities | |
62 GpuVideoDecodeAcceleratorFactory::GetDecoderCapabilities() { | |
63 const gpu::GpuPreferences gpu_preferences = | |
64 GpuChildThread::current()->gpu_preferences(); | |
65 return media::GpuVideoDecodeAcceleratorFactoryImpl::GetDecoderCapabilities( | |
66 gpu_preferences); | |
67 } | |
68 | |
69 std::unique_ptr<media::VideoDecodeAccelerator> | |
70 GpuVideoDecodeAcceleratorFactory::CreateVDA( | |
71 media::VideoDecodeAccelerator::Client* client, | |
72 const media::VideoDecodeAccelerator::Config& config) { | |
73 if (!gvdafactory_impl_) | |
74 return nullptr; | |
75 | |
76 const gpu::GpuPreferences gpu_preferences = | |
77 GpuChildThread::current()->gpu_preferences(); | |
78 return gvdafactory_impl_->CreateVDA( | |
79 client, config, gpu::GpuDriverBugWorkarounds(), gpu_preferences); | |
80 } | |
81 | |
82 GpuVideoDecodeAcceleratorFactory::GpuVideoDecodeAcceleratorFactory( | |
83 std::unique_ptr<media::GpuVideoDecodeAcceleratorFactoryImpl> | |
84 gvdafactory_impl) : gvdafactory_impl_(std::move(gvdafactory_impl)) {} | |
85 | |
86 } // namespace content | |
OLD | NEW |