| 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/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 std::unique_ptr<GpuVideoDecodeAcceleratorFactory> | 49 std::unique_ptr<GpuVideoDecodeAcceleratorFactory> |
| 50 GpuVideoDecodeAcceleratorFactory::CreateWithNoGL() { | 50 GpuVideoDecodeAcceleratorFactory::CreateWithNoGL() { |
| 51 auto gvdafactory_impl = | 51 auto gvdafactory_impl = |
| 52 GpuVideoDecodeAcceleratorFactoryImpl::CreateWithNoGL(); | 52 media::GpuVideoDecodeAcceleratorFactoryImpl::CreateWithNoGL(); |
| 53 if (!gvdafactory_impl) | 53 if (!gvdafactory_impl) |
| 54 return nullptr; | 54 return nullptr; |
| 55 | 55 |
| 56 return base::WrapUnique( | 56 return base::WrapUnique( |
| 57 new GpuVideoDecodeAcceleratorFactory(std::move(gvdafactory_impl))); | 57 new GpuVideoDecodeAcceleratorFactory(std::move(gvdafactory_impl))); |
| 58 } | 58 } |
| 59 | 59 |
| 60 // static | 60 // static |
| 61 gpu::VideoDecodeAcceleratorCapabilities | 61 gpu::VideoDecodeAcceleratorCapabilities |
| 62 GpuVideoDecodeAcceleratorFactory::GetDecoderCapabilities() { | 62 GpuVideoDecodeAcceleratorFactory::GetDecoderCapabilities() { |
| 63 const gpu::GpuPreferences gpu_preferences = | 63 const gpu::GpuPreferences gpu_preferences = |
| 64 GpuChildThread::current()->gpu_preferences(); | 64 GpuChildThread::current()->gpu_preferences(); |
| 65 return GpuVideoDecodeAcceleratorFactoryImpl::GetDecoderCapabilities( | 65 return media::GpuVideoDecodeAcceleratorFactoryImpl::GetDecoderCapabilities( |
| 66 gpu_preferences); | 66 gpu_preferences); |
| 67 } | 67 } |
| 68 | 68 |
| 69 std::unique_ptr<media::VideoDecodeAccelerator> | 69 std::unique_ptr<media::VideoDecodeAccelerator> |
| 70 GpuVideoDecodeAcceleratorFactory::CreateVDA( | 70 GpuVideoDecodeAcceleratorFactory::CreateVDA( |
| 71 media::VideoDecodeAccelerator::Client* client, | 71 media::VideoDecodeAccelerator::Client* client, |
| 72 const media::VideoDecodeAccelerator::Config& config) { | 72 const media::VideoDecodeAccelerator::Config& config) { |
| 73 if (!gvdafactory_impl_) | 73 if (!gvdafactory_impl_) |
| 74 return nullptr; | 74 return nullptr; |
| 75 | 75 |
| 76 const gpu::GpuPreferences gpu_preferences = | 76 const gpu::GpuPreferences gpu_preferences = |
| 77 GpuChildThread::current()->gpu_preferences(); | 77 GpuChildThread::current()->gpu_preferences(); |
| 78 return gvdafactory_impl_->CreateVDA(client, config, gpu_preferences); | 78 return gvdafactory_impl_->CreateVDA(client, config, gpu_preferences); |
| 79 } | 79 } |
| 80 | 80 |
| 81 GpuVideoDecodeAcceleratorFactory::GpuVideoDecodeAcceleratorFactory( | 81 GpuVideoDecodeAcceleratorFactory::GpuVideoDecodeAcceleratorFactory( |
| 82 std::unique_ptr<GpuVideoDecodeAcceleratorFactoryImpl> gvdafactory_impl) | 82 std::unique_ptr<media::GpuVideoDecodeAcceleratorFactoryImpl> |
| 83 : gvdafactory_impl_(std::move(gvdafactory_impl)) {} | 83 gvdafactory_impl) : gvdafactory_impl_(std::move(gvdafactory_impl)) {} |
| 84 | 84 |
| 85 } // namespace content | 85 } // namespace content |
| OLD | NEW |