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