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

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: address review comments Created 7 years, 2 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 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // Execute decode in hardware into |va_surface_id} and destroy pending 72 // Execute decode in hardware into |va_surface_id} and destroy pending
72 // buffers. Return false if SubmitDecode() fails. 73 // buffers. Return false if SubmitDecode() fails.
73 bool DecodeAndDestroyPendingBuffers(VASurfaceID va_surface_id); 74 bool DecodeAndDestroyPendingBuffers(VASurfaceID va_surface_id);
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
82 // Get the surface data and return it as a VideoFrame. The VideoFrame
83 // contains I420 formatted data. Currently it only handles VASurface with
84 // NV12 format.
85 scoped_refptr<media::VideoFrame> GetI420FromSurface(
Pawel Osciak 2013/11/21 06:31:41 Rename to VideoFrameFromVASurface or something lik
chihchung 2013/11/21 12:17:32 Done.
86 VASurfaceID va_surface_id);
87
81 // Do any necessary initialization before the sandbox is enabled. 88 // Do any necessary initialization before the sandbox is enabled.
82 static void PreSandboxInitialization(); 89 static void PreSandboxInitialization();
83 90
84 private: 91 private:
85 VaapiWrapper(); 92 VaapiWrapper();
86 93
87 bool Initialize(media::VideoCodecProfile profile, 94 bool Initialize(media::VideoCodecProfile profile,
88 Display* x_display, 95 Display* x_display,
89 const base::Closure& report_error__to_uma_cb); 96 const base::Closure& report_error__to_uma_cb);
90 void Deinitialize(); 97 void Deinitialize();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 131
125 // Has static initialization of pre-sandbox components completed successfully? 132 // Has static initialization of pre-sandbox components completed successfully?
126 static bool pre_sandbox_init_done_; 133 static bool pre_sandbox_init_done_;
127 134
128 DISALLOW_COPY_AND_ASSIGN(VaapiWrapper); 135 DISALLOW_COPY_AND_ASSIGN(VaapiWrapper);
129 }; 136 };
130 137
131 } // namespace content 138 } // namespace content
132 139
133 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ 140 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698