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 // VaapiPictureProvider is in charge of allocating pictures for the | |
25 // window system and binding them to gl textures. | |
26 class VaapiPictureProvider : public base::NonThreadSafe { | |
27 public: | |
28 // Picture is native pixmap abstraction (X11/Ozone) | |
29 class Picture : public base::NonThreadSafe { | |
30 public: | |
31 virtual ~Picture() {} | |
32 | |
33 int32 picture_buffer_id() const { | |
34 return picture_buffer_id_; | |
35 }; | |
Pawel Osciak
2014/10/08 08:17:22
Spurious ;
llandwerlin-old
2014/10/08 09:31:18
Acknowledged.
| |
36 uint32 texture_id() const { return texture_id_; } | |
37 const gfx::Size& size() const { return size_; } | |
38 | |
39 virtual bool PutSurface(VASurfaceID va_surface_id) = 0; | |
Pawel Osciak
2014/10/08 08:17:22
"Put" may suggest releasing the surface/resources.
llandwerlin-old
2014/10/08 09:31:17
Acknowledged.
| |
40 | |
41 protected: | |
42 Picture(int32 picture_buffer_id, uint32 texture_id, const gfx::Size& size) | |
43 : picture_buffer_id_(picture_buffer_id), | |
44 texture_id_(texture_id), | |
45 size_(size) {} | |
46 | |
47 private: | |
48 int32 picture_buffer_id_; | |
49 uint32 texture_id_; | |
50 gfx::Size size_; | |
51 }; | |
52 | |
53 // Create a platform specific picture provider for the given | |
54 // |va_display|. |gl_context| and |make_context_current| will be | |
55 // used to bind/unbind picture to gl textures. | |
56 static scoped_ptr<VaapiPictureProvider> Create( | |
57 VADisplay va_display, | |
58 gfx::GLContext* gl_context, | |
59 const base::Callback<bool(void)> make_context_current); | |
60 | |
61 // Create an RGBA picture of |size| and associate it to the given | |
62 // gl |texture_id| and |picture_buffer_id|. | |
63 virtual scoped_ptr<Picture> CreatePicture(int32 picture_buffer_id, | |
64 uint32 texture_id, | |
65 const gfx::Size& size) = 0; | |
66 | |
67 // Notify the picture provider of the picture |size| change. | |
Pawel Osciak
2014/10/08 08:17:22
Please document return value and what happens, it'
llandwerlin-old
2014/10/08 09:31:18
This will disappear (as per one of your other comm
| |
68 virtual bool SetCodedSurfacesSize(const gfx::Size& size) = 0; | |
69 | |
70 virtual ~VaapiPictureProvider(); | |
71 | |
72 private: | |
73 // Initialize the picture provider. | |
74 virtual bool Initialize() = 0; | |
75 }; | |
Pawel Osciak
2014/10/08 08:17:22
Please DISALLOW_COPY_AND_ASSIGN here and in Pictur
llandwerlin-old
2014/10/08 09:31:18
Acknowledged.
| |
76 | |
77 } // namespace content | |
78 | |
79 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_PROVIDER_H_ | |
OLD | NEW |