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