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 base::Callback<bool(void)>& make_context_current, | 38 const MakeContextCurrentCallback& make_context_current, |
39 const base::Callback< | 39 const BindImageCallback& bind_image); |
40 void(uint32_t, uint32_t, scoped_refptr<gl::GLImage>)>& bind_image); | |
41 ~VTVideoDecodeAccelerator() override; | 40 ~VTVideoDecodeAccelerator() override; |
42 | 41 |
43 // VideoDecodeAccelerator implementation. | 42 // VideoDecodeAccelerator implementation. |
44 bool Initialize(const Config& config, Client* client) override; | 43 bool Initialize(const Config& config, Client* client) override; |
45 void Decode(const media::BitstreamBuffer& bitstream) override; | 44 void Decode(const media::BitstreamBuffer& bitstream) override; |
46 void AssignPictureBuffers( | 45 void AssignPictureBuffers( |
47 const std::vector<media::PictureBuffer>& pictures) override; | 46 const std::vector<media::PictureBuffer>& pictures) override; |
48 void ReusePictureBuffer(int32_t picture_id) override; | 47 void ReusePictureBuffer(int32_t picture_id) override; |
49 void Flush() override; | 48 void Flush() override; |
50 void Reset() override; | 49 void Reset() override; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 181 |
183 // These methods returns true if a task was completed, false otherwise. | 182 // These methods returns true if a task was completed, false otherwise. |
184 bool ProcessTaskQueue(); | 183 bool ProcessTaskQueue(); |
185 bool ProcessReorderQueue(); | 184 bool ProcessReorderQueue(); |
186 bool ProcessFrame(const Frame& frame); | 185 bool ProcessFrame(const Frame& frame); |
187 bool SendFrame(const Frame& frame); | 186 bool SendFrame(const Frame& frame); |
188 | 187 |
189 // | 188 // |
190 // GPU thread state. | 189 // GPU thread state. |
191 // | 190 // |
192 base::Callback<bool(void)> make_context_current_; | 191 MakeContextCurrentCallback make_context_current_; |
193 base::Callback<void(uint32_t, uint32_t, scoped_refptr<gl::GLImage>)> | 192 BindImageCallback bind_image_; |
194 bind_image_; | |
195 media::VideoDecodeAccelerator::Client* client_; | 193 media::VideoDecodeAccelerator::Client* client_; |
196 State state_; | 194 State state_; |
197 | 195 |
198 // Queue of pending flush tasks. This is used to drop frames when a reset | 196 // Queue of pending flush tasks. This is used to drop frames when a reset |
199 // is pending. | 197 // is pending. |
200 std::queue<TaskType> pending_flush_tasks_; | 198 std::queue<TaskType> pending_flush_tasks_; |
201 | 199 |
202 // Queue of tasks to complete in the GPU thread. | 200 // Queue of tasks to complete in the GPU thread. |
203 std::queue<Task> task_queue_; | 201 std::queue<Task> task_queue_; |
204 | 202 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 // Declared last to ensure that all weak pointers are invalidated before | 262 // Declared last to ensure that all weak pointers are invalidated before |
265 // other destructors run. | 263 // other destructors run. |
266 base::WeakPtrFactory<VTVideoDecodeAccelerator> weak_this_factory_; | 264 base::WeakPtrFactory<VTVideoDecodeAccelerator> weak_this_factory_; |
267 | 265 |
268 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); | 266 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); |
269 }; | 267 }; |
270 | 268 |
271 } // namespace content | 269 } // namespace content |
272 | 270 |
273 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ | 271 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |