OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 REMOTING_PROTOCOL_PROTOBUF_VIDEO_READER_H_ | 5 #ifndef REMOTING_PROTOCOL_PROTOBUF_VIDEO_READER_H_ |
6 #define REMOTING_PROTOCOL_PROTOBUF_VIDEO_READER_H_ | 6 #define REMOTING_PROTOCOL_PROTOBUF_VIDEO_READER_H_ |
7 | 7 |
| 8 #include "base/compiler_specific.h" |
8 #include "remoting/proto/video.pb.h" | 9 #include "remoting/proto/video.pb.h" |
9 #include "remoting/protocol/message_reader.h" | 10 #include "remoting/protocol/message_reader.h" |
10 #include "remoting/protocol/video_reader.h" | 11 #include "remoting/protocol/video_reader.h" |
11 | 12 |
| 13 namespace net { |
| 14 class StreamSocket; |
| 15 } // namespace net |
| 16 |
12 namespace remoting { | 17 namespace remoting { |
13 namespace protocol { | 18 namespace protocol { |
14 | 19 |
15 class Session; | 20 class Session; |
16 | 21 |
17 class ProtobufVideoReader : public VideoReader { | 22 class ProtobufVideoReader : public VideoReader { |
18 public: | 23 public: |
19 ProtobufVideoReader(VideoPacketFormat::Encoding encoding); | 24 ProtobufVideoReader(VideoPacketFormat::Encoding encoding); |
20 virtual ~ProtobufVideoReader(); | 25 virtual ~ProtobufVideoReader(); |
21 | 26 |
22 // VideoReader interface. | 27 // VideoReader interface. |
23 virtual void Init(protocol::Session* session, VideoStub* video_stub); | 28 virtual void Init(protocol::Session* session, |
| 29 VideoStub* video_stub, |
| 30 const InitializedCallback& callback) OVERRIDE; |
24 | 31 |
25 private: | 32 private: |
| 33 void OnChannelReady(const std::string& name, net::StreamSocket* socket); |
26 void OnNewData(VideoPacket* packet, Task* done_task); | 34 void OnNewData(VideoPacket* packet, Task* done_task); |
27 | 35 |
| 36 InitializedCallback initialized_callback_; |
| 37 |
28 VideoPacketFormat::Encoding encoding_; | 38 VideoPacketFormat::Encoding encoding_; |
29 | 39 |
| 40 // TODO(sergeyu): Remove |channel_| and let |reader_| own it. |
| 41 scoped_ptr<net::StreamSocket> channel_; |
| 42 |
30 ProtobufMessageReader<VideoPacket> reader_; | 43 ProtobufMessageReader<VideoPacket> reader_; |
31 | 44 |
32 // The stub that processes all received packets. | 45 // The stub that processes all received packets. |
33 VideoStub* video_stub_; | 46 VideoStub* video_stub_; |
34 | 47 |
35 DISALLOW_COPY_AND_ASSIGN(ProtobufVideoReader); | 48 DISALLOW_COPY_AND_ASSIGN(ProtobufVideoReader); |
36 }; | 49 }; |
37 | 50 |
38 } // namespace protocol | 51 } // namespace protocol |
39 } // namespace remoting | 52 } // namespace remoting |
40 | 53 |
41 #endif // REMOTING_PROTOCOL_PROTOBUF_VIDEO_READER_H_ | 54 #endif // REMOTING_PROTOCOL_PROTOBUF_VIDEO_READER_H_ |
OLD | NEW |