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