summaryrefslogtreecommitdiffstats
path: root/remoting/protocol/video_writer.h
blob: 06bc4694717ad828c89dd7cd8941be62750b0389 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// VideoWriter is a generic interface used by ConnectionToClient to
// write into the video stream. ProtobufVideoWriter implements this
// interface for protobuf video streams.

#ifndef REMOTING_PROTOCOL_VIDEO_WRITER_H_
#define REMOTING_PROTOCOL_VIDEO_WRITER_H_

#include "base/basictypes.h"
#include "base/callback.h"
#include "remoting/protocol/video_stub.h"

namespace remoting {
namespace protocol {

class Session;
class SessionConfig;

class VideoWriter : public VideoStub {
 public:
  virtual ~VideoWriter();

  // The callback is called when initialization is finished. The
  // parameter is set to true on success.
  typedef base::Callback<void(bool)> InitializedCallback;

  static scoped_ptr<VideoWriter> Create(const SessionConfig& config);

  // Initializes the writer.
  virtual void Init(Session* session, const InitializedCallback& callback) = 0;

  // Stops writing. Must be called on the network thread before this
  // object is destroyed.
  virtual void Close() = 0;

  // Returns true if the channel is connected.
  virtual bool is_connected() = 0;

 protected:
  VideoWriter() { }

 private:
  DISALLOW_COPY_AND_ASSIGN(VideoWriter);
};

}  // namespace protocol
}  // namespace remoting

#endif  // REMOTING_PROTOCOL_VIDEO_WRITER_H_