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 implementation of picture allocation for the | 5 // This file contains an implementation of picture allocation for the |
6 // Ozone window system used by VaapiVideoDecodeAccelerator to produce | 6 // Ozone window system used by VaapiVideoDecodeAccelerator to produce |
7 // output pictures. | 7 // output pictures. |
8 | 8 |
9 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ | 9 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ |
10 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ | 10 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ |
11 | 11 |
12 #include <stdint.h> | 12 #include <stdint.h> |
13 | 13 |
| 14 #include "base/callback.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
17 #include "content/common/gpu/media/vaapi_picture.h" | 18 #include "content/common/gpu/media/vaapi_picture.h" |
18 #include "ui/gfx/buffer_types.h" | 19 #include "ui/gfx/buffer_types.h" |
19 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
20 | 21 |
21 namespace gl { | 22 namespace gl { |
22 class GLImage; | 23 class GLImage; |
23 } | 24 } |
24 | 25 |
25 namespace ui { | 26 namespace ui { |
26 class NativePixmap; | 27 class NativePixmap; |
27 } | 28 } |
28 | 29 |
29 namespace content { | 30 namespace content { |
30 | 31 |
31 class VaapiWrapper; | 32 class VaapiWrapper; |
32 | 33 |
33 // Implementation of VaapiPicture for the ozone/drm backed chromium. | 34 // Implementation of VaapiPicture for the ozone/drm backed chromium. |
34 class VaapiDrmPicture : public VaapiPicture { | 35 class VaapiDrmPicture : public VaapiPicture { |
35 public: | 36 public: |
36 VaapiDrmPicture(const scoped_refptr<VaapiWrapper>& vaapi_wrapper, | 37 VaapiDrmPicture(const scoped_refptr<VaapiWrapper>& vaapi_wrapper, |
37 const MakeGLContextCurrentCallback& make_context_current_cb, | 38 const base::Callback<bool(void)>& make_context_current, |
38 int32_t picture_buffer_id, | 39 int32_t picture_buffer_id, |
39 uint32_t texture_id, | 40 uint32_t texture_id, |
40 const gfx::Size& size); | 41 const gfx::Size& size); |
41 | 42 |
42 ~VaapiDrmPicture() override; | 43 ~VaapiDrmPicture() override; |
43 | 44 |
44 bool Initialize() override; | 45 bool Initialize() override; |
45 | 46 |
46 bool DownloadFromSurface(const scoped_refptr<VASurface>& va_surface) override; | 47 bool DownloadFromSurface(const scoped_refptr<VASurface>& va_surface) override; |
47 | 48 |
48 scoped_refptr<gl::GLImage> GetImageToBind() override; | 49 scoped_refptr<gl::GLImage> GetImageToBind() override; |
49 | 50 |
50 bool AllowOverlay() const override; | 51 bool AllowOverlay() const override; |
51 | 52 |
52 private: | 53 private: |
53 scoped_refptr<VaapiWrapper> vaapi_wrapper_; | 54 scoped_refptr<VaapiWrapper> vaapi_wrapper_; |
54 MakeGLContextCurrentCallback make_context_current_cb_; | 55 base::Callback<bool(void)> make_context_current_; |
55 | 56 |
56 // Ozone buffer, the storage of the EGLImage and the VASurface. | 57 // Ozone buffer, the storage of the EGLImage and the VASurface. |
57 scoped_refptr<ui::NativePixmap> pixmap_; | 58 scoped_refptr<ui::NativePixmap> pixmap_; |
58 | 59 |
59 // EGLImage bound to the GL textures used by the VDA client. | 60 // EGLImage bound to the GL textures used by the VDA client. |
60 scoped_refptr<gl::GLImage> gl_image_; | 61 scoped_refptr<gl::GLImage> gl_image_; |
61 | 62 |
62 // VASurface used to transfer from the decoder's pixel format. | 63 // VASurface used to transfer from the decoder's pixel format. |
63 scoped_refptr<VASurface> va_surface_; | 64 scoped_refptr<VASurface> va_surface_; |
64 | 65 |
65 DISALLOW_COPY_AND_ASSIGN(VaapiDrmPicture); | 66 DISALLOW_COPY_AND_ASSIGN(VaapiDrmPicture); |
66 }; | 67 }; |
67 | 68 |
68 } // namespace content | 69 } // namespace content |
69 | 70 |
70 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ | 71 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_DRM_PICTURE_H_ |
OLD | NEW |