| 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 "media/gpu/gpu_video_decode_accelerator_factory.h" | 5 #include "media/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 "gpu/command_buffer/service/gpu_preferences.h" | 8 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 9 #include "media/base/media_switches.h" | 9 #include "media/base/media_switches.h" |
| 10 #include "media/gpu/gpu_video_accelerator_util.h" | 10 #include "media/gpu/gpu_video_accelerator_util.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 namespace media { | 36 namespace media { |
| 37 | 37 |
| 38 // static | 38 // static |
| 39 MEDIA_GPU_EXPORT std::unique_ptr<GpuVideoDecodeAcceleratorFactory> | 39 MEDIA_GPU_EXPORT std::unique_ptr<GpuVideoDecodeAcceleratorFactory> |
| 40 GpuVideoDecodeAcceleratorFactory::Create( | 40 GpuVideoDecodeAcceleratorFactory::Create( |
| 41 const GetGLContextCallback& get_gl_context_cb, | 41 const GetGLContextCallback& get_gl_context_cb, |
| 42 const MakeGLContextCurrentCallback& make_context_current_cb, | 42 const MakeGLContextCurrentCallback& make_context_current_cb, |
| 43 const BindGLImageCallback& bind_image_cb) { | 43 const BindGLImageCallback& bind_image_cb) { |
| 44 return base::WrapUnique(new GpuVideoDecodeAcceleratorFactory( | 44 return base::WrapUnique(new GpuVideoDecodeAcceleratorFactory( |
| 45 get_gl_context_cb, make_context_current_cb, bind_image_cb, | 45 get_gl_context_cb, make_context_current_cb, bind_image_cb, |
| 46 GetGLES2DecoderCallback())); | 46 GetGLES2DecoderCallback(), AndroidOverlayMojoFactoryCB())); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // static | 49 // static |
| 50 MEDIA_GPU_EXPORT std::unique_ptr<GpuVideoDecodeAcceleratorFactory> | 50 MEDIA_GPU_EXPORT std::unique_ptr<GpuVideoDecodeAcceleratorFactory> |
| 51 GpuVideoDecodeAcceleratorFactory::CreateWithGLES2Decoder( | 51 GpuVideoDecodeAcceleratorFactory::CreateWithGLES2Decoder( |
| 52 const GetGLContextCallback& get_gl_context_cb, | 52 const GetGLContextCallback& get_gl_context_cb, |
| 53 const MakeGLContextCurrentCallback& make_context_current_cb, | 53 const MakeGLContextCurrentCallback& make_context_current_cb, |
| 54 const BindGLImageCallback& bind_image_cb, | 54 const BindGLImageCallback& bind_image_cb, |
| 55 const GetGLES2DecoderCallback& get_gles2_decoder_cb) { | 55 const GetGLES2DecoderCallback& get_gles2_decoder_cb, |
| 56 const AndroidOverlayMojoFactoryCB& overlay_factory_cb) { |
| 56 return base::WrapUnique(new GpuVideoDecodeAcceleratorFactory( | 57 return base::WrapUnique(new GpuVideoDecodeAcceleratorFactory( |
| 57 get_gl_context_cb, make_context_current_cb, bind_image_cb, | 58 get_gl_context_cb, make_context_current_cb, bind_image_cb, |
| 58 get_gles2_decoder_cb)); | 59 get_gles2_decoder_cb, overlay_factory_cb)); |
| 59 } | 60 } |
| 60 | 61 |
| 61 // static | 62 // static |
| 62 MEDIA_GPU_EXPORT std::unique_ptr<GpuVideoDecodeAcceleratorFactory> | 63 MEDIA_GPU_EXPORT std::unique_ptr<GpuVideoDecodeAcceleratorFactory> |
| 63 GpuVideoDecodeAcceleratorFactory::CreateWithNoGL() { | 64 GpuVideoDecodeAcceleratorFactory::CreateWithNoGL() { |
| 64 return Create(GetGLContextCallback(), MakeGLContextCurrentCallback(), | 65 return Create(GetGLContextCallback(), MakeGLContextCurrentCallback(), |
| 65 BindGLImageCallback()); | 66 BindGLImageCallback()); |
| 66 } | 67 } |
| 67 | 68 |
| 68 // static | 69 // static |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 248 |
| 248 #if defined(OS_ANDROID) | 249 #if defined(OS_ANDROID) |
| 249 std::unique_ptr<VideoDecodeAccelerator> | 250 std::unique_ptr<VideoDecodeAccelerator> |
| 250 GpuVideoDecodeAcceleratorFactory::CreateAndroidVDA( | 251 GpuVideoDecodeAcceleratorFactory::CreateAndroidVDA( |
| 251 const gpu::GpuDriverBugWorkarounds& workarounds, | 252 const gpu::GpuDriverBugWorkarounds& workarounds, |
| 252 const gpu::GpuPreferences& gpu_preferences) const { | 253 const gpu::GpuPreferences& gpu_preferences) const { |
| 253 std::unique_ptr<VideoDecodeAccelerator> decoder; | 254 std::unique_ptr<VideoDecodeAccelerator> decoder; |
| 254 decoder.reset(new AndroidVideoDecodeAccelerator( | 255 decoder.reset(new AndroidVideoDecodeAccelerator( |
| 255 AVDACodecAllocator::GetInstance(), | 256 AVDACodecAllocator::GetInstance(), |
| 256 base::MakeUnique<AndroidVideoSurfaceChooserImpl>(), | 257 base::MakeUnique<AndroidVideoSurfaceChooserImpl>(), |
| 257 make_context_current_cb_, get_gles2_decoder_cb_, | 258 make_context_current_cb_, get_gles2_decoder_cb_, overlay_factory_cb_, |
| 258 AndroidVideoDecodeAccelerator::PlatformConfig::CreateDefault())); | 259 AndroidVideoDecodeAccelerator::PlatformConfig::CreateDefault())); |
| 259 return decoder; | 260 return decoder; |
| 260 } | 261 } |
| 261 #endif | 262 #endif |
| 262 | 263 |
| 263 GpuVideoDecodeAcceleratorFactory::GpuVideoDecodeAcceleratorFactory( | 264 GpuVideoDecodeAcceleratorFactory::GpuVideoDecodeAcceleratorFactory( |
| 264 const GetGLContextCallback& get_gl_context_cb, | 265 const GetGLContextCallback& get_gl_context_cb, |
| 265 const MakeGLContextCurrentCallback& make_context_current_cb, | 266 const MakeGLContextCurrentCallback& make_context_current_cb, |
| 266 const BindGLImageCallback& bind_image_cb, | 267 const BindGLImageCallback& bind_image_cb, |
| 267 const GetGLES2DecoderCallback& get_gles2_decoder_cb) | 268 const GetGLES2DecoderCallback& get_gles2_decoder_cb, |
| 269 const AndroidOverlayMojoFactoryCB& overlay_factory_cb) |
| 268 : get_gl_context_cb_(get_gl_context_cb), | 270 : get_gl_context_cb_(get_gl_context_cb), |
| 269 make_context_current_cb_(make_context_current_cb), | 271 make_context_current_cb_(make_context_current_cb), |
| 270 bind_image_cb_(bind_image_cb), | 272 bind_image_cb_(bind_image_cb), |
| 271 get_gles2_decoder_cb_(get_gles2_decoder_cb) {} | 273 get_gles2_decoder_cb_(get_gles2_decoder_cb), |
| 274 overlay_factory_cb_(overlay_factory_cb) {} |
| 272 | 275 |
| 273 GpuVideoDecodeAcceleratorFactory::~GpuVideoDecodeAcceleratorFactory() {} | 276 GpuVideoDecodeAcceleratorFactory::~GpuVideoDecodeAcceleratorFactory() {} |
| 274 | 277 |
| 275 } // namespace media | 278 } // namespace media |
| OLD | NEW |