| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_RENDERER_GPU_VIDEO_DECODER_HOST_H_ | 5 #ifndef CHROME_RENDERER_GPU_VIDEO_DECODER_HOST_H_ |
| 6 #define CHROME_RENDERER_GPU_VIDEO_DECODER_HOST_H_ | 6 #define CHROME_RENDERER_GPU_VIDEO_DECODER_HOST_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 kStateNormal, | 40 kStateNormal, |
| 41 kStateError, | 41 kStateError, |
| 42 kStateFlushing, | 42 kStateFlushing, |
| 43 } GpuVideoDecoderHostState; | 43 } GpuVideoDecoderHostState; |
| 44 | 44 |
| 45 // IPC::Channel::Listener. | 45 // IPC::Channel::Listener. |
| 46 virtual void OnChannelConnected(int32 peer_pid) {} | 46 virtual void OnChannelConnected(int32 peer_pid) {} |
| 47 virtual void OnChannelError(); | 47 virtual void OnChannelError(); |
| 48 virtual void OnMessageReceived(const IPC::Message& message); | 48 virtual void OnMessageReceived(const IPC::Message& message); |
| 49 | 49 |
| 50 bool Initialize(const GpuVideoDecoderInitParam& param); | 50 bool Initialize(EventHandler* handler, const GpuVideoDecoderInitParam& param); |
| 51 bool Uninitialize(); | 51 bool Uninitialize(); |
| 52 void EmptyThisBuffer(scoped_refptr<Buffer> buffer); | 52 void EmptyThisBuffer(scoped_refptr<Buffer> buffer); |
| 53 void FillThisBuffer(scoped_refptr<VideoFrame> frame); | 53 void FillThisBuffer(scoped_refptr<VideoFrame> frame); |
| 54 bool Flush(); | 54 bool Flush(); |
| 55 | 55 |
| 56 int32 decoder_id() { return decoder_info_.decoder_id_; } | 56 int32 decoder_id() { return decoder_info_.decoder_id_; } |
| 57 int32 route_id() { return decoder_info_.decoder_route_id_; } | 57 int32 route_id() { return decoder_info_.decoder_route_id_; } |
| 58 int32 my_route_id() { return decoder_info_.decoder_host_route_id_; } | 58 int32 my_route_id() { return decoder_info_.decoder_host_route_id_; } |
| 59 | 59 |
| 60 virtual ~GpuVideoDecoderHost() {} | 60 virtual ~GpuVideoDecoderHost() {} |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 friend class GpuVideoServiceHost; |
| 63 GpuVideoDecoderHost(GpuVideoServiceHost* service_host, | 64 GpuVideoDecoderHost(GpuVideoServiceHost* service_host, |
| 64 GpuChannelHost* channel_host, | 65 GpuChannelHost* channel_host, |
| 65 EventHandler* event_handler, | 66 int context_route_id); |
| 66 GpuVideoDecoderInfoParam decoder_info); | |
| 67 | |
| 68 friend class GpuVideoServiceHost; | |
| 69 | 67 |
| 70 // Input message handler. | 68 // Input message handler. |
| 71 void OnInitializeDone(const GpuVideoDecoderInitDoneParam& param); | 69 void OnInitializeDone(const GpuVideoDecoderInitDoneParam& param); |
| 72 void OnUninitializeDone(); | 70 void OnUninitializeDone(); |
| 73 void OnFlushDone(); | 71 void OnFlushDone(); |
| 74 void OnEmptyThisBufferDone(); | 72 void OnEmptyThisBufferDone(); |
| 75 void OnFillThisBufferDone(const GpuVideoDecoderOutputBufferParam& param); | 73 void OnFillThisBufferDone(const GpuVideoDecoderOutputBufferParam& param); |
| 76 void OnEmptyThisBufferACK(); | 74 void OnEmptyThisBufferACK(); |
| 77 | 75 |
| 78 // Helper function. | 76 // Helper function. |
| 79 void SendInputBufferToGpu(); | 77 void SendInputBufferToGpu(); |
| 80 | 78 |
| 81 // We expect that GpuVideoServiceHost's always available during our life span. | 79 // We expect that GpuVideoServiceHost's always available during our life span. |
| 82 GpuVideoServiceHost* gpu_video_service_host_; | 80 GpuVideoServiceHost* gpu_video_service_host_; |
| 83 | 81 |
| 84 scoped_refptr<GpuChannelHost> channel_host_; | 82 scoped_refptr<GpuChannelHost> channel_host_; |
| 85 | 83 |
| 84 // Route ID of the GLES2 context in the GPU process. |
| 85 int context_route_id_; |
| 86 |
| 86 // We expect that the client of us will always available during our life span. | 87 // We expect that the client of us will always available during our life span. |
| 87 EventHandler* event_handler_; | 88 EventHandler* event_handler_; |
| 88 | 89 |
| 89 // Globally identify this decoder in the GPU process. | 90 // Globally identify this decoder in the GPU process. |
| 90 GpuVideoDecoderInfoParam decoder_info_; | 91 GpuVideoDecoderInfoParam decoder_info_; |
| 91 | 92 |
| 92 // Input buffer id serial number generator. | 93 // Input buffer id serial number generator. |
| 93 int32 buffer_id_serial_; | 94 int32 buffer_id_serial_; |
| 94 | 95 |
| 95 // Hold information about GpuVideoDecoder configuration. | 96 // Hold information about GpuVideoDecoder configuration. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 110 | 111 |
| 111 // Transfer buffers for both input and output. | 112 // Transfer buffers for both input and output. |
| 112 // TODO(jiesun): remove output buffer when hardware composition is ready. | 113 // TODO(jiesun): remove output buffer when hardware composition is ready. |
| 113 scoped_ptr<base::SharedMemory> input_transfer_buffer_; | 114 scoped_ptr<base::SharedMemory> input_transfer_buffer_; |
| 114 scoped_ptr<base::SharedMemory> output_transfer_buffer_; | 115 scoped_ptr<base::SharedMemory> output_transfer_buffer_; |
| 115 | 116 |
| 116 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoderHost); | 117 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoderHost); |
| 117 }; | 118 }; |
| 118 | 119 |
| 119 #endif // CHROME_RENDERER_GPU_VIDEO_DECODER_HOST_H_ | 120 #endif // CHROME_RENDERER_GPU_VIDEO_DECODER_HOST_H_ |
| 120 | |
| OLD | NEW |