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 // VideoWriter is a generic interface for a video stream writer. RtpVideoWriter | 5 // VideoWriter is a generic interface for a video stream writer. RtpVideoWriter |
6 // and ProtobufVideoWriter implement this interface for RTP and protobuf video | 6 // and ProtobufVideoWriter implement this interface for RTP and protobuf video |
7 // streams. VideoWriter is used by ConnectionToClient to write into the video | 7 // streams. VideoWriter is used by ConnectionToClient to write into the video |
8 // stream. | 8 // stream. |
9 | 9 |
10 #ifndef REMOTING_PROTOCOL_VIDEO_WRITER_H_ | 10 #ifndef REMOTING_PROTOCOL_VIDEO_WRITER_H_ |
11 #define REMOTING_PROTOCOL_VIDEO_WRITER_H_ | 11 #define REMOTING_PROTOCOL_VIDEO_WRITER_H_ |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/callback.h" |
14 #include "remoting/protocol/video_stub.h" | 15 #include "remoting/protocol/video_stub.h" |
15 | 16 |
16 namespace remoting { | 17 namespace remoting { |
17 namespace protocol { | 18 namespace protocol { |
18 | 19 |
19 class Session; | 20 class Session; |
20 class SessionConfig; | 21 class SessionConfig; |
21 | 22 |
22 class VideoWriter : public VideoStub { | 23 class VideoWriter : public VideoStub { |
23 public: | 24 public: |
24 virtual ~VideoWriter(); | 25 virtual ~VideoWriter(); |
25 | 26 |
| 27 // The callback is called when initialization is finished. The |
| 28 // parameter is set to true on success. |
| 29 typedef base::Callback<void(bool)> InitializedCallback; |
| 30 |
26 static VideoWriter* Create(const SessionConfig* config); | 31 static VideoWriter* Create(const SessionConfig* config); |
27 | 32 |
28 // Initializes the writer. | 33 // Initializes the writer. |
29 virtual void Init(Session* session) = 0; | 34 virtual void Init(Session* session, const InitializedCallback& callback) = 0; |
30 | 35 |
31 // Stops writing. Must be called on the network thread before this | 36 // Stops writing. Must be called on the network thread before this |
32 // object is destroyed. | 37 // object is destroyed. |
33 virtual void Close() = 0; | 38 virtual void Close() = 0; |
34 | 39 |
35 protected: | 40 protected: |
36 VideoWriter() { } | 41 VideoWriter() { } |
37 | 42 |
38 private: | 43 private: |
39 DISALLOW_COPY_AND_ASSIGN(VideoWriter); | 44 DISALLOW_COPY_AND_ASSIGN(VideoWriter); |
40 }; | 45 }; |
41 | 46 |
42 } // namespace protocol | 47 } // namespace protocol |
43 } // namespace remoting | 48 } // namespace remoting |
44 | 49 |
45 #endif // REMOTING_PROTOCOL_VIDEO_WRITER_H_ | 50 #endif // REMOTING_PROTOCOL_VIDEO_WRITER_H_ |
OLD | NEW |