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 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 "base/compiler_specific.h" |
9 #include "remoting/proto/video.pb.h" | 9 #include "remoting/proto/video.pb.h" |
10 #include "remoting/protocol/message_reader.h" | 10 #include "remoting/protocol/message_reader.h" |
11 #include "remoting/protocol/video_reader.h" | 11 #include "remoting/protocol/video_reader.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 class StreamSocket; | 14 class StreamSocket; |
15 } // namespace net | 15 } // namespace net |
16 | 16 |
17 namespace remoting { | 17 namespace remoting { |
18 namespace protocol { | 18 namespace protocol { |
19 | 19 |
20 class ChannelFactory; | |
20 class Session; | 21 class Session; |
21 | 22 |
22 class ProtobufVideoReader : public VideoReader { | 23 class ProtobufVideoReader : public VideoReader { |
23 public: | 24 public: |
24 ProtobufVideoReader(VideoPacketFormat::Encoding encoding); | 25 ProtobufVideoReader(VideoPacketFormat::Encoding encoding); |
25 virtual ~ProtobufVideoReader(); | 26 virtual ~ProtobufVideoReader(); |
26 | 27 |
27 // VideoReader interface. | 28 // VideoReader interface. |
28 virtual void Init(protocol::Session* session, | 29 virtual void Init(protocol::Session* session, |
29 VideoStub* video_stub, | 30 VideoStub* video_stub, |
30 const InitializedCallback& callback) OVERRIDE; | 31 const InitializedCallback& callback) OVERRIDE; |
31 virtual bool is_connected() OVERRIDE; | 32 virtual bool is_connected() OVERRIDE; |
32 | 33 |
33 private: | 34 private: |
34 void OnChannelReady(scoped_ptr<net::StreamSocket> socket); | 35 void OnChannelReady(scoped_ptr<net::StreamSocket> socket); |
35 void OnNewData(scoped_ptr<VideoPacket> packet, | 36 void OnNewData(scoped_ptr<VideoPacket> packet, |
36 const base::Closure& done_task); | 37 const base::Closure& done_task); |
37 | 38 |
38 Session* session_; | 39 ChannelFactory* channel_factory_; |
Wez
2012/08/18 00:30:36
nit: Place this near |channel_|?
Sergey Ulanov
2012/08/18 01:53:56
Done.
| |
39 | 40 |
40 InitializedCallback initialized_callback_; | 41 InitializedCallback initialized_callback_; |
41 | 42 |
42 VideoPacketFormat::Encoding encoding_; | 43 VideoPacketFormat::Encoding encoding_; |
43 | 44 |
44 // TODO(sergeyu): Remove |channel_| and let |reader_| own it. | 45 // TODO(sergeyu): Remove |channel_| and let |reader_| own it. |
45 scoped_ptr<net::StreamSocket> channel_; | 46 scoped_ptr<net::StreamSocket> channel_; |
46 | 47 |
47 ProtobufMessageReader<VideoPacket> reader_; | 48 ProtobufMessageReader<VideoPacket> reader_; |
48 | 49 |
49 // The stub that processes all received packets. | 50 // The stub that processes all received packets. |
50 VideoStub* video_stub_; | 51 VideoStub* video_stub_; |
51 | 52 |
52 DISALLOW_COPY_AND_ASSIGN(ProtobufVideoReader); | 53 DISALLOW_COPY_AND_ASSIGN(ProtobufVideoReader); |
53 }; | 54 }; |
54 | 55 |
55 } // namespace protocol | 56 } // namespace protocol |
56 } // namespace remoting | 57 } // namespace remoting |
57 | 58 |
58 #endif // REMOTING_PROTOCOL_PROTOBUF_VIDEO_READER_H_ | 59 #endif // REMOTING_PROTOCOL_PROTOBUF_VIDEO_READER_H_ |
OLD | NEW |