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

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

Issue 27498002: Add vaapi_h264_decoder_test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split into GetVaImage/ReturnVaImage Created 7 years 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 an implementation of VaapiWrapper, used by 5 // This file contains an implementation of VaapiWrapper, used by
6 // VaapiVideoDecodeAccelerator and VaapiH264Decoder to interface 6 // VaapiVideoDecodeAccelerator and VaapiH264Decoder to interface
7 // with libva (VA-API library for hardware video decode). 7 // with libva (VA-API library for hardware video decode).
8 8
9 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ 9 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_
10 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ 10 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "content/common/gpu/media/va_surface.h" 16 #include "content/common/gpu/media/va_surface.h"
17 #include "media/base/video_decoder_config.h" 17 #include "media/base/video_decoder_config.h"
18 #include "media/base/video_frame.h"
18 #include "third_party/libva/va/va.h" 19 #include "third_party/libva/va/va.h"
19 #include "third_party/libva/va/va_x11.h" 20 #include "third_party/libva/va/va_x11.h"
20 #include "ui/gfx/size.h" 21 #include "ui/gfx/size.h"
21 22
22 namespace content { 23 namespace content {
23 24
24 // This class handles VA-API calls and ensures proper locking of VA-API calls 25 // This class handles VA-API calls and ensures proper locking of VA-API calls
25 // to libva, the userspace shim to the HW decoder driver. libva is not 26 // to libva, the userspace shim to the HW decoder driver. libva is not
26 // thread-safe, so we have to perform locking ourselves. This class is fully 27 // thread-safe, so we have to perform locking ourselves. This class is fully
27 // synchronous and its methods can be called from any thread and may wait on 28 // synchronous and its methods can be called from any thread and may wait on
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 75
75 // Put data from |va_surface_id| into |x_pixmap| of size |size|, 76 // Put data from |va_surface_id| into |x_pixmap| of size |size|,
76 // converting/scaling to it. 77 // converting/scaling to it.
77 bool PutSurfaceIntoPixmap(VASurfaceID va_surface_id, 78 bool PutSurfaceIntoPixmap(VASurfaceID va_surface_id,
78 Pixmap x_pixmap, 79 Pixmap x_pixmap,
79 gfx::Size dest_size); 80 gfx::Size dest_size);
80 81
81 // Returns true if the VAAPI version is less than the specified version. 82 // Returns true if the VAAPI version is less than the specified version.
82 bool VAAPIVersionLessThan(int major, int minor); 83 bool VAAPIVersionLessThan(int major, int minor);
83 84
85 // Get a VAImage from a VASurface and map it into memory. The VAImage should
Ami GONE FROM CHROMIUM 2013/12/03 21:17:16 If these APIs are only used for testing they shoul
chihchung 2013/12/04 05:38:10 Done.
86 // be released using the ReturnVaImage function. Returns true when successful.
87 bool GetVaImage(VASurfaceID va_surface_id, VAImage* image, void** mem);
88
89 // Release the VAImage (and the associated memory mapping) obtained from
90 // GetVaImage().
91 void ReturnVaImage(VAImage* image);
92
84 private: 93 private:
85 VaapiWrapper(); 94 VaapiWrapper();
86 95
87 bool Initialize(media::VideoCodecProfile profile, 96 bool Initialize(media::VideoCodecProfile profile,
88 Display* x_display, 97 Display* x_display,
89 const base::Closure& report_error__to_uma_cb); 98 const base::Closure& report_error__to_uma_cb);
90 void Deinitialize(); 99 void Deinitialize();
91 100
92 // Execute decode in hardware and destroy pending buffers. Return false if 101 // Execute decode in hardware and destroy pending buffers. Return false if
93 // vaapi driver refuses to accept parameter or slice buffers submitted 102 // vaapi driver refuses to accept parameter or slice buffers submitted
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 136
128 // Has static initialization of pre-sandbox components completed successfully? 137 // Has static initialization of pre-sandbox components completed successfully?
129 static bool pre_sandbox_init_done_; 138 static bool pre_sandbox_init_done_;
130 139
131 DISALLOW_COPY_AND_ASSIGN(VaapiWrapper); 140 DISALLOW_COPY_AND_ASSIGN(VaapiWrapper);
132 }; 141 };
133 142
134 } // namespace content 143 } // namespace content
135 144
136 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ 145 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698