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 20 matching lines...) Expand all Loading... |
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, | 36 CGLContextObj cgl_context, |
37 const base::Callback<bool(void)>& make_context_current); | 37 const base::Callback<bool(void)>& make_context_current); |
38 ~VTVideoDecodeAccelerator() override; | 38 ~VTVideoDecodeAccelerator() override; |
39 | 39 |
40 // VideoDecodeAccelerator implementation. | 40 // VideoDecodeAccelerator implementation. |
41 bool Initialize(media::VideoCodecProfile profile, Client* client) override; | 41 bool Initialize(media::VideoCodecProfile profile, |
| 42 uint32 min_picture_count, |
| 43 Client* client) override; |
42 void Decode(const media::BitstreamBuffer& bitstream) override; | 44 void Decode(const media::BitstreamBuffer& bitstream) override; |
43 void AssignPictureBuffers( | 45 void AssignPictureBuffers( |
44 const std::vector<media::PictureBuffer>& pictures) override; | 46 const std::vector<media::PictureBuffer>& pictures) override; |
45 void ReusePictureBuffer(int32_t picture_id) override; | 47 void ReusePictureBuffer(int32_t picture_id) override; |
46 void Flush() override; | 48 void Flush() override; |
47 void Reset() override; | 49 void Reset() override; |
48 void Destroy() override; | 50 void Destroy() override; |
49 bool CanDecodeOnIOThread() override; | 51 bool CanDecodeOnIOThread() override; |
50 | 52 |
51 // Called by OutputThunk() when VideoToolbox finishes decoding a frame. | 53 // Called by OutputThunk() when VideoToolbox finishes decoding a frame. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 bool SendFrame(const Frame& frame); | 163 bool SendFrame(const Frame& frame); |
162 | 164 |
163 // | 165 // |
164 // GPU thread state. | 166 // GPU thread state. |
165 // | 167 // |
166 CGLContextObj cgl_context_; | 168 CGLContextObj cgl_context_; |
167 base::Callback<bool(void)> make_context_current_; | 169 base::Callback<bool(void)> make_context_current_; |
168 media::VideoDecodeAccelerator::Client* client_; | 170 media::VideoDecodeAccelerator::Client* client_; |
169 State state_; | 171 State state_; |
170 | 172 |
| 173 // The number of picture buffers to allocate. |
| 174 uint32_t num_picture_buffers_; |
| 175 |
171 // Queue of pending flush tasks. This is used to drop frames when a reset | 176 // Queue of pending flush tasks. This is used to drop frames when a reset |
172 // is pending. | 177 // is pending. |
173 std::queue<TaskType> pending_flush_tasks_; | 178 std::queue<TaskType> pending_flush_tasks_; |
174 | 179 |
175 // Queue of tasks to complete in the GPU thread. | 180 // Queue of tasks to complete in the GPU thread. |
176 std::queue<Task> task_queue_; | 181 std::queue<Task> task_queue_; |
177 | 182 |
178 // Utility class to define the order of frames in the reorder queue. | 183 // Utility class to define the order of frames in the reorder queue. |
179 struct FrameOrder { | 184 struct FrameOrder { |
180 bool operator()( | 185 bool operator()( |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // Declared last to ensure that all weak pointers are invalidated before | 243 // Declared last to ensure that all weak pointers are invalidated before |
239 // other destructors run. | 244 // other destructors run. |
240 base::WeakPtrFactory<VTVideoDecodeAccelerator> weak_this_factory_; | 245 base::WeakPtrFactory<VTVideoDecodeAccelerator> weak_this_factory_; |
241 | 246 |
242 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); | 247 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); |
243 }; | 248 }; |
244 | 249 |
245 } // namespace content | 250 } // namespace content |
246 | 251 |
247 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ | 252 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |