| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ | |
| 6 #define CONTENT_RENDERER_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/shared_memory.h" | |
| 12 #include "ipc/ipc_channel.h" | |
| 13 #include "media/video/video_decode_accelerator.h" | |
| 14 | |
| 15 class MessageLoop; | |
| 16 class MessageRouter; | |
| 17 | |
| 18 // This class is used to talk to VideoDecodeAccelerator in the Gpu process | |
| 19 // through IPC messages. | |
| 20 class GpuVideoDecodeAcceleratorHost : public IPC::Channel::Listener, | |
| 21 public media::VideoDecodeAccelerator { | |
| 22 public: | |
| 23 // |router| is used to dispatch IPC messages to this object. | |
| 24 // |ipc_sender| is used to send IPC messages to Gpu process. | |
| 25 GpuVideoDecodeAcceleratorHost(MessageRouter* router, | |
| 26 IPC::Message::Sender* ipc_sender, | |
| 27 int32 decoder_host_id, | |
| 28 media::VideoDecodeAccelerator::Client* client); | |
| 29 virtual ~GpuVideoDecodeAcceleratorHost(); | |
| 30 | |
| 31 // IPC::Channel::Listener implementation. | |
| 32 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | |
| 33 virtual void OnChannelError() OVERRIDE; | |
| 34 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
| 35 | |
| 36 // media::VideoDecodeAccelerator implementation. | |
| 37 virtual void GetConfigs( | |
| 38 const std::vector<uint32>& requested_configs, | |
| 39 std::vector<uint32>* matched_configs) OVERRIDE; | |
| 40 virtual bool Initialize(const std::vector<uint32>& configs) OVERRIDE; | |
| 41 virtual bool Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; | |
| 42 virtual void AssignGLESBuffers( | |
| 43 const std::vector<media::GLESBuffer>& buffers) OVERRIDE; | |
| 44 virtual void AssignSysmemBuffers( | |
| 45 const std::vector<media::SysmemBuffer>& buffers) OVERRIDE; | |
| 46 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; | |
| 47 virtual bool Flush() OVERRIDE; | |
| 48 virtual bool Abort() OVERRIDE; | |
| 49 | |
| 50 private: | |
| 51 void OnBitstreamBufferProcessed(int32 bitstream_buffer_id); | |
| 52 void OnProvidePictureBuffer( | |
| 53 uint32 num_requested_buffers, const gfx::Size& buffer_size, int32 mem_type); | |
| 54 void OnDismissPictureBuffer(int32 picture_buffer_id); | |
| 55 void OnCreateDone(int32 decoder_id); | |
| 56 void OnPictureReady(int32 picture_buffer_id, | |
| 57 int32 bitstream_buffer_id, | |
| 58 const gfx::Size& visible_size, | |
| 59 const gfx::Size& decoded_size); | |
| 60 void OnFlushDone(); | |
| 61 void OnAbortDone(); | |
| 62 void OnEndOfStream(); | |
| 63 void OnErrorNotification(uint32 error); | |
| 64 | |
| 65 // A router used to send us IPC messages. | |
| 66 MessageRouter* router_; | |
| 67 | |
| 68 // Sends IPC messages to the Gpu process. | |
| 69 IPC::Message::Sender* ipc_sender_; | |
| 70 | |
| 71 // ID of this GpuVideoDecodeAcceleratorHost. | |
| 72 int32 decoder_host_id_; | |
| 73 | |
| 74 // ID of VideoDecodeAccelerator in the Gpu process. | |
| 75 int32 decoder_id_; | |
| 76 | |
| 77 // Temporarily store configs here in between Create and Initialize phase. | |
| 78 std::vector<uint32> configs_; | |
| 79 | |
| 80 // Reference to the client that will receive callbacks from the decoder. | |
| 81 media::VideoDecodeAccelerator::Client* client_; | |
| 82 | |
| 83 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecodeAcceleratorHost); | |
| 84 }; | |
| 85 | |
| 86 #endif // CONTENT_RENDERER_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ | |
| OLD | NEW |