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 an implementation of VaapiWrapper, used by | 5 // This file contains an implementation of VaapiWrapper, used by |
6 // VaapiVideoDecodeAccelerator and VaapiH264Decoder for decode, | 6 // VaapiVideoDecodeAccelerator and VaapiH264Decoder for decode, |
7 // and VaapiVideoEncodeAccelerator for encode, to interface | 7 // and VaapiVideoEncodeAccelerator for encode, to interface |
8 // with libva (VA-API library for hardware video codec). | 8 // with libva (VA-API library for hardware video codec). |
9 | 9 |
10 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ | 10 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ |
(...skipping 26 matching lines...) Expand all Loading... | |
37 // as well as underlying memory for VASurfaces themselves. | 37 // as well as underlying memory for VASurfaces themselves. |
38 class CONTENT_EXPORT VaapiWrapper { | 38 class CONTENT_EXPORT VaapiWrapper { |
39 public: | 39 public: |
40 enum CodecMode { | 40 enum CodecMode { |
41 kDecode, | 41 kDecode, |
42 kEncode, | 42 kEncode, |
43 }; | 43 }; |
44 | 44 |
45 // |report_error_to_uma_cb| will be called independently from reporting | 45 // |report_error_to_uma_cb| will be called independently from reporting |
46 // errors to clients via method return values. | 46 // errors to clients via method return values. |
47 static scoped_ptr<VaapiWrapper> Create( | 47 static scoped_ptr<VaapiWrapper> Create( |
wuchengli
2015/01/12 09:08:53
Can we add another Create for JPEG so we don't nee
| |
48 CodecMode mode, | 48 CodecMode mode, |
49 media::VideoCodecProfile profile, | 49 media::VideoCodecProfile profile, |
50 Display* x_display, | 50 Display* x_display, |
51 const base::Closure& report_error_to_uma_cb); | 51 const base::Closure& report_error_to_uma_cb); |
52 | 52 |
53 // Return the supported encode profiles. | 53 // Return the supported encode profiles. |
54 static std::vector<media::VideoCodecProfile> GetSupportedEncodeProfiles( | 54 static std::vector<media::VideoCodecProfile> GetSupportedEncodeProfiles( |
55 Display* x_display, | 55 Display* x_display, |
56 const base::Closure& report_error_to_uma_cb); | 56 const base::Closure& report_error_to_uma_cb); |
57 | 57 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 | 105 |
106 // Returns true if the VAAPI version is less than the specified version. | 106 // Returns true if the VAAPI version is less than the specified version. |
107 bool VAAPIVersionLessThan(int major, int minor); | 107 bool VAAPIVersionLessThan(int major, int minor); |
108 | 108 |
109 // Get a VAImage from a VASurface and map it into memory. The VAImage should | 109 // Get a VAImage from a VASurface and map it into memory. The VAImage should |
110 // be released using the ReturnVaImage function. Returns true when successful. | 110 // be released using the ReturnVaImage function. Returns true when successful. |
111 // This is intended for testing only. | 111 // This is intended for testing only. |
112 bool GetVaImageForTesting(VASurfaceID va_surface_id, | 112 bool GetVaImageForTesting(VASurfaceID va_surface_id, |
113 VAImage* image, | 113 VAImage* image, |
114 void** mem); | 114 void** mem); |
115 | 115 |
wuchengli
2015/01/12 09:08:53
Add documentation.
kcwu
2015/01/16 15:12:56
Done.
| |
116 bool GetVaImageWithFormat(VASurfaceID va_surface_id, | |
117 VAImageFormat* format, | |
118 gfx::Size size, | |
Owen Lin
2015/01/13 06:17:59
const gfx::Size&
kcwu
2015/01/16 15:12:56
Done.
| |
119 VAImage* image, | |
120 void** mem); | |
121 | |
116 // Release the VAImage (and the associated memory mapping) obtained from | 122 // Release the VAImage (and the associated memory mapping) obtained from |
117 // GetVaImage(). This is intended for testing only. | 123 // GetVaImage(). This is intended for testing only. |
118 void ReturnVaImageForTesting(VAImage* image); | 124 void ReturnVaImageForTesting(VAImage* image); |
119 | 125 |
120 // Upload contents of |frame| into |va_surface_id| for encode. | 126 // Upload contents of |frame| into |va_surface_id| for encode. |
121 bool UploadVideoFrameToSurface(const scoped_refptr<media::VideoFrame>& frame, | 127 bool UploadVideoFrameToSurface(const scoped_refptr<media::VideoFrame>& frame, |
122 VASurfaceID va_surface_id); | 128 VASurfaceID va_surface_id); |
123 | 129 |
124 // Create a buffer of |size| bytes to be used as encode output. | 130 // Create a buffer of |size| bytes to be used as encode output. |
125 bool CreateCodedBuffer(size_t size, VABufferID* buffer_id); | 131 bool CreateCodedBuffer(size_t size, VABufferID* buffer_id); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 // Called to report codec errors to UMA. Errors to clients are reported via | 202 // Called to report codec errors to UMA. Errors to clients are reported via |
197 // return values from public methods. | 203 // return values from public methods. |
198 base::Closure report_error_to_uma_cb_; | 204 base::Closure report_error_to_uma_cb_; |
199 | 205 |
200 DISALLOW_COPY_AND_ASSIGN(VaapiWrapper); | 206 DISALLOW_COPY_AND_ASSIGN(VaapiWrapper); |
201 }; | 207 }; |
202 | 208 |
203 } // namespace content | 209 } // namespace content |
204 | 210 |
205 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ | 211 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ |
OLD | NEW |