Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: content/common/gpu/media/vaapi_picture.h

Issue 858653002: vaapi plumbing to allow hardware video overlays (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cc plumbing going in first, so put the link back in Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 interface of output pictures for the Vaapi 5 // This file contains an interface of output pictures for the Vaapi
6 // video decoder. This is implemented by different window system 6 // video decoder. This is implemented by different window system
7 // (X11/Ozone) and used by VaapiVideoDecodeAccelerator to produce 7 // (X11/Ozone) and used by VaapiVideoDecodeAccelerator to produce
8 // output pictures. 8 // output pictures.
9 9
10 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_ 10 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_
11 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_ 11 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/threading/non_thread_safe.h" 16 #include "base/threading/non_thread_safe.h"
17 #include "ui/gfx/geometry/size.h" 17 #include "ui/gfx/geometry/size.h"
18 18
19 namespace gfx {
20 class GLImage;
21 }
22
19 namespace content { 23 namespace content {
20 24
21 class VASurface; 25 class VASurface;
22 class VaapiWrapper; 26 class VaapiWrapper;
23 27
24 // Picture is native pixmap abstraction (X11/Ozone). 28 // Picture is native pixmap abstraction (X11/Ozone).
25 class VaapiPicture : public base::NonThreadSafe { 29 class VaapiPicture : public base::NonThreadSafe {
26 public: 30 public:
27 virtual ~VaapiPicture() {} 31 virtual ~VaapiPicture() {}
28 32
29 // Try to allocate the underlying resources for the picture. 33 // Try to allocate the underlying resources for the picture.
30 virtual bool Initialize() = 0; 34 virtual bool Initialize() = 0;
31 35
32 int32 picture_buffer_id() const { return picture_buffer_id_; } 36 int32 picture_buffer_id() const { return picture_buffer_id_; }
33 uint32 texture_id() const { return texture_id_; } 37 uint32 texture_id() const { return texture_id_; }
34 const gfx::Size& size() const { return size_; } 38 const gfx::Size& size() const { return size_; }
39 bool allow_overlay() const { return allow_overlay_; }
40
41 // Returns the |GLImage|, if any, to bind to the texture.
42 virtual scoped_refptr<gfx::GLImage> GetImageToBind() = 0;
35 43
36 // Downloads the |va_surface| into the picture, potentially scaling 44 // Downloads the |va_surface| into the picture, potentially scaling
37 // it if needed. 45 // it if needed.
38 virtual bool DownloadFromSurface( 46 virtual bool DownloadFromSurface(
39 const scoped_refptr<VASurface>& va_surface) = 0; 47 const scoped_refptr<VASurface>& va_surface) = 0;
40 48
41 // Create a VaapiPicture of |size| to be associated with 49 // Create a VaapiPicture of |size| to be associated with
42 // |picture_buffer_id| and bound to |texture_id|. 50 // |picture_buffer_id| and bound to |texture_id|.
43 // |make_context_current| is provided for the GL operations. 51 // |make_context_current| is provided for the GL operations.
44 static linked_ptr<VaapiPicture> CreatePicture( 52 static linked_ptr<VaapiPicture> CreatePicture(
45 VaapiWrapper* vaapi_wrapper, 53 VaapiWrapper* vaapi_wrapper,
46 const base::Callback<bool(void)> make_context_current, 54 const base::Callback<bool(void)> make_context_current,
47 int32 picture_buffer_id, 55 int32 picture_buffer_id,
48 uint32 texture_id, 56 uint32 texture_id,
49 const gfx::Size& size); 57 const gfx::Size& size);
50 58
51 // Get the texture target used to bind EGLImages (either 59 // Get the texture target used to bind EGLImages (either
52 // GL_TEXTURE_2D on X11 or GL_TEXTURE_EXTERNAL_OES on DRM). 60 // GL_TEXTURE_2D on X11 or GL_TEXTURE_EXTERNAL_OES on DRM).
53 static uint32 GetGLTextureTarget(); 61 static uint32 GetGLTextureTarget();
54 62
55 protected: 63 protected:
56 VaapiPicture(int32 picture_buffer_id, 64 VaapiPicture(int32 picture_buffer_id,
57 uint32 texture_id, 65 uint32 texture_id,
58 const gfx::Size& size) 66 const gfx::Size& size,
67 bool allow_overlay)
Pawel Osciak 2015/01/24 00:58:54 Could we please get rid of this in favor of a virt
achaulk 2015/01/27 18:36:48 Done.
59 : picture_buffer_id_(picture_buffer_id), 68 : picture_buffer_id_(picture_buffer_id),
60 texture_id_(texture_id), 69 texture_id_(texture_id),
61 size_(size) {} 70 size_(size),
71 allow_overlay_(allow_overlay) {}
62 72
63 private: 73 private:
64 int32 picture_buffer_id_; 74 int32 picture_buffer_id_;
65 uint32 texture_id_; 75 uint32 texture_id_;
66 gfx::Size size_; 76 gfx::Size size_;
77 bool allow_overlay_;
67 78
68 DISALLOW_COPY_AND_ASSIGN(VaapiPicture); 79 DISALLOW_COPY_AND_ASSIGN(VaapiPicture);
69 }; 80 };
70 81
71 } // namespace content 82 } // namespace content
72 83
73 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_ 84 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698