OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 17 matching lines...) Expand all Loading... |
28 namespace content { | 28 namespace content { |
29 | 29 |
30 // Preload VideoToolbox libraries, needed for sandbox warmup. | 30 // Preload VideoToolbox libraries, needed for sandbox warmup. |
31 bool InitializeVideoToolbox(); | 31 bool InitializeVideoToolbox(); |
32 | 32 |
33 // VideoToolbox.framework implementation of the VideoDecodeAccelerator | 33 // VideoToolbox.framework implementation of the VideoDecodeAccelerator |
34 // interface for Mac OS X (currently limited to 10.9+). | 34 // interface for Mac OS X (currently limited to 10.9+). |
35 class VTVideoDecodeAccelerator : public media::VideoDecodeAccelerator { | 35 class VTVideoDecodeAccelerator : public media::VideoDecodeAccelerator { |
36 public: | 36 public: |
37 explicit VTVideoDecodeAccelerator( | 37 explicit VTVideoDecodeAccelerator( |
38 const MakeContextCurrentCallback& make_context_current, | 38 const base::Callback<bool(void)>& make_context_current, |
39 const BindImageCallback& bind_image); | 39 const base::Callback< |
| 40 void(uint32_t, uint32_t, scoped_refptr<gl::GLImage>)>& bind_image); |
40 ~VTVideoDecodeAccelerator() override; | 41 ~VTVideoDecodeAccelerator() override; |
41 | 42 |
42 // VideoDecodeAccelerator implementation. | 43 // VideoDecodeAccelerator implementation. |
43 bool Initialize(const Config& config, Client* client) override; | 44 bool Initialize(const Config& config, Client* client) override; |
44 void Decode(const media::BitstreamBuffer& bitstream) override; | 45 void Decode(const media::BitstreamBuffer& bitstream) override; |
45 void AssignPictureBuffers( | 46 void AssignPictureBuffers( |
46 const std::vector<media::PictureBuffer>& pictures) override; | 47 const std::vector<media::PictureBuffer>& pictures) override; |
47 void ReusePictureBuffer(int32_t picture_id) override; | 48 void ReusePictureBuffer(int32_t picture_id) override; |
48 void Flush() override; | 49 void Flush() override; |
49 void Reset() override; | 50 void Reset() override; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 182 |
182 // These methods returns true if a task was completed, false otherwise. | 183 // These methods returns true if a task was completed, false otherwise. |
183 bool ProcessTaskQueue(); | 184 bool ProcessTaskQueue(); |
184 bool ProcessReorderQueue(); | 185 bool ProcessReorderQueue(); |
185 bool ProcessFrame(const Frame& frame); | 186 bool ProcessFrame(const Frame& frame); |
186 bool SendFrame(const Frame& frame); | 187 bool SendFrame(const Frame& frame); |
187 | 188 |
188 // | 189 // |
189 // GPU thread state. | 190 // GPU thread state. |
190 // | 191 // |
191 MakeContextCurrentCallback make_context_current_; | 192 base::Callback<bool(void)> make_context_current_; |
192 BindImageCallback bind_image_; | 193 base::Callback<void(uint32_t, uint32_t, scoped_refptr<gl::GLImage>)> |
| 194 bind_image_; |
193 media::VideoDecodeAccelerator::Client* client_; | 195 media::VideoDecodeAccelerator::Client* client_; |
194 State state_; | 196 State state_; |
195 | 197 |
196 // Queue of pending flush tasks. This is used to drop frames when a reset | 198 // Queue of pending flush tasks. This is used to drop frames when a reset |
197 // is pending. | 199 // is pending. |
198 std::queue<TaskType> pending_flush_tasks_; | 200 std::queue<TaskType> pending_flush_tasks_; |
199 | 201 |
200 // Queue of tasks to complete in the GPU thread. | 202 // Queue of tasks to complete in the GPU thread. |
201 std::queue<Task> task_queue_; | 203 std::queue<Task> task_queue_; |
202 | 204 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 // Declared last to ensure that all weak pointers are invalidated before | 264 // Declared last to ensure that all weak pointers are invalidated before |
263 // other destructors run. | 265 // other destructors run. |
264 base::WeakPtrFactory<VTVideoDecodeAccelerator> weak_this_factory_; | 266 base::WeakPtrFactory<VTVideoDecodeAccelerator> weak_this_factory_; |
265 | 267 |
266 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); | 268 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); |
267 }; | 269 }; |
268 | 270 |
269 } // namespace content | 271 } // namespace content |
270 | 272 |
271 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ | 273 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |