Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: content/public/gpu/gpu_video_decode_accelerator_factory.h

Issue 1745903002: Introduce GpuVideoDecodeAcceleratorFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_
kcwu 2016/03/16 06:26:37 s/COMMON/GPU/
Pawel Osciak 2016/03/16 09:50:10 Done.
7
8 #include "base/callback.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/threading/thread_checker.h"
11 #include "content/common/content_export.h"
12 #include "gpu/config/gpu_info.h"
13 #include "media/video/video_decode_accelerator.h"
14
15 namespace gfx {
16 class GLContext;
17 }
18
19 namespace gl {
20 class GLImage;
21 }
22
23 namespace gpu {
24 namespace gles2 {
25 class GLES2Decoder;
26 }
27 }
28
29 namespace content {
30
31 // This factory allows creation of VideoDecodeAccelerator implementations,
32 // providing the most applicable VDA for current platform and given
33 // configuration. To be used in GPU process only.
34 class CONTENT_EXPORT GpuVideoDecodeAcceleratorFactory {
35 public:
36 ~GpuVideoDecodeAcceleratorFactory();
37
38 // Return current GLContext.
39 using GetGLContextCallback = base::Callback<gfx::GLContext*(void)>;
40
41 // Make the applicable GL context current. To be called by VDAs before
42 // executing any GL calls. Return true on success, false otherwise.
43 using MakeGLContextCurrentCallback = base::Callback<bool(void)>;
44
45 // Bind |image| to |client_texture_id| given |texture_target|.
46 // Return true on success, false otherwise.
47 using BindGLImageCallback =
48 base::Callback<bool(uint32_t client_texture_id,
49 uint32_t texture_target,
50 const scoped_refptr<gl::GLImage>& image)>;
51
52 // Return a WeakPtr to a GLES2Decoder, if one is available.
53 using GetGLES2DecoderCallback =
54 base::Callback<base::WeakPtr<gpu::gles2::GLES2Decoder>(void)>;
55
56 // Create a factory capable of producing VDA instances for current platform.
57 static scoped_ptr<GpuVideoDecodeAcceleratorFactory> Create(
58 const GetGLContextCallback& get_gl_context_cb,
59 const MakeGLContextCurrentCallback& make_context_current_cb,
60 const BindGLImageCallback& bind_image_cb);
61
62 static scoped_ptr<GpuVideoDecodeAcceleratorFactory> CreateWithGLES2Decoder(
63 const GetGLContextCallback& get_gl_context_cb,
64 const MakeGLContextCurrentCallback& make_context_current_cb,
65 const BindGLImageCallback& bind_image_cb,
66 const GetGLES2DecoderCallback& get_gles2_decoder_cb);
67
68 // Return decoder capabilities supported on the current platform.
69 static gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilities();
70
71 // Create a VDA for the current platform for |client| with the given |config|.
72 // Return nullptr on failure.
73 scoped_ptr<media::VideoDecodeAccelerator> CreateVDA(
74 media::VideoDecodeAccelerator::Client* client,
75 const media::VideoDecodeAccelerator::Config& config);
76
77 private:
78 GpuVideoDecodeAcceleratorFactory(
79 const GetGLContextCallback& get_gl_context_cb,
80 const MakeGLContextCurrentCallback& make_context_current_cb,
81 const BindGLImageCallback& bind_image_cb,
82 const GetGLES2DecoderCallback& get_gles2_decoder_cb);
83
84 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA() const;
85 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2VDA() const;
86 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2SVDA() const;
87 scoped_ptr<media::VideoDecodeAccelerator> CreateVaapiVDA() const;
88 scoped_ptr<media::VideoDecodeAccelerator> CreateVTVDA() const;
89 scoped_ptr<media::VideoDecodeAccelerator> CreateOzoneVDA() const;
90 scoped_ptr<media::VideoDecodeAccelerator> CreateAndroidVDA() const;
91
92 const GetGLContextCallback get_gl_context_cb_;
93 const MakeGLContextCurrentCallback make_context_current_cb_;
94 const BindGLImageCallback bind_image_cb_;
95 const GetGLES2DecoderCallback& get_gles2_decoder_cb_;
96
97 base::ThreadChecker thread_checker_;
98
99 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAcceleratorFactory);
100 };
101
102 } // namespace content
103
104 #endif // CONTENT_PUBLIC_COMMON_GPU_VIDEO_DECODE_ACCELERATOR_FACTORY_H_
kcwu 2016/03/16 06:26:37 s/COMMON/GPU/
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698