| OLD | NEW |
| 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 CONTENT_COMMON_GPU_MEDIA_VA_SURFACE_H_ |
| 9 #define CONTENT_COMMON_GPU_MEDIA_VA_SURFACE_H_ | 9 #define CONTENT_COMMON_GPU_MEDIA_VA_SURFACE_H_ |
| 10 | 10 |
| 11 #include "third_party/libva/va/va.h" | 11 #include "third_party/libva/va/va.h" |
| 12 #include "ui/gfx/size.h" |
| 12 | 13 |
| 13 namespace content { | 14 namespace content { |
| 14 | 15 |
| 15 // A VA-API-specific decode surface used by VaapiH264Decoder to decode into | 16 // A VA-API-specific decode surface used by VaapiH264Decoder to decode into |
| 16 // and use as reference for decoding other surfaces. It is also handed by the | 17 // and use as reference for decoding other surfaces. It is also handed by the |
| 17 // decoder to VaapiVideoDecodeAccelerator when the contents of the surface are | 18 // decoder to VaapiVideoDecodeAccelerator when the contents of the surface are |
| 18 // ready and should be displayed. VAVDA converts the surface contents into an | 19 // ready and should be displayed. VAVDA converts the surface contents into an |
| 19 // X Pixmap bound to a texture for display and releases its reference to it. | 20 // X Pixmap bound to a texture for display and releases its reference to it. |
| 20 // Decoder releases its references to the surface when it's done decoding and | 21 // Decoder releases its references to the surface when it's done decoding and |
| 21 // using it as reference. Note that a surface may still be used for reference | 22 // using it as reference. Note that a surface may still be used for reference |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // | | 78 // | |
| 78 // v | 79 // v |
| 79 // VaapiWrapper frees VASurfaceID. | 80 // VaapiWrapper frees VASurfaceID. |
| 80 // | 81 // |
| 81 class CONTENT_EXPORT VASurface : public base::RefCountedThreadSafe<VASurface> { | 82 class CONTENT_EXPORT VASurface : public base::RefCountedThreadSafe<VASurface> { |
| 82 public: | 83 public: |
| 83 // Provided by user, will be called when all references to the surface | 84 // Provided by user, will be called when all references to the surface |
| 84 // are released. | 85 // are released. |
| 85 typedef base::Callback<void(VASurfaceID)> ReleaseCB; | 86 typedef base::Callback<void(VASurfaceID)> ReleaseCB; |
| 86 | 87 |
| 87 VASurface(VASurfaceID va_surface_id, const ReleaseCB& release_cb); | 88 VASurface(VASurfaceID va_surface_id, |
| 89 const gfx::Size& size, |
| 90 const ReleaseCB& release_cb); |
| 88 | 91 |
| 89 VASurfaceID id() { | 92 VASurfaceID id() { |
| 90 return va_surface_id_; | 93 return va_surface_id_; |
| 91 } | 94 } |
| 92 | 95 |
| 96 const gfx::Size& size() const { return size_; } |
| 97 |
| 93 private: | 98 private: |
| 94 friend class base::RefCountedThreadSafe<VASurface>; | 99 friend class base::RefCountedThreadSafe<VASurface>; |
| 95 ~VASurface(); | 100 ~VASurface(); |
| 96 | 101 |
| 97 const VASurfaceID va_surface_id_; | 102 const VASurfaceID va_surface_id_; |
| 103 gfx::Size size_; |
| 98 ReleaseCB release_cb_; | 104 ReleaseCB release_cb_; |
| 99 | 105 |
| 100 DISALLOW_COPY_AND_ASSIGN(VASurface); | 106 DISALLOW_COPY_AND_ASSIGN(VASurface); |
| 101 }; | 107 }; |
| 102 | 108 |
| 103 } // namespace content | 109 } // namespace content |
| 104 | 110 |
| 105 #endif // CONTENT_COMMON_GPU_MEDIA_VA_SURFACE_H_ | 111 #endif // CONTENT_COMMON_GPU_MEDIA_VA_SURFACE_H_ |
| OLD | NEW |