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 #ifndef CONTENT_PUBLIC_COMMON_GPU_VIDEO_DECODE_ACCELERATOR_FACTORY_H_ |
| 6 #define CONTENT_PUBLIC_COMMON_GPU_VIDEO_DECODE_ACCELERATOR_FACTORY_H_ |
| 7 |
| 8 #include "base/threading/thread_checker.h" |
| 9 #include "content/public/common/gpu_video_decode_accelerator_helpers.h" |
| 10 #include "gpu/config/gpu_info.h" |
| 11 #include "media/video/video_decode_accelerator.h" |
| 12 |
| 13 namespace content { |
| 14 |
| 15 // This factory allows creation of VideoDecodeAccelerator implementations, |
| 16 // providing the most applicable VDA for current platform and given |
| 17 // configuration. To be used in GPU process only. |
| 18 class CONTENT_EXPORT GpuVideoDecodeAcceleratorFactory { |
| 19 public: |
| 20 ~GpuVideoDecodeAcceleratorFactory(); |
| 21 |
| 22 // Create a factory capable of producing VDA instances for current platform. |
| 23 static scoped_ptr<GpuVideoDecodeAcceleratorFactory> Create( |
| 24 const gpu_vda_helpers::GetGLContextCb& get_gl_context_cb, |
| 25 const gpu_vda_helpers::MakeGLContextCurrentCb& make_context_current_cb, |
| 26 const gpu_vda_helpers::BindGLImageCb& bind_image_cb); |
| 27 |
| 28 static scoped_ptr<GpuVideoDecodeAcceleratorFactory> CreateWithGLES2Decoder( |
| 29 const gpu_vda_helpers::GetGLContextCb& get_gl_context_cb, |
| 30 const gpu_vda_helpers::MakeGLContextCurrentCb& make_context_current_cb, |
| 31 const gpu_vda_helpers::BindGLImageCb& bind_image_cb, |
| 32 const gpu_vda_helpers::GetGLES2DecoderCb& get_gles2_decoder_cb); |
| 33 |
| 34 // Return decoder capabilities supported on the current platform. |
| 35 static gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilities(); |
| 36 |
| 37 // Create a VDA for the current platform for |client| with the given |config|. |
| 38 // Return nullptr on failure. |
| 39 scoped_ptr<media::VideoDecodeAccelerator> CreateVDA( |
| 40 media::VideoDecodeAccelerator::Client* client, |
| 41 const media::VideoDecodeAccelerator::Config& config); |
| 42 |
| 43 private: |
| 44 GpuVideoDecodeAcceleratorFactory( |
| 45 const gpu_vda_helpers::GetGLContextCb& get_gl_context_cb, |
| 46 const gpu_vda_helpers::MakeGLContextCurrentCb& make_context_current_cb, |
| 47 const gpu_vda_helpers::BindGLImageCb& bind_image_cb, |
| 48 const gpu_vda_helpers::GetGLES2DecoderCb& get_gles2_decoder_cb); |
| 49 |
| 50 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA() const; |
| 51 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2VDA() const; |
| 52 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2SVDA() const; |
| 53 scoped_ptr<media::VideoDecodeAccelerator> CreateVaapiVDA() const; |
| 54 scoped_ptr<media::VideoDecodeAccelerator> CreateVTVDA() const; |
| 55 scoped_ptr<media::VideoDecodeAccelerator> CreateOzoneVDA() const; |
| 56 scoped_ptr<media::VideoDecodeAccelerator> CreateAndroidVDA() const; |
| 57 |
| 58 const gpu_vda_helpers::GetGLContextCb get_gl_context_cb_; |
| 59 const gpu_vda_helpers::MakeGLContextCurrentCb make_context_current_cb_; |
| 60 const gpu_vda_helpers::BindGLImageCb bind_image_cb_; |
| 61 const gpu_vda_helpers::GetGLES2DecoderCb& get_gles2_decoder_cb_; |
| 62 |
| 63 base::ThreadChecker thread_checker_; |
| 64 |
| 65 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAcceleratorFactory); |
| 66 }; |
| 67 |
| 68 } // namespace content |
| 69 |
| 70 #endif // CONTENT_PUBLIC_COMMON_GPU_VIDEO_DECODE_ACCELERATOR_FACTORY_H_ |
OLD | NEW |