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 // X11 window system used by VaapiVideoDecodeAccelerator to produce | 6 // X11 window system used by VaapiVideoDecodeAccelerator to produce |
7 // output pictures. | 7 // output pictures. |
8 | 8 |
9 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_TFP_PICTURE_H_ | 9 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_TFP_PICTURE_H_ |
10 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_TFP_PICTURE_H_ | 10 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_TFP_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 "content/common/gpu/media/vaapi_picture.h" | 17 #include "content/common/gpu/media/vaapi_picture.h" |
17 #include "ui/gfx/geometry/size.h" | 18 #include "ui/gfx/geometry/size.h" |
18 #include "ui/gl/gl_bindings.h" | 19 #include "ui/gl/gl_bindings.h" |
19 | 20 |
20 namespace gfx { | 21 namespace gfx { |
21 class GLContextGLX; | 22 class GLContextGLX; |
22 } | 23 } |
23 | 24 |
24 namespace gl { | 25 namespace gl { |
25 class GLImageGLX; | 26 class GLImageGLX; |
26 } | 27 } |
27 | 28 |
28 namespace content { | 29 namespace content { |
29 | 30 |
30 class VaapiWrapper; | 31 class VaapiWrapper; |
31 | 32 |
32 // Implementation of VaapiPicture for the X11 backed chromium. | 33 // Implementation of VaapiPicture for the X11 backed chromium. |
33 class VaapiTFPPicture : public VaapiPicture { | 34 class VaapiTFPPicture : public VaapiPicture { |
34 public: | 35 public: |
35 VaapiTFPPicture(const scoped_refptr<VaapiWrapper>& vaapi_wrapper, | 36 VaapiTFPPicture(const scoped_refptr<VaapiWrapper>& vaapi_wrapper, |
36 const MakeGLContextCurrentCallback& make_context_current_cb, | 37 const base::Callback<bool(void)> make_context_current, |
37 int32_t picture_buffer_id, | 38 int32_t picture_buffer_id, |
38 uint32_t texture_id, | 39 uint32_t texture_id, |
39 const gfx::Size& size); | 40 const gfx::Size& size); |
40 | 41 |
41 ~VaapiTFPPicture() override; | 42 ~VaapiTFPPicture() override; |
42 | 43 |
43 bool Initialize() override; | 44 bool Initialize() override; |
44 | 45 |
45 bool DownloadFromSurface(const scoped_refptr<VASurface>& va_surface) override; | 46 bool DownloadFromSurface(const scoped_refptr<VASurface>& va_surface) override; |
46 | 47 |
47 scoped_refptr<gl::GLImage> GetImageToBind() override; | 48 scoped_refptr<gl::GLImage> GetImageToBind() override; |
48 | 49 |
49 private: | 50 private: |
50 scoped_refptr<VaapiWrapper> vaapi_wrapper_; | 51 scoped_refptr<VaapiWrapper> vaapi_wrapper_; |
51 | 52 |
52 MakeGLContextCurrentCallback make_context_current_cb_; | 53 base::Callback<bool(void)> make_context_current_; |
53 Display* x_display_; | 54 Display* x_display_; |
54 | 55 |
55 Pixmap x_pixmap_; | 56 Pixmap x_pixmap_; |
56 scoped_refptr<gl::GLImageGLX> glx_image_; | 57 scoped_refptr<gl::GLImageGLX> glx_image_; |
57 | 58 |
58 DISALLOW_COPY_AND_ASSIGN(VaapiTFPPicture); | 59 DISALLOW_COPY_AND_ASSIGN(VaapiTFPPicture); |
59 }; | 60 }; |
60 | 61 |
61 } // namespace content | 62 } // namespace content |
62 | 63 |
63 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_TFP_PICTURE_H_ | 64 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_TFP_PICTURE_H_ |
OLD | NEW |