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 // VideoReader is a generic interface used by ConnectionToHost to read | 5 // VideoReader is a generic interface used by ConnectionToHost to read |
6 // video stream. ProtobufVideoReader implements this interface for | 6 // video stream. ProtobufVideoReader implements this interface for |
7 // protobuf video stream. | 7 // protobuf video stream. |
8 | 8 |
9 #ifndef REMOTING_PROTOCOL_VIDEO_READER_H_ | 9 #ifndef REMOTING_PROTOCOL_VIDEO_READER_H_ |
10 #define REMOTING_PROTOCOL_VIDEO_READER_H_ | 10 #define REMOTING_PROTOCOL_VIDEO_READER_H_ |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/memory/scoped_ptr.h" |
13 #include "remoting/protocol/video_stub.h" | 14 #include "remoting/protocol/video_stub.h" |
14 | 15 |
15 namespace remoting { | 16 namespace remoting { |
16 namespace protocol { | 17 namespace protocol { |
17 | 18 |
18 class Session; | 19 class Session; |
19 class SessionConfig; | 20 class SessionConfig; |
20 | 21 |
21 class VideoReader { | 22 class VideoReader { |
22 public: | 23 public: |
23 static VideoReader* Create(const SessionConfig& config); | |
24 | |
25 // The callback is called when initialization is finished. The | 24 // The callback is called when initialization is finished. The |
26 // parameter is set to true on success. | 25 // parameter is set to true on success. |
27 typedef base::Callback<void(bool)> InitializedCallback; | 26 typedef base::Callback<void(bool)> InitializedCallback; |
28 | 27 |
29 virtual ~VideoReader(); | 28 virtual ~VideoReader(); |
30 | 29 |
| 30 static scoped_ptr<VideoReader> Create(const SessionConfig& config); |
| 31 |
31 // Initializies the reader. Doesn't take ownership of either |connection| | 32 // Initializies the reader. Doesn't take ownership of either |connection| |
32 // or |video_stub|. | 33 // or |video_stub|. |
33 virtual void Init(Session* session, | 34 virtual void Init(Session* session, |
34 VideoStub* video_stub, | 35 VideoStub* video_stub, |
35 const InitializedCallback& callback) = 0; | 36 const InitializedCallback& callback) = 0; |
36 virtual bool is_connected() = 0; | 37 virtual bool is_connected() = 0; |
37 | 38 |
38 protected: | 39 protected: |
39 VideoReader() { } | 40 VideoReader() { } |
40 | 41 |
41 private: | 42 private: |
42 DISALLOW_COPY_AND_ASSIGN(VideoReader); | 43 DISALLOW_COPY_AND_ASSIGN(VideoReader); |
43 }; | 44 }; |
44 | 45 |
45 } // namespace protocol | 46 } // namespace protocol |
46 } // namespace remoting | 47 } // namespace remoting |
47 | 48 |
48 #endif // REMOTING_PROTOCOL_VIDEO_READER_H_ | 49 #endif // REMOTING_PROTOCOL_VIDEO_READER_H_ |
OLD | NEW |