OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_GPU_GPU_VIDEO_DECODER_H_ | |
6 #define CHROME_GPU_GPU_VIDEO_DECODER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/callback.h" | |
10 #include "base/ref_counted.h" | |
11 #include "base/scoped_ptr.h" | |
12 #include "chrome/common/gpu_video_common.h" | |
13 #include "ipc/ipc_channel.h" | |
14 | |
15 class GpuChannel; | |
16 | |
17 class GpuVideoDecoder | |
18 : public IPC::Channel::Listener, | |
19 public base::RefCountedThreadSafe<GpuVideoDecoder> { | |
20 | |
21 public: | |
22 // IPC::Channel::Listener. | |
23 virtual void OnChannelConnected(int32 peer_pid); | |
24 virtual void OnChannelError(); | |
25 virtual void OnMessageReceived(const IPC::Message& message); | |
26 | |
27 virtual bool DoInitialize(const GpuVideoDecoderInitParam& init_param, | |
28 GpuVideoDecoderInitDoneParam* done_param) = 0; | |
29 virtual bool DoUninitialize() = 0; | |
30 virtual void DoFlush() = 0; | |
31 virtual void DoEmptyThisBuffer( | |
32 const GpuVideoDecoderInputBufferParam& buffer) = 0; | |
33 virtual void DoFillThisBuffer( | |
34 const GpuVideoDecoderOutputBufferParam& frame) = 0; | |
35 virtual void DoFillThisBufferDoneACK() = 0; | |
36 | |
37 GpuVideoDecoder(const GpuVideoDecoderInfoParam* param, | |
38 GpuChannel* channel_, | |
39 base::ProcessHandle handle); | |
40 virtual ~GpuVideoDecoder() {} | |
41 | |
42 protected: | |
43 // Output message helper. | |
44 void SendInitializeDone(const GpuVideoDecoderInitDoneParam& param); | |
45 void SendUninitializeDone(); | |
46 void SendFlushDone(); | |
47 void SendEmptyBufferDone(); | |
48 void SendEmptyBufferACK(); | |
49 void SendFillBufferDone(const GpuVideoDecoderOutputBufferParam& frame); | |
50 | |
51 int32 route_id() { return decoder_host_route_id_; } | |
52 | |
53 int32 decoder_host_route_id_; | |
54 GpuChannel* channel_; | |
55 base::ProcessHandle renderer_handle_; | |
56 | |
57 GpuVideoDecoderInitParam init_param_; | |
58 GpuVideoDecoderInitDoneParam done_param_; | |
59 | |
60 scoped_ptr<base::SharedMemory> input_transfer_buffer_; | |
61 scoped_ptr<base::SharedMemory> output_transfer_buffer_; | |
62 | |
63 private: | |
64 // Input message handler. | |
65 void OnInitialize(const GpuVideoDecoderInitParam& param); | |
66 void OnUninitialize(); | |
67 void OnFlush(); | |
68 void OnEmptyThisBuffer(const GpuVideoDecoderInputBufferParam& buffer); | |
69 void OnFillThisBuffer(const GpuVideoDecoderOutputBufferParam& frame); | |
70 void OnFillThisBufferDoneACK(); | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); | |
73 }; | |
74 | |
75 #endif // CHROME_GPU_GPU_VIDEO_DECODER_H_ | |
76 | |
OLD | NEW |