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