| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
| 6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 public: | 33 public: |
| 34 // Each of the arguments to the constructor must outlive this object. | 34 // Each of the arguments to the constructor must outlive this object. |
| 35 // |stub->decoder()| will be made current around any operation that touches | 35 // |stub->decoder()| will be made current around any operation that touches |
| 36 // the underlying VDA so that it can make GL calls safely. | 36 // the underlying VDA so that it can make GL calls safely. |
| 37 GpuVideoDecodeAccelerator( | 37 GpuVideoDecodeAccelerator( |
| 38 int32 host_route_id, | 38 int32 host_route_id, |
| 39 GpuCommandBufferStub* stub, | 39 GpuCommandBufferStub* stub, |
| 40 const scoped_refptr<base::MessageLoopProxy>& io_message_loop); | 40 const scoped_refptr<base::MessageLoopProxy>& io_message_loop); |
| 41 | 41 |
| 42 // IPC::Listener implementation. | 42 // IPC::Listener implementation. |
| 43 virtual bool OnMessageReceived(const IPC::Message& message) override; | 43 bool OnMessageReceived(const IPC::Message& message) override; |
| 44 | 44 |
| 45 // media::VideoDecodeAccelerator::Client implementation. | 45 // media::VideoDecodeAccelerator::Client implementation. |
| 46 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, | 46 void ProvidePictureBuffers(uint32 requested_num_of_buffers, |
| 47 const gfx::Size& dimensions, | 47 const gfx::Size& dimensions, |
| 48 uint32 texture_target) override; | 48 uint32 texture_target) override; |
| 49 virtual void DismissPictureBuffer(int32 picture_buffer_id) override; | 49 void DismissPictureBuffer(int32 picture_buffer_id) override; |
| 50 virtual void PictureReady(const media::Picture& picture) override; | 50 void PictureReady(const media::Picture& picture) override; |
| 51 virtual void NotifyError(media::VideoDecodeAccelerator::Error error) override; | 51 void NotifyError(media::VideoDecodeAccelerator::Error error) override; |
| 52 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) override; | 52 void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) override; |
| 53 virtual void NotifyFlushDone() override; | 53 void NotifyFlushDone() override; |
| 54 virtual void NotifyResetDone() override; | 54 void NotifyResetDone() override; |
| 55 | 55 |
| 56 // GpuCommandBufferStub::DestructionObserver implementation. | 56 // GpuCommandBufferStub::DestructionObserver implementation. |
| 57 virtual void OnWillDestroyStub() override; | 57 void OnWillDestroyStub() override; |
| 58 | 58 |
| 59 // Function to delegate sending to actual sender. | 59 // Function to delegate sending to actual sender. |
| 60 virtual bool Send(IPC::Message* message) override; | 60 bool Send(IPC::Message* message) override; |
| 61 | 61 |
| 62 // Initialize the accelerator with the given profile and send the | 62 // Initialize the accelerator with the given profile and send the |
| 63 // |init_done_msg| when done. | 63 // |init_done_msg| when done. |
| 64 void Initialize(const media::VideoCodecProfile profile, | 64 void Initialize(const media::VideoCodecProfile profile, |
| 65 IPC::Message* init_done_msg); | 65 IPC::Message* init_done_msg); |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 class MessageFilter; | 68 class MessageFilter; |
| 69 | 69 |
| 70 // We only allow self-delete, from OnWillDestroyStub(), after cleanup there. | 70 // We only allow self-delete, from OnWillDestroyStub(), after cleanup there. |
| 71 virtual ~GpuVideoDecodeAccelerator(); | 71 ~GpuVideoDecodeAccelerator() override; |
| 72 | 72 |
| 73 // Handlers for IPC messages. | 73 // Handlers for IPC messages. |
| 74 void OnDecode(base::SharedMemoryHandle handle, int32 id, uint32 size); | 74 void OnDecode(base::SharedMemoryHandle handle, int32 id, uint32 size); |
| 75 void OnAssignPictureBuffers(const std::vector<int32>& buffer_ids, | 75 void OnAssignPictureBuffers(const std::vector<int32>& buffer_ids, |
| 76 const std::vector<uint32>& texture_ids); | 76 const std::vector<uint32>& texture_ids); |
| 77 void OnReusePictureBuffer(int32 picture_buffer_id); | 77 void OnReusePictureBuffer(int32 picture_buffer_id); |
| 78 void OnFlush(); | 78 void OnFlush(); |
| 79 void OnReset(); | 79 void OnReset(); |
| 80 void OnDestroy(); | 80 void OnDestroy(); |
| 81 | 81 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 // A map from picture buffer ID to TextureRef that have not been cleared. | 133 // A map from picture buffer ID to TextureRef that have not been cleared. |
| 134 std::map<int32, scoped_refptr<gpu::gles2::TextureRef> > uncleared_textures_; | 134 std::map<int32, scoped_refptr<gpu::gles2::TextureRef> > uncleared_textures_; |
| 135 | 135 |
| 136 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); | 136 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 } // namespace content | 139 } // namespace content |
| 140 | 140 |
| 141 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 141 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |