OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 // This file contains an interface of output pictures for the Vaapi | 5 // This file contains an interface of output pictures for the Vaapi |
6 // video decoder. This is implemented by different window system | 6 // video decoder. This is implemented by different window system |
7 // (X11/Ozone) and used by VaapiVideoDecodeAccelerator to produce | 7 // (X11/Ozone) and used by VaapiVideoDecodeAccelerator to produce |
8 // output pictures. | 8 // output pictures. |
9 | 9 |
10 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_ | 10 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_ |
11 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_ | 11 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_ |
12 | 12 |
13 #include <stdint.h> | 13 #include <stdint.h> |
14 | 14 |
15 #include "base/callback.h" | |
16 #include "base/macros.h" | 15 #include "base/macros.h" |
17 #include "base/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.h" |
18 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
19 #include "base/threading/non_thread_safe.h" | 18 #include "base/threading/non_thread_safe.h" |
| 19 #include "content/common/gpu/media/gpu_video_decode_accelerator_helpers.h" |
20 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
21 | 21 |
22 namespace gl { | 22 namespace gl { |
23 class GLImage; | 23 class GLImage; |
24 } | 24 } |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 | 27 |
28 class VASurface; | 28 class VASurface; |
29 class VaapiWrapper; | 29 class VaapiWrapper; |
(...skipping 15 matching lines...) Expand all Loading... |
45 // Returns the |GLImage|, if any, to bind to the texture. | 45 // Returns the |GLImage|, if any, to bind to the texture. |
46 virtual scoped_refptr<gl::GLImage> GetImageToBind() = 0; | 46 virtual scoped_refptr<gl::GLImage> GetImageToBind() = 0; |
47 | 47 |
48 // Downloads the |va_surface| into the picture, potentially scaling | 48 // Downloads the |va_surface| into the picture, potentially scaling |
49 // it if needed. | 49 // it if needed. |
50 virtual bool DownloadFromSurface( | 50 virtual bool DownloadFromSurface( |
51 const scoped_refptr<VASurface>& va_surface) = 0; | 51 const scoped_refptr<VASurface>& va_surface) = 0; |
52 | 52 |
53 // Create a VaapiPicture of |size| to be associated with | 53 // Create a VaapiPicture of |size| to be associated with |
54 // |picture_buffer_id| and bound to |texture_id|. | 54 // |picture_buffer_id| and bound to |texture_id|. |
55 // |make_context_current| is provided for the GL operations. | 55 // |make_context_current_cb| is provided for the GL operations. |
56 static linked_ptr<VaapiPicture> CreatePicture( | 56 static linked_ptr<VaapiPicture> CreatePicture( |
57 const scoped_refptr<VaapiWrapper>& vaapi_wrapper, | 57 const scoped_refptr<VaapiWrapper>& vaapi_wrapper, |
58 const base::Callback<bool(void)> make_context_current, | 58 const MakeGLContextCurrentCallback& make_context_current_cb, |
59 int32_t picture_buffer_id, | 59 int32_t picture_buffer_id, |
60 uint32_t texture_id, | 60 uint32_t texture_id, |
61 const gfx::Size& size); | 61 const gfx::Size& size); |
62 | 62 |
63 // Get the texture target used to bind EGLImages (either | 63 // Get the texture target used to bind EGLImages (either |
64 // GL_TEXTURE_2D on X11 or GL_TEXTURE_EXTERNAL_OES on DRM). | 64 // GL_TEXTURE_2D on X11 or GL_TEXTURE_EXTERNAL_OES on DRM). |
65 static uint32_t GetGLTextureTarget(); | 65 static uint32_t GetGLTextureTarget(); |
66 | 66 |
67 protected: | 67 protected: |
68 VaapiPicture(int32_t picture_buffer_id, | 68 VaapiPicture(int32_t picture_buffer_id, |
69 uint32_t texture_id, | 69 uint32_t texture_id, |
70 const gfx::Size& size) | 70 const gfx::Size& size) |
71 : picture_buffer_id_(picture_buffer_id), | 71 : picture_buffer_id_(picture_buffer_id), |
72 texture_id_(texture_id), | 72 texture_id_(texture_id), |
73 size_(size) {} | 73 size_(size) {} |
74 | 74 |
75 private: | 75 private: |
76 int32_t picture_buffer_id_; | 76 int32_t picture_buffer_id_; |
77 uint32_t texture_id_; | 77 uint32_t texture_id_; |
78 gfx::Size size_; | 78 gfx::Size size_; |
79 | 79 |
80 DISALLOW_COPY_AND_ASSIGN(VaapiPicture); | 80 DISALLOW_COPY_AND_ASSIGN(VaapiPicture); |
81 }; | 81 }; |
82 | 82 |
83 } // namespace content | 83 } // namespace content |
84 | 84 |
85 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_ | 85 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_ |
OLD | NEW |