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