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

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: make buildable before cc plumbing is 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 gpu {
20 namespace gles2 {
21 class TextureManager;
22 class TextureRef;
23 }
24 }
25
19 namespace content { 26 namespace content {
20 27
21 class VASurface; 28 class VASurface;
22 class VaapiWrapper; 29 class VaapiWrapper;
23 30
24 // Picture is native pixmap abstraction (X11/Ozone). 31 // Picture is native pixmap abstraction (X11/Ozone).
25 class VaapiPicture : public base::NonThreadSafe { 32 class VaapiPicture : public base::NonThreadSafe {
26 public: 33 public:
27 virtual ~VaapiPicture() {} 34 virtual ~VaapiPicture() {}
28 35
29 // Try to allocate the underlying resources for the picture. 36 // Try to allocate the underlying resources for the picture.
30 virtual bool Initialize() = 0; 37 virtual bool Initialize(gpu::gles2::TextureManager* texture_manager,
Pawel Osciak 2015/01/21 13:07:08 Please add documentation for changed methods in th
38 gpu::gles2::TextureRef* texture_ref) = 0;
31 39
32 int32 picture_buffer_id() const { return picture_buffer_id_; } 40 int32 picture_buffer_id() const { return picture_buffer_id_; }
33 uint32 texture_id() const { return texture_id_; } 41 uint32 texture_id() const { return texture_id_; }
34 const gfx::Size& size() const { return size_; } 42 const gfx::Size& size() const { return size_; }
43 bool allow_overlay() const { return allow_overlay_; }
Pawel Osciak 2015/01/21 13:07:08 Could this instead be a virtual method returning f
achaulk 2015/01/21 17:10:03 It could be, sure
35 44
36 // Downloads the |va_surface| into the picture, potentially scaling 45 // Downloads the |va_surface| into the picture, potentially scaling
37 // it if needed. 46 // it if needed.
38 virtual bool DownloadFromSurface( 47 virtual bool DownloadFromSurface(
39 const scoped_refptr<VASurface>& va_surface) = 0; 48 const scoped_refptr<VASurface>& va_surface) = 0;
40 49
41 // Create a VaapiPicture of |size| to be associated with 50 // Create a VaapiPicture of |size| to be associated with
42 // |picture_buffer_id| and bound to |texture_id|. 51 // |picture_buffer_id| and bound to |texture_id|.
43 // |make_context_current| is provided for the GL operations. 52 // |make_context_current| is provided for the GL operations.
44 static linked_ptr<VaapiPicture> CreatePicture( 53 static linked_ptr<VaapiPicture> CreatePicture(
45 VaapiWrapper* vaapi_wrapper, 54 VaapiWrapper* vaapi_wrapper,
55 gpu::gles2::TextureManager* texture_manager,
56 gpu::gles2::TextureRef* texture_ref,
piman 2015/01/21 23:58:22 You may want to document that the texture_ref can'
46 const base::Callback<bool(void)> make_context_current, 57 const base::Callback<bool(void)> make_context_current,
47 int32 picture_buffer_id, 58 int32 picture_buffer_id,
48 uint32 texture_id, 59 uint32 texture_id,
49 const gfx::Size& size); 60 const gfx::Size& size);
50 61
51 // Get the texture target used to bind EGLImages (either 62 // Get the texture target used to bind EGLImages (either
52 // GL_TEXTURE_2D on X11 or GL_TEXTURE_EXTERNAL_OES on DRM). 63 // GL_TEXTURE_2D on X11 or GL_TEXTURE_EXTERNAL_OES on DRM).
53 static uint32 GetGLTextureTarget(); 64 static uint32 GetGLTextureTarget();
54 65
55 protected: 66 protected:
56 VaapiPicture(int32 picture_buffer_id, 67 VaapiPicture(int32 picture_buffer_id,
57 uint32 texture_id, 68 uint32 texture_id,
58 const gfx::Size& size) 69 const gfx::Size& size,
70 bool allow_overlay)
59 : picture_buffer_id_(picture_buffer_id), 71 : picture_buffer_id_(picture_buffer_id),
60 texture_id_(texture_id), 72 texture_id_(texture_id),
61 size_(size) {} 73 size_(size),
74 allow_overlay_(allow_overlay) {}
62 75
63 private: 76 private:
64 int32 picture_buffer_id_; 77 int32 picture_buffer_id_;
65 uint32 texture_id_; 78 uint32 texture_id_;
66 gfx::Size size_; 79 gfx::Size size_;
80 bool allow_overlay_;
67 81
68 DISALLOW_COPY_AND_ASSIGN(VaapiPicture); 82 DISALLOW_COPY_AND_ASSIGN(VaapiPicture);
69 }; 83 };
70 84
71 } // namespace content 85 } // namespace content
72 86
73 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_ 87 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_PICTURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698