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_H_ |
9 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 9 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
10 | 10 |
11 #include <list> | 11 #include <list> |
12 #include <map> | 12 #include <map> |
13 #include <queue> | 13 #include <queue> |
14 #include <utility> | 14 #include <utility> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/memory/linked_ptr.h" | 18 #include "base/memory/linked_ptr.h" |
19 #include "base/memory/shared_memory.h" | |
20 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
21 #include "base/message_loop/message_loop.h" | 20 #include "base/message_loop/message_loop.h" |
22 #include "base/synchronization/condition_variable.h" | 21 #include "base/synchronization/condition_variable.h" |
23 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
24 #include "base/threading/thread.h" | 23 #include "base/threading/thread.h" |
25 #include "content/common/content_export.h" | 24 #include "content/common/content_export.h" |
| 25 #include "content/common/gpu/media/shared_memory_region.h" |
26 #include "content/common/gpu/media/vaapi_wrapper.h" | 26 #include "content/common/gpu/media/vaapi_wrapper.h" |
27 #include "media/base/bitstream_buffer.h" | 27 #include "media/base/bitstream_buffer.h" |
28 #include "media/video/picture.h" | 28 #include "media/video/picture.h" |
29 #include "media/video/video_decode_accelerator.h" | 29 #include "media/video/video_decode_accelerator.h" |
30 | 30 |
31 namespace gl { | 31 namespace gl { |
32 class GLImage; | 32 class GLImage; |
33 } | 33 } |
34 | 34 |
35 namespace content { | 35 namespace content { |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // Protects input buffer and surface queues and state_. | 199 // Protects input buffer and surface queues and state_. |
200 base::Lock lock_; | 200 base::Lock lock_; |
201 State state_; | 201 State state_; |
202 | 202 |
203 // An input buffer awaiting consumption, provided by the client. | 203 // An input buffer awaiting consumption, provided by the client. |
204 struct InputBuffer { | 204 struct InputBuffer { |
205 InputBuffer(); | 205 InputBuffer(); |
206 ~InputBuffer(); | 206 ~InputBuffer(); |
207 | 207 |
208 int32 id; | 208 int32 id; |
209 size_t size; | 209 scoped_ptr<SharedMemoryRegion> shm; |
210 scoped_ptr<base::SharedMemory> shm; | |
211 }; | 210 }; |
212 | 211 |
213 // Queue for incoming input buffers. | 212 // Queue for incoming input buffers. |
214 typedef std::queue<linked_ptr<InputBuffer> > InputBuffers; | 213 typedef std::queue<linked_ptr<InputBuffer> > InputBuffers; |
215 InputBuffers input_buffers_; | 214 InputBuffers input_buffers_; |
216 // Signalled when input buffers are queued onto the input_buffers_ queue. | 215 // Signalled when input buffers are queued onto the input_buffers_ queue. |
217 base::ConditionVariable input_ready_; | 216 base::ConditionVariable input_ready_; |
218 | 217 |
219 // Current input buffer at decoder. | 218 // Current input buffer at decoder. |
220 linked_ptr<InputBuffer> curr_input_buffer_; | 219 linked_ptr<InputBuffer> curr_input_buffer_; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 306 |
308 // The WeakPtrFactory for |weak_this_|. | 307 // The WeakPtrFactory for |weak_this_|. |
309 base::WeakPtrFactory<VaapiVideoDecodeAccelerator> weak_this_factory_; | 308 base::WeakPtrFactory<VaapiVideoDecodeAccelerator> weak_this_factory_; |
310 | 309 |
311 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); | 310 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); |
312 }; | 311 }; |
313 | 312 |
314 } // namespace content | 313 } // namespace content |
315 | 314 |
316 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 315 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |