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 15 matching lines...) Expand all Loading... |
26 namespace content { | 26 namespace content { |
27 | 27 |
28 // Preload VideoToolbox libraries, needed for sandbox warmup. | 28 // Preload VideoToolbox libraries, needed for sandbox warmup. |
29 bool InitializeVideoToolbox(); | 29 bool InitializeVideoToolbox(); |
30 | 30 |
31 // VideoToolbox.framework implementation of the VideoDecodeAccelerator | 31 // VideoToolbox.framework implementation of the VideoDecodeAccelerator |
32 // interface for Mac OS X (currently limited to 10.9+). | 32 // interface for Mac OS X (currently limited to 10.9+). |
33 class VTVideoDecodeAccelerator : public media::VideoDecodeAccelerator { | 33 class VTVideoDecodeAccelerator : public media::VideoDecodeAccelerator { |
34 public: | 34 public: |
35 explicit VTVideoDecodeAccelerator( | 35 explicit VTVideoDecodeAccelerator( |
36 CGLContextObj cgl_context, | |
37 const base::Callback<bool(void)>& make_context_current); | 36 const base::Callback<bool(void)>& make_context_current); |
38 ~VTVideoDecodeAccelerator() override; | 37 ~VTVideoDecodeAccelerator() override; |
39 | 38 |
40 // VideoDecodeAccelerator implementation. | 39 // VideoDecodeAccelerator implementation. |
41 bool Initialize(media::VideoCodecProfile profile, Client* client) override; | 40 bool Initialize(media::VideoCodecProfile profile, Client* client) override; |
42 void Decode(const media::BitstreamBuffer& bitstream) override; | 41 void Decode(const media::BitstreamBuffer& bitstream) override; |
43 void AssignPictureBuffers( | 42 void AssignPictureBuffers( |
44 const std::vector<media::PictureBuffer>& pictures) override; | 43 const std::vector<media::PictureBuffer>& pictures) override; |
45 void ReusePictureBuffer(int32_t picture_id) override; | 44 void ReusePictureBuffer(int32_t picture_id) override; |
46 void Flush() override; | 45 void Flush() override; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 155 |
157 // These methods returns true if a task was completed, false otherwise. | 156 // These methods returns true if a task was completed, false otherwise. |
158 bool ProcessTaskQueue(); | 157 bool ProcessTaskQueue(); |
159 bool ProcessReorderQueue(); | 158 bool ProcessReorderQueue(); |
160 bool ProcessFrame(const Frame& frame); | 159 bool ProcessFrame(const Frame& frame); |
161 bool SendFrame(const Frame& frame); | 160 bool SendFrame(const Frame& frame); |
162 | 161 |
163 // | 162 // |
164 // GPU thread state. | 163 // GPU thread state. |
165 // | 164 // |
166 CGLContextObj cgl_context_; | |
167 base::Callback<bool(void)> make_context_current_; | 165 base::Callback<bool(void)> make_context_current_; |
168 media::VideoDecodeAccelerator::Client* client_; | 166 media::VideoDecodeAccelerator::Client* client_; |
169 State state_; | 167 State state_; |
170 | 168 |
171 // Queue of pending flush tasks. This is used to drop frames when a reset | 169 // Queue of pending flush tasks. This is used to drop frames when a reset |
172 // is pending. | 170 // is pending. |
173 std::queue<TaskType> pending_flush_tasks_; | 171 std::queue<TaskType> pending_flush_tasks_; |
174 | 172 |
175 // Queue of tasks to complete in the GPU thread. | 173 // Queue of tasks to complete in the GPU thread. |
176 std::queue<Task> task_queue_; | 174 std::queue<Task> task_queue_; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // Declared last to ensure that all weak pointers are invalidated before | 236 // Declared last to ensure that all weak pointers are invalidated before |
239 // other destructors run. | 237 // other destructors run. |
240 base::WeakPtrFactory<VTVideoDecodeAccelerator> weak_this_factory_; | 238 base::WeakPtrFactory<VTVideoDecodeAccelerator> weak_this_factory_; |
241 | 239 |
242 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); | 240 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); |
243 }; | 241 }; |
244 | 242 |
245 } // namespace content | 243 } // namespace content |
246 | 244 |
247 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ | 245 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |