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_HELPERS_H_ | 5 #ifndef MEDIA_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HELPERS_H_ |
6 #define MEDIA_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HELPERS_H_ | 6 #define MEDIA_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HELPERS_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 | 10 |
11 namespace gfx { | 11 namespace gl { |
12 class GLContext; | 12 class GLContext; |
13 } | |
14 | |
15 namespace gl { | |
16 class GLImage; | 13 class GLImage; |
17 } | 14 } |
18 | 15 |
19 namespace gpu { | 16 namespace gpu { |
20 namespace gles2 { | 17 namespace gles2 { |
21 class GLES2Decoder; | 18 class GLES2Decoder; |
22 } | 19 } |
23 } | 20 } |
24 | 21 |
25 namespace media { | 22 namespace media { |
26 | 23 |
27 // Helpers/defines for specific VideoDecodeAccelerator implementations in GPU | 24 // Helpers/defines for specific VideoDecodeAccelerator implementations in GPU |
28 // process. Which callbacks are required depends on the implementation. | 25 // process. Which callbacks are required depends on the implementation. |
29 // | 26 // |
30 // Note that these callbacks may be called more than once, and so must own/share | 27 // Note that these callbacks may be called more than once, and so must own/share |
31 // ownership of any objects bound to them. | 28 // ownership of any objects bound to them. |
32 // | 29 // |
33 // Unless specified otherwise, these callbacks must be executed on the GPU Child | 30 // Unless specified otherwise, these callbacks must be executed on the GPU Child |
34 // thread (i.e. the thread which the VDAs are initialized on). | 31 // thread (i.e. the thread which the VDAs are initialized on). |
35 | 32 |
36 // Return current GLContext. | 33 // Return current GLContext. |
37 using GetGLContextCallback = base::Callback<gfx::GLContext*(void)>; | 34 using GetGLContextCallback = base::Callback<gl::GLContext*(void)>; |
38 | 35 |
39 // Make the applicable GL context current. To be called by VDAs before | 36 // Make the applicable GL context current. To be called by VDAs before |
40 // executing any GL calls. Return true on success, false otherwise. | 37 // executing any GL calls. Return true on success, false otherwise. |
41 using MakeGLContextCurrentCallback = base::Callback<bool(void)>; | 38 using MakeGLContextCurrentCallback = base::Callback<bool(void)>; |
42 | 39 |
43 // Bind |image| to |client_texture_id| given |texture_target|. If | 40 // Bind |image| to |client_texture_id| given |texture_target|. If |
44 // |can_bind_to_sampler| is true, then the image may be used as a sampler | 41 // |can_bind_to_sampler| is true, then the image may be used as a sampler |
45 // directly, otherwise a copy to a staging buffer is required. | 42 // directly, otherwise a copy to a staging buffer is required. |
46 // Return true on success, false otherwise. | 43 // Return true on success, false otherwise. |
47 using BindGLImageCallback = | 44 using BindGLImageCallback = |
48 base::Callback<bool(uint32_t client_texture_id, | 45 base::Callback<bool(uint32_t client_texture_id, |
49 uint32_t texture_target, | 46 uint32_t texture_target, |
50 const scoped_refptr<gl::GLImage>& image, | 47 const scoped_refptr<gl::GLImage>& image, |
51 bool can_bind_to_sampler)>; | 48 bool can_bind_to_sampler)>; |
52 | 49 |
53 // Return a WeakPtr to a GLES2Decoder, if one is available. | 50 // Return a WeakPtr to a GLES2Decoder, if one is available. |
54 using GetGLES2DecoderCallback = | 51 using GetGLES2DecoderCallback = |
55 base::Callback<base::WeakPtr<gpu::gles2::GLES2Decoder>(void)>; | 52 base::Callback<base::WeakPtr<gpu::gles2::GLES2Decoder>(void)>; |
56 | 53 |
57 } // namespace media | 54 } // namespace media |
58 | 55 |
59 #endif // MEDIA_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HELPERS_H_ | 56 #endif // MEDIA_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HELPERS_H_ |
OLD | NEW |