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 base | 26 } // namespace base |
27 | 27 |
28 namespace content { | 28 namespace content { |
29 | 29 |
30 // VideoToolbox.framework implementation of the VideoDecodeAccelerator | 30 // VideoToolbox.framework implementation of the VideoDecodeAccelerator |
31 // interface for Mac OS X (currently limited to 10.9+). | 31 // interface for Mac OS X (currently limited to 10.9+). |
32 class VTVideoDecodeAccelerator | 32 class VTVideoDecodeAccelerator |
33 : public media::VideoDecodeAccelerator, | 33 : public media::VideoDecodeAccelerator, |
34 public base::NonThreadSafe { | 34 public base::NonThreadSafe { |
35 public: | 35 public: |
36 explicit VTVideoDecodeAccelerator(CGLContextObj cgl_context); | 36 explicit VTVideoDecodeAccelerator( |
| 37 CGLContextObj cgl_context, |
| 38 const base::Callback<bool(void)>& make_context_current); |
37 ~VTVideoDecodeAccelerator() override; | 39 ~VTVideoDecodeAccelerator() override; |
38 | 40 |
39 // VideoDecodeAccelerator implementation. | 41 // VideoDecodeAccelerator implementation. |
40 bool Initialize(media::VideoCodecProfile profile, Client* client) override; | 42 bool Initialize(media::VideoCodecProfile profile, Client* client) override; |
41 void Decode(const media::BitstreamBuffer& bitstream) override; | 43 void Decode(const media::BitstreamBuffer& bitstream) override; |
42 void AssignPictureBuffers( | 44 void AssignPictureBuffers( |
43 const std::vector<media::PictureBuffer>& pictures) override; | 45 const std::vector<media::PictureBuffer>& pictures) override; |
44 void ReusePictureBuffer(int32_t picture_id) override; | 46 void ReusePictureBuffer(int32_t picture_id) override; |
45 void Flush() override; | 47 void Flush() override; |
46 void Reset() override; | 48 void Reset() override; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 void CompleteAction(Action action); | 116 void CompleteAction(Action action); |
115 | 117 |
116 // Complete all actions pending for a particular |bitstream_id|. | 118 // Complete all actions pending for a particular |bitstream_id|. |
117 // Warning: Do not call if there is a pending ACTION_DESTROY. | 119 // Warning: Do not call if there is a pending ACTION_DESTROY. |
118 void CompleteActions(int32_t bitstream_id); | 120 void CompleteActions(int32_t bitstream_id); |
119 | 121 |
120 // | 122 // |
121 // GPU thread state. | 123 // GPU thread state. |
122 // | 124 // |
123 CGLContextObj cgl_context_; | 125 CGLContextObj cgl_context_; |
| 126 base::Callback<bool(void)> make_context_current_; |
124 media::VideoDecodeAccelerator::Client* client_; | 127 media::VideoDecodeAccelerator::Client* client_; |
125 bool has_error_; // client_->NotifyError() called. | 128 bool has_error_; // client_->NotifyError() called. |
126 gfx::Size texture_size_; | 129 gfx::Size texture_size_; |
127 std::queue<PendingAction> pending_actions_; | 130 std::queue<PendingAction> pending_actions_; |
128 std::queue<int32_t> pending_bitstream_ids_; | 131 std::queue<int32_t> pending_bitstream_ids_; |
129 | 132 |
130 // Texture IDs of pictures. | 133 // Texture IDs of pictures. |
131 // TODO(sandersd): A single map of structs holding picture data. | 134 // TODO(sandersd): A single map of structs holding picture data. |
132 std::map<int32_t, uint32_t> texture_ids_; | 135 std::map<int32_t, uint32_t> texture_ids_; |
133 | 136 |
(...skipping 27 matching lines...) Expand all Loading... |
161 // Declared last to ensure that all decoder thread tasks complete before any | 164 // Declared last to ensure that all decoder thread tasks complete before any |
162 // state is destructed. | 165 // state is destructed. |
163 base::Thread decoder_thread_; | 166 base::Thread decoder_thread_; |
164 | 167 |
165 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); | 168 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); |
166 }; | 169 }; |
167 | 170 |
168 } // namespace content | 171 } // namespace content |
169 | 172 |
170 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ | 173 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |