| 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 #ifndef MEDIA_GPU_GPU_VIDEO_DECODE_ACCELERATOR_FACTORY_H_ | 5 #ifndef MEDIA_GPU_GPU_VIDEO_DECODE_ACCELERATOR_FACTORY_H_ |
| 6 #define MEDIA_GPU_GPU_VIDEO_DECODE_ACCELERATOR_FACTORY_H_ | 6 #define MEDIA_GPU_GPU_VIDEO_DECODE_ACCELERATOR_FACTORY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
| 12 #include "gpu/command_buffer/service/gpu_preferences.h" | 12 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 13 #include "gpu/config/gpu_driver_bug_workarounds.h" | 13 #include "gpu/config/gpu_driver_bug_workarounds.h" |
| 14 #include "gpu/config/gpu_info.h" | 14 #include "gpu/config/gpu_info.h" |
| 15 #include "media/base/android_overlay_config.h" |
| 15 #include "media/gpu/media_gpu_export.h" | 16 #include "media/gpu/media_gpu_export.h" |
| 16 #include "media/video/video_decode_accelerator.h" | 17 #include "media/video/video_decode_accelerator.h" |
| 17 | 18 |
| 18 namespace gl { | 19 namespace gl { |
| 19 class GLContext; | 20 class GLContext; |
| 20 class GLImage; | 21 class GLImage; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace gpu { | 24 namespace gpu { |
| 24 struct GpuPreferences; | 25 struct GpuPreferences; |
| 25 | 26 |
| 26 namespace gles2 { | 27 namespace gles2 { |
| 27 class GLES2Decoder; | 28 class GLES2Decoder; |
| 28 } | 29 } |
| 29 } | 30 } |
| 30 | 31 |
| 32 namespace service_manager { |
| 33 class Connector; |
| 34 } |
| 35 |
| 31 namespace media { | 36 namespace media { |
| 32 | 37 |
| 33 class MEDIA_GPU_EXPORT GpuVideoDecodeAcceleratorFactory { | 38 class MEDIA_GPU_EXPORT GpuVideoDecodeAcceleratorFactory { |
| 34 public: | 39 public: |
| 35 ~GpuVideoDecodeAcceleratorFactory(); | 40 ~GpuVideoDecodeAcceleratorFactory(); |
| 36 | 41 |
| 37 // Return current GLContext. | 42 // Return current GLContext. |
| 38 using GetGLContextCallback = base::Callback<gl::GLContext*(void)>; | 43 using GetGLContextCallback = base::Callback<gl::GLContext*(void)>; |
| 39 | 44 |
| 40 // Make the applicable GL context current. To be called by VDAs before | 45 // Make the applicable GL context current. To be called by VDAs before |
| (...skipping 17 matching lines...) Expand all Loading... |
| 58 static std::unique_ptr<GpuVideoDecodeAcceleratorFactory> Create( | 63 static std::unique_ptr<GpuVideoDecodeAcceleratorFactory> Create( |
| 59 const GetGLContextCallback& get_gl_context_cb, | 64 const GetGLContextCallback& get_gl_context_cb, |
| 60 const MakeGLContextCurrentCallback& make_context_current_cb, | 65 const MakeGLContextCurrentCallback& make_context_current_cb, |
| 61 const BindGLImageCallback& bind_image_cb); | 66 const BindGLImageCallback& bind_image_cb); |
| 62 | 67 |
| 63 static std::unique_ptr<GpuVideoDecodeAcceleratorFactory> | 68 static std::unique_ptr<GpuVideoDecodeAcceleratorFactory> |
| 64 CreateWithGLES2Decoder( | 69 CreateWithGLES2Decoder( |
| 65 const GetGLContextCallback& get_gl_context_cb, | 70 const GetGLContextCallback& get_gl_context_cb, |
| 66 const MakeGLContextCurrentCallback& make_context_current_cb, | 71 const MakeGLContextCurrentCallback& make_context_current_cb, |
| 67 const BindGLImageCallback& bind_image_cb, | 72 const BindGLImageCallback& bind_image_cb, |
| 68 const GetGLES2DecoderCallback& get_gles2_decoder_cb); | 73 const GetGLES2DecoderCallback& get_gles2_decoder_cb, |
| 74 service_manager::Connector* connector, |
| 75 const char* browser_service_name); |
| 69 | 76 |
| 70 static std::unique_ptr<GpuVideoDecodeAcceleratorFactory> CreateWithNoGL(); | 77 static std::unique_ptr<GpuVideoDecodeAcceleratorFactory> CreateWithNoGL(); |
| 71 | 78 |
| 72 static gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilities( | 79 static gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilities( |
| 73 const gpu::GpuPreferences& gpu_preferences, | 80 const gpu::GpuPreferences& gpu_preferences, |
| 74 const gpu::GpuDriverBugWorkarounds& workarounds); | 81 const gpu::GpuDriverBugWorkarounds& workarounds); |
| 75 | 82 |
| 76 std::unique_ptr<VideoDecodeAccelerator> CreateVDA( | 83 std::unique_ptr<VideoDecodeAccelerator> CreateVDA( |
| 77 VideoDecodeAccelerator::Client* client, | 84 VideoDecodeAccelerator::Client* client, |
| 78 const VideoDecodeAccelerator::Config& config, | 85 const VideoDecodeAccelerator::Config& config, |
| 79 const gpu::GpuDriverBugWorkarounds& workarounds, | 86 const gpu::GpuDriverBugWorkarounds& workarounds, |
| 80 const gpu::GpuPreferences& gpu_preferences); | 87 const gpu::GpuPreferences& gpu_preferences); |
| 81 | 88 |
| 82 private: | 89 private: |
| 83 GpuVideoDecodeAcceleratorFactory( | 90 GpuVideoDecodeAcceleratorFactory( |
| 84 const GetGLContextCallback& get_gl_context_cb, | 91 const GetGLContextCallback& get_gl_context_cb, |
| 85 const MakeGLContextCurrentCallback& make_context_current_cb, | 92 const MakeGLContextCurrentCallback& make_context_current_cb, |
| 86 const BindGLImageCallback& bind_image_cb, | 93 const BindGLImageCallback& bind_image_cb, |
| 87 const GetGLES2DecoderCallback& get_gles2_decoder_cb); | 94 const GetGLES2DecoderCallback& get_gles2_decoder_cb, |
| 95 service_manager::Connector* connector, |
| 96 const char* browser_service_name); |
| 88 | 97 |
| 89 #if defined(OS_WIN) | 98 #if defined(OS_WIN) |
| 90 std::unique_ptr<VideoDecodeAccelerator> CreateD3D11VDA( | 99 std::unique_ptr<VideoDecodeAccelerator> CreateD3D11VDA( |
| 91 const gpu::GpuDriverBugWorkarounds& workarounds, | 100 const gpu::GpuDriverBugWorkarounds& workarounds, |
| 92 const gpu::GpuPreferences& gpu_preferences) const; | 101 const gpu::GpuPreferences& gpu_preferences) const; |
| 93 std::unique_ptr<VideoDecodeAccelerator> CreateDXVAVDA( | 102 std::unique_ptr<VideoDecodeAccelerator> CreateDXVAVDA( |
| 94 const gpu::GpuDriverBugWorkarounds& workarounds, | 103 const gpu::GpuDriverBugWorkarounds& workarounds, |
| 95 const gpu::GpuPreferences& gpu_preferences) const; | 104 const gpu::GpuPreferences& gpu_preferences) const; |
| 96 #endif | 105 #endif |
| 97 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) | 106 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 109 #endif | 118 #endif |
| 110 #if defined(OS_MACOSX) | 119 #if defined(OS_MACOSX) |
| 111 std::unique_ptr<VideoDecodeAccelerator> CreateVTVDA( | 120 std::unique_ptr<VideoDecodeAccelerator> CreateVTVDA( |
| 112 const gpu::GpuDriverBugWorkarounds& workarounds, | 121 const gpu::GpuDriverBugWorkarounds& workarounds, |
| 113 const gpu::GpuPreferences& gpu_preferences) const; | 122 const gpu::GpuPreferences& gpu_preferences) const; |
| 114 #endif | 123 #endif |
| 115 #if defined(OS_ANDROID) | 124 #if defined(OS_ANDROID) |
| 116 std::unique_ptr<VideoDecodeAccelerator> CreateAndroidVDA( | 125 std::unique_ptr<VideoDecodeAccelerator> CreateAndroidVDA( |
| 117 const gpu::GpuDriverBugWorkarounds& workarounds, | 126 const gpu::GpuDriverBugWorkarounds& workarounds, |
| 118 const gpu::GpuPreferences& gpu_preferences) const; | 127 const gpu::GpuPreferences& gpu_preferences) const; |
| 128 |
| 129 static std::unique_ptr<media::AndroidOverlay> CreateAndroidOverlay( |
| 130 service_manager::Connector* connector, |
| 131 const char* browser_service_name, |
| 132 const base::UnguessableToken& routing_token, |
| 133 media::AndroidOverlayConfig config); |
| 119 #endif | 134 #endif |
| 120 | 135 |
| 121 const GetGLContextCallback get_gl_context_cb_; | 136 const GetGLContextCallback get_gl_context_cb_; |
| 122 const MakeGLContextCurrentCallback make_context_current_cb_; | 137 const MakeGLContextCurrentCallback make_context_current_cb_; |
| 123 const BindGLImageCallback bind_image_cb_; | 138 const BindGLImageCallback bind_image_cb_; |
| 124 const GetGLES2DecoderCallback get_gles2_decoder_cb_; | 139 const GetGLES2DecoderCallback get_gles2_decoder_cb_; |
| 140 service_manager::Connector* connector_ = nullptr; |
| 141 const char* browser_service_name_ = nullptr; |
| 125 | 142 |
| 126 base::ThreadChecker thread_checker_; | 143 base::ThreadChecker thread_checker_; |
| 127 | 144 |
| 128 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAcceleratorFactory); | 145 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAcceleratorFactory); |
| 129 }; | 146 }; |
| 130 | 147 |
| 131 } // namespace media | 148 } // namespace media |
| 132 | 149 |
| 133 #endif // MEDIA_GPU_GPU_VIDEO_DECODE_ACCELERATOR_FACTORY_H_ | 150 #endif // MEDIA_GPU_GPU_VIDEO_DECODE_ACCELERATOR_FACTORY_H_ |
| OLD | NEW |