| 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 18 matching lines...) Expand all Loading... |
| 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 base::Callback<bool(void)>& make_context_current, |
| 39 const base::Callback<void(uint32, uint32, scoped_refptr<gfx::GLImage>)>& | 39 const base::Callback<void(uint32, uint32, scoped_refptr<gl::GLImage>)>& |
| 40 bind_image); | 40 bind_image); |
| 41 ~VTVideoDecodeAccelerator() override; | 41 ~VTVideoDecodeAccelerator() override; |
| 42 | 42 |
| 43 // VideoDecodeAccelerator implementation. | 43 // VideoDecodeAccelerator implementation. |
| 44 bool Initialize(media::VideoCodecProfile profile, Client* client) override; | 44 bool Initialize(media::VideoCodecProfile profile, Client* client) override; |
| 45 void Decode(const media::BitstreamBuffer& bitstream) override; | 45 void Decode(const media::BitstreamBuffer& bitstream) override; |
| 46 void AssignPictureBuffers( | 46 void AssignPictureBuffers( |
| 47 const std::vector<media::PictureBuffer>& pictures) override; | 47 const std::vector<media::PictureBuffer>& pictures) override; |
| 48 void ReusePictureBuffer(int32_t picture_id) override; | 48 void ReusePictureBuffer(int32_t picture_id) override; |
| 49 void Flush() override; | 49 void Flush() override; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 struct PictureInfo { | 120 struct PictureInfo { |
| 121 PictureInfo(uint32_t client_texture_id, uint32_t service_texture_id); | 121 PictureInfo(uint32_t client_texture_id, uint32_t service_texture_id); |
| 122 ~PictureInfo(); | 122 ~PictureInfo(); |
| 123 | 123 |
| 124 // Image buffer, kept alive while they are bound to pictures. | 124 // Image buffer, kept alive while they are bound to pictures. |
| 125 base::ScopedCFTypeRef<CVImageBufferRef> cv_image; | 125 base::ScopedCFTypeRef<CVImageBufferRef> cv_image; |
| 126 | 126 |
| 127 // The GLImage representation of |cv_image|. This is kept around to ensure | 127 // The GLImage representation of |cv_image|. This is kept around to ensure |
| 128 // that Destroy is called on it before it hits its destructor (there is a | 128 // that Destroy is called on it before it hits its destructor (there is a |
| 129 // DCHECK that requires this). | 129 // DCHECK that requires this). |
| 130 scoped_refptr<gfx::GLImageIOSurface> gl_image; | 130 scoped_refptr<gl::GLImageIOSurface> gl_image; |
| 131 | 131 |
| 132 // Texture IDs for the image buffer. | 132 // Texture IDs for the image buffer. |
| 133 const uint32_t client_texture_id; | 133 const uint32_t client_texture_id; |
| 134 const uint32_t service_texture_id; | 134 const uint32_t service_texture_id; |
| 135 | 135 |
| 136 private: | 136 private: |
| 137 DISALLOW_COPY_AND_ASSIGN(PictureInfo); | 137 DISALLOW_COPY_AND_ASSIGN(PictureInfo); |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 // | 140 // |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // These methods returns true if a task was completed, false otherwise. | 180 // These methods returns true if a task was completed, false otherwise. |
| 181 bool ProcessTaskQueue(); | 181 bool ProcessTaskQueue(); |
| 182 bool ProcessReorderQueue(); | 182 bool ProcessReorderQueue(); |
| 183 bool ProcessFrame(const Frame& frame); | 183 bool ProcessFrame(const Frame& frame); |
| 184 bool SendFrame(const Frame& frame); | 184 bool SendFrame(const Frame& frame); |
| 185 | 185 |
| 186 // | 186 // |
| 187 // GPU thread state. | 187 // GPU thread state. |
| 188 // | 188 // |
| 189 base::Callback<bool(void)> make_context_current_; | 189 base::Callback<bool(void)> make_context_current_; |
| 190 base::Callback<void(uint32, uint32, scoped_refptr<gfx::GLImage>)> bind_image_; | 190 base::Callback<void(uint32, uint32, scoped_refptr<gl::GLImage>)> bind_image_; |
| 191 media::VideoDecodeAccelerator::Client* client_; | 191 media::VideoDecodeAccelerator::Client* client_; |
| 192 State state_; | 192 State state_; |
| 193 | 193 |
| 194 // Queue of pending flush tasks. This is used to drop frames when a reset | 194 // Queue of pending flush tasks. This is used to drop frames when a reset |
| 195 // is pending. | 195 // is pending. |
| 196 std::queue<TaskType> pending_flush_tasks_; | 196 std::queue<TaskType> pending_flush_tasks_; |
| 197 | 197 |
| 198 // Queue of tasks to complete in the GPU thread. | 198 // Queue of tasks to complete in the GPU thread. |
| 199 std::queue<Task> task_queue_; | 199 std::queue<Task> task_queue_; |
| 200 | 200 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // Declared last to ensure that all weak pointers are invalidated before | 258 // Declared last to ensure that all weak pointers are invalidated before |
| 259 // other destructors run. | 259 // other destructors run. |
| 260 base::WeakPtrFactory<VTVideoDecodeAccelerator> weak_this_factory_; | 260 base::WeakPtrFactory<VTVideoDecodeAccelerator> weak_this_factory_; |
| 261 | 261 |
| 262 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); | 262 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); |
| 263 }; | 263 }; |
| 264 | 264 |
| 265 } // namespace content | 265 } // namespace content |
| 266 | 266 |
| 267 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ | 267 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |