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

Side by Side Diff: media/gpu/va_surface.h

Issue 1882373004: Migrate content/common/gpu/media code to media/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix several more bot-identified build issues Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 the definition of VASurface class, used for decoding by 5 // This file contains the definition of VASurface class, used for decoding by
6 // VaapiVideoDecodeAccelerator and VaapiH264Decoder. 6 // VaapiVideoDecodeAccelerator and VaapiH264Decoder.
7 7
8 #ifndef CONTENT_COMMON_GPU_MEDIA_VA_SURFACE_H_ 8 #ifndef MEDIA_GPU_VA_SURFACE_H_
9 #define CONTENT_COMMON_GPU_MEDIA_VA_SURFACE_H_ 9 #define MEDIA_GPU_VA_SURFACE_H_
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "content/common/content_export.h" 14 #include "media/gpu/media_gpu_export.h"
15 #include "third_party/libva/va/va.h" 15 #include "third_party/libva/va/va.h"
16 #include "ui/gfx/geometry/size.h" 16 #include "ui/gfx/geometry/size.h"
17 17
18 namespace content { 18 namespace media {
19 19
20 // A VA-API-specific decode surface used by VaapiH264Decoder to decode into 20 // A VA-API-specific decode surface used by VaapiH264Decoder to decode into
21 // and use as reference for decoding other surfaces. It is also handed by the 21 // and use as reference for decoding other surfaces. It is also handed by the
22 // decoder to VaapiVideoDecodeAccelerator when the contents of the surface are 22 // decoder to VaapiVideoDecodeAccelerator when the contents of the surface are
23 // ready and should be displayed. VAVDA converts the surface contents into an 23 // ready and should be displayed. VAVDA converts the surface contents into an
24 // X/Drm Pixmap bound to a texture for display and releases its reference to it. 24 // X/Drm Pixmap bound to a texture for display and releases its reference to it.
25 // Decoder releases its references to the surface when it's done decoding and 25 // Decoder releases its references to the surface when it's done decoding and
26 // using it as reference. Note that a surface may still be used for reference 26 // using it as reference. Note that a surface may still be used for reference
27 // after it's been sent to output and also after it is no longer used by VAVDA. 27 // after it's been sent to output and also after it is no longer used by VAVDA.
28 // Thus, the surface can be in use by both VAVDA and the Decoder at the same 28 // Thus, the surface can be in use by both VAVDA and the Decoder at the same
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // | v 76 // | v
77 // | Neither VVDA nor VHD hold a reference to VASurface. VASurface is released, 77 // | Neither VVDA nor VHD hold a reference to VASurface. VASurface is released,
78 // | ReleaseCB gets called in its destructor, which puts the associated 78 // | ReleaseCB gets called in its destructor, which puts the associated
79 // | VASurfaceID back onto VVDA::available_va_surfaces_. 79 // | VASurfaceID back onto VVDA::available_va_surfaces_.
80 // | | 80 // | |
81 // '-------------------------------------| 81 // '-------------------------------------|
82 // | 82 // |
83 // v 83 // v
84 // VaapiWrapper frees VASurfaceID. 84 // VaapiWrapper frees VASurfaceID.
85 // 85 //
86 class CONTENT_EXPORT VASurface : public base::RefCountedThreadSafe<VASurface> { 86 class MEDIA_GPU_EXPORT VASurface
87 : public base::RefCountedThreadSafe<VASurface> {
87 public: 88 public:
88 // Provided by user, will be called when all references to the surface 89 // Provided by user, will be called when all references to the surface
89 // are released. 90 // are released.
90 typedef base::Callback<void(VASurfaceID)> ReleaseCB; 91 typedef base::Callback<void(VASurfaceID)> ReleaseCB;
91 92
92 VASurface(VASurfaceID va_surface_id, 93 VASurface(VASurfaceID va_surface_id,
93 const gfx::Size& size, 94 const gfx::Size& size,
94 unsigned int format, 95 unsigned int format,
95 const ReleaseCB& release_cb); 96 const ReleaseCB& release_cb);
96 97
97 VASurfaceID id() { 98 VASurfaceID id() { return va_surface_id_; }
98 return va_surface_id_;
99 }
100 99
101 const gfx::Size& size() const { return size_; } 100 const gfx::Size& size() const { return size_; }
102 unsigned int format() const { return format_; } 101 unsigned int format() const { return format_; }
103 102
104 private: 103 private:
105 friend class base::RefCountedThreadSafe<VASurface>; 104 friend class base::RefCountedThreadSafe<VASurface>;
106 ~VASurface(); 105 ~VASurface();
107 106
108 const VASurfaceID va_surface_id_; 107 const VASurfaceID va_surface_id_;
109 gfx::Size size_; 108 gfx::Size size_;
110 unsigned int format_; 109 unsigned int format_;
111 ReleaseCB release_cb_; 110 ReleaseCB release_cb_;
112 111
113 DISALLOW_COPY_AND_ASSIGN(VASurface); 112 DISALLOW_COPY_AND_ASSIGN(VASurface);
114 }; 113 };
115 114
116 } // namespace content 115 } // namespace media
117 116
118 #endif // CONTENT_COMMON_GPU_MEDIA_VA_SURFACE_H_ 117 #endif // MEDIA_GPU_VA_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698