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