Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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 // This file contains an interface of output pictures for the Vaapi | |
| 6 // video decoder. This is implemented by different window system | |
| 7 // (X11/Ozone) and used by VaapiVideoDecodeAccelerator to produce | |
| 8 // output pictures. | |
| 9 | |
| 10 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_ | |
| 11 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_ | |
| 12 | |
| 13 #include "base/callback.h" | |
| 14 #include "base/memory/linked_ptr.h" | |
| 15 #include "base/memory/ref_counted.h" | |
| 16 #include "base/threading/non_thread_safe.h" | |
| 17 #include "ui/gfx/size.h" | |
| 18 | |
| 19 namespace gfx { | |
| 20 class GLContext; | |
| 21 } // namespace gfx | |
| 22 | |
| 23 namespace content { | |
| 24 | |
| 25 class VASurface; | |
| 26 class VaapiWrapper; | |
| 27 | |
| 28 // Picture is native pixmap abstraction (X11/Ozone). | |
| 29 class VaapiPicture : public base::NonThreadSafe { | |
| 30 public: | |
| 31 virtual ~VaapiPicture() {} | |
|
scherkus (not reviewing)
2014/12/10 18:56:48
s/virtual/override/
llandwerlin-old
2014/12/13 15:23:54
Replacing virtual by override doesn't compile on C
| |
| 32 | |
| 33 // Try to allocate the underlying resources for the picture. | |
| 34 virtual bool Initialize() = 0; | |
| 35 | |
| 36 int32 picture_buffer_id() const { return picture_buffer_id_; } | |
| 37 uint32 texture_id() const { return texture_id_; } | |
| 38 const gfx::Size& size() const { return size_; } | |
| 39 | |
| 40 // Downloads the |va_surface| into the picture, potentially scaling | |
| 41 // it if needed. | |
| 42 virtual bool DownloadFromSurface( | |
| 43 const scoped_refptr<VASurface>& va_surface) = 0; | |
| 44 | |
| 45 // Create a VaapiPicture of |size| to be associated with | |
| 46 // |picture_buffer_id| and bound to |texture_id|. |gl_context| and | |
| 47 // |make_context_current| are provided for the GL operations. | |
| 48 static linked_ptr<VaapiPicture> CreatePicture( | |
| 49 const scoped_refptr<VaapiWrapper>& vaapi_wrapper, | |
| 50 gfx::GLContext* gl_context, | |
| 51 const base::Callback<bool(void)> make_context_current, | |
| 52 int32 picture_buffer_id, | |
| 53 uint32 texture_id, | |
| 54 const gfx::Size& size); | |
| 55 | |
| 56 // Get the texture target used to bind EGLImages (either | |
| 57 // GL_TEXTURE_2D on X11 or GL_TEXTURE_EXTERNAL_OES on DRM). | |
| 58 static uint32 GetGLTextureTarget(); | |
| 59 | |
| 60 protected: | |
| 61 VaapiPicture(int32 picture_buffer_id, | |
| 62 uint32 texture_id, | |
| 63 const gfx::Size& size) | |
| 64 : picture_buffer_id_(picture_buffer_id), | |
| 65 texture_id_(texture_id), | |
| 66 size_(size) {} | |
| 67 | |
| 68 private: | |
| 69 int32 picture_buffer_id_; | |
| 70 uint32 texture_id_; | |
| 71 gfx::Size size_; | |
| 72 | |
| 73 DISALLOW_COPY_AND_ASSIGN(VaapiPicture); | |
| 74 }; | |
| 75 | |
| 76 } // namespace content | |
| 77 | |
| 78 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_ | |
| OLD | NEW |