OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 // | |
5 // This file contains an implementation of picture allocation for | |
6 // different window system (X11/Ozone) used by | |
7 // VaapiVideoDecodeAccelerator to produce output pictures. | |
8 | |
9 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_PROVIDER_H_ | |
10 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_PROVIDER_H_ | |
11 | |
12 #include "base/callback.h" | |
13 #include "base/memory/linked_ptr.h" | |
14 #include "base/threading/non_thread_safe.h" | |
15 #include "third_party/libva/va/va.h" | |
16 #include "ui/gfx/size.h" | |
17 | |
18 namespace gfx { | |
19 class GLContext; | |
20 } // namespace gfx | |
21 | |
22 namespace content { | |
23 | |
24 class VaapiWrapper; | |
25 | |
26 // VaapiPictureProvider is in charge of allocating pictures for the | |
27 // window system and binding them to gl textures. | |
28 class VaapiPictureProvider : public base::NonThreadSafe { | |
29 public: | |
30 // Picture is native pixmap abstraction (X11/Ozone) | |
31 class Picture : public base::NonThreadSafe { | |
32 public: | |
33 virtual ~Picture() {} | |
34 | |
35 int32 picture_buffer_id() const { return picture_buffer_id_; } | |
36 uint32 texture_id() const { return texture_id_; } | |
37 const gfx::Size& size() const { return size_; } | |
38 | |
39 virtual bool DownloadFromSurface(VASurfaceID va_surface_id, | |
40 const gfx::Size& surface_size) = 0; | |
41 | |
42 protected: | |
43 Picture(int32 picture_buffer_id, uint32 texture_id, const gfx::Size& size) | |
44 : picture_buffer_id_(picture_buffer_id), | |
45 texture_id_(texture_id), | |
46 size_(size) {} | |
47 | |
48 private: | |
49 int32 picture_buffer_id_; | |
50 uint32 texture_id_; | |
51 gfx::Size size_; | |
52 | |
53 DISALLOW_COPY_AND_ASSIGN(Picture); | |
54 }; | |
55 | |
56 virtual ~VaapiPictureProvider(); | |
57 | |
58 // Create an RGBA picture of |size| and associate it to the given | |
59 // gl |texture_id| and |picture_buffer_id|. | |
60 virtual linked_ptr<Picture> CreatePicture(int32 picture_buffer_id, | |
61 uint32 texture_id, | |
62 const gfx::Size& size) = 0; | |
63 | |
64 // Create a platform specific picture provider for the given | |
65 // |va_display|. |gl_context| and |make_context_current| will be | |
Pawel Osciak
2014/10/26 13:06:46
Stale comment.
llandwerlin-old
2014/10/29 13:52:48
Acknowledged.
| |
66 // used to bind/unbind picture to gl textures. | |
67 static scoped_ptr<VaapiPictureProvider> Create( | |
68 scoped_refptr<VaapiWrapper> vaapi_wrapper, | |
69 gfx::GLContext* gl_context, | |
70 const base::Callback<bool(void)> make_context_current); | |
71 | |
72 protected: | |
73 VaapiPictureProvider(); | |
74 | |
75 private: | |
76 // Initialize the picture provider. | |
77 virtual bool Initialize() = 0; | |
78 | |
79 DISALLOW_COPY_AND_ASSIGN(VaapiPictureProvider); | |
80 }; | |
81 | |
82 } // namespace content | |
83 | |
84 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_PROVIDER_H_ | |
OLD | NEW |