OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 VideoDecoderAccelerator | 5 // This file contains an implementation of VideoDecoderAccelerator |
6 // that utilizes hardware video decoder present on Intel CPUs. | 6 // that utilizes hardware video decoder present on Intel CPUs. |
7 | 7 |
8 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 8 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_DRM_H_ |
9 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 9 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_DRM_H_ |
10 | 10 |
11 #include <list> | |
scherkus (not reviewing)
2014/07/29 17:48:54
might have missed this ... but what changed to req
vignatti (out of this project)
2014/07/30 21:51:30
if I don't add this in here it complains about lin
| |
11 #include <map> | 12 #include <map> |
12 #include <queue> | 13 #include <queue> |
13 #include <utility> | 14 #include <utility> |
14 #include <vector> | 15 #include <vector> |
15 | 16 |
16 #include "base/logging.h" | 17 #include "base/logging.h" |
17 #include "base/memory/linked_ptr.h" | 18 #include "base/memory/linked_ptr.h" |
18 #include "base/memory/shared_memory.h" | 19 #include "base/memory/shared_memory.h" |
19 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
20 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
36 // support for it, and on which libva is available. | 37 // support for it, and on which libva is available. |
37 // Decoding tasks are performed in a separate decoding thread. | 38 // Decoding tasks are performed in a separate decoding thread. |
38 // | 39 // |
39 // Threading/life-cycle: this object is created & destroyed on the GPU | 40 // Threading/life-cycle: this object is created & destroyed on the GPU |
40 // ChildThread. A few methods on it are called on the decoder thread which is | 41 // ChildThread. A few methods on it are called on the decoder thread which is |
41 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread | 42 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread |
42 // can assume |*this| is still alive. See |weak_this_| below for more details. | 43 // can assume |*this| is still alive. See |weak_this_| below for more details. |
43 class CONTENT_EXPORT VaapiVideoDecodeAccelerator | 44 class CONTENT_EXPORT VaapiVideoDecodeAccelerator |
44 : public media::VideoDecodeAccelerator { | 45 : public media::VideoDecodeAccelerator { |
45 public: | 46 public: |
46 VaapiVideoDecodeAccelerator( | 47 VaapiVideoDecodeAccelerator( |
scherkus (not reviewing)
2014/07/29 17:48:54
needs explicit keyword
vignatti (out of this project)
2014/07/30 21:51:30
sorry, what? Are you asking to change all the clas
| |
47 Display* x_display, | |
48 const base::Callback<bool(void)>& make_context_current); | 48 const base::Callback<bool(void)>& make_context_current); |
49 virtual ~VaapiVideoDecodeAccelerator(); | 49 virtual ~VaapiVideoDecodeAccelerator(); |
50 | 50 |
51 // media::VideoDecodeAccelerator implementation. | 51 // media::VideoDecodeAccelerator implementation. |
52 virtual bool Initialize(media::VideoCodecProfile profile, | 52 virtual bool Initialize(media::VideoCodecProfile profile, |
53 Client* client) OVERRIDE; | 53 Client* client) OVERRIDE; |
54 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; | 54 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; |
55 virtual void AssignPictureBuffers( | 55 virtual void AssignPictureBuffers( |
56 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; | 56 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; |
57 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; | 57 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 // synced/waiting to be synced to a picture. Returns it to available surfaces | 141 // synced/waiting to be synced to a picture. Returns it to available surfaces |
142 // pool. | 142 // pool. |
143 void RecycleVASurfaceID(VASurfaceID va_surface_id); | 143 void RecycleVASurfaceID(VASurfaceID va_surface_id); |
144 | 144 |
145 // Initiate wait cycle for surfaces to be released before we release them | 145 // Initiate wait cycle for surfaces to be released before we release them |
146 // and allocate new ones, as requested by the decoder. | 146 // and allocate new ones, as requested by the decoder. |
147 void InitiateSurfaceSetChange(size_t num_pics, gfx::Size size); | 147 void InitiateSurfaceSetChange(size_t num_pics, gfx::Size size); |
148 // Check if the surfaces have been released or post ourselves for later. | 148 // Check if the surfaces have been released or post ourselves for later. |
149 void TryFinishSurfaceSetChange(); | 149 void TryFinishSurfaceSetChange(); |
150 | 150 |
151 // Client-provided X/GLX state. | 151 int fd_; |
152 Display* x_display_; | |
153 base::Callback<bool(void)> make_context_current_; | 152 base::Callback<bool(void)> make_context_current_; |
154 GLXFBConfig fb_config_; | |
155 | 153 |
156 // VAVDA state. | 154 // VAVDA state. |
157 enum State { | 155 enum State { |
158 // Initialize() not called yet or failed. | 156 // Initialize() not called yet or failed. |
159 kUninitialized, | 157 kUninitialized, |
160 // DecodeTask running. | 158 // DecodeTask running. |
161 kDecoding, | 159 kDecoding, |
162 // Resetting, waiting for decoder to finish current task and cleanup. | 160 // Resetting, waiting for decoder to finish current task and cleanup. |
163 kResetting, | 161 kResetting, |
164 // Flushing, waiting for decoder to finish current task and cleanup. | 162 // Flushing, waiting for decoder to finish current task and cleanup. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 gfx::Size requested_pic_size_; | 267 gfx::Size requested_pic_size_; |
270 | 268 |
271 // The WeakPtrFactory for |weak_this_|. | 269 // The WeakPtrFactory for |weak_this_|. |
272 base::WeakPtrFactory<VaapiVideoDecodeAccelerator> weak_this_factory_; | 270 base::WeakPtrFactory<VaapiVideoDecodeAccelerator> weak_this_factory_; |
273 | 271 |
274 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); | 272 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); |
275 }; | 273 }; |
276 | 274 |
277 } // namespace content | 275 } // namespace content |
278 | 276 |
279 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 277 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_DRM_H_ |
OLD | NEW |