OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 MEDIA_GPU_GLES2_DECODER_HELPER_H_ |
| 6 #define MEDIA_GPU_GLES2_DECODER_HELPER_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <memory> |
| 11 |
| 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/optional.h" |
| 14 #include "media/gpu/media_gpu_export.h" |
| 15 #include "ui/gl/gl_bindings.h" |
| 16 |
| 17 namespace gpu { |
| 18 struct Mailbox; |
| 19 namespace gles2 { |
| 20 class GLES2Decoder; |
| 21 class TextureRef; |
| 22 } // namespace gles2 |
| 23 } // namespace gpu |
| 24 |
| 25 namespace media { |
| 26 |
| 27 // Utility methods to simplify working with a gpu::gles2::GLES2Decoder from |
| 28 // inside VDAs. |
| 29 class MEDIA_GPU_EXPORT GLES2DecoderHelper { |
| 30 public: |
| 31 static std::unique_ptr<GLES2DecoderHelper> Create( |
| 32 gpu::gles2::GLES2Decoder* decoder); |
| 33 |
| 34 virtual ~GLES2DecoderHelper() {} |
| 35 |
| 36 // TODO(sandersd): Provide scoped version? |
| 37 virtual bool MakeContextCurrent() = 0; |
| 38 |
| 39 // Creates a texture and configures it as a video frame (linear filtering, |
| 40 // clamp to edge, no mipmaps). The context must be current. |
| 41 // |
| 42 // See glTexImage2D() for parameter definitions. |
| 43 // |
| 44 // Returns nullptr on failure, but there are currently no failure paths. |
| 45 virtual scoped_refptr<gpu::gles2::TextureRef> CreateTexture( |
| 46 GLenum target, |
| 47 GLenum internal_format, |
| 48 GLsizei width, |
| 49 GLsizei height, |
| 50 GLenum format, |
| 51 GLenum type) = 0; |
| 52 |
| 53 // Creates a mailbox for a texture. |
| 54 virtual gpu::Mailbox CreateMailbox(gpu::gles2::TextureRef* texture_ref) = 0; |
| 55 }; |
| 56 |
| 57 } // namespace media |
| 58 |
| 59 #endif // MEDIA_GPU_GLES2_DECODER_HELPER_H_ |
OLD | NEW |