summaryrefslogtreecommitdiffstats
path: root/remoting/codec/video_encoder.h
blob: 81179c4da0862f9acb94f0abad069300d56df3d6 (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
// 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.

#ifndef REMOTING_CODEC_VIDEO_ENCODER_H_
#define REMOTING_CODEC_VIDEO_ENCODER_H_

#include "base/basictypes.h"
#include "base/callback.h"
#include "media/base/data_buffer.h"

namespace media {
class ScreenCaptureData;
}  // namespace media

namespace remoting {

class VideoPacket;

// A class to perform the task of encoding a continous stream of
// images.
// This class operates asynchronously to enable maximum throughput.
class VideoEncoder {
 public:

  // DataAvailableCallback is called one or more times, for each chunk the
  // underlying video encoder generates.
  typedef base::Callback<void(scoped_ptr<VideoPacket>)> DataAvailableCallback;

  virtual ~VideoEncoder() {}

  // Encode an image stored in |capture_data|.
  //
  // If |key_frame| is true, the encoder should not reference
  // previous encode and encode the full frame.
  //
  // When encoded data is available, partial or full |data_available_callback|
  // is called.
  virtual void Encode(scoped_refptr<media::ScreenCaptureData> capture_data,
                      bool key_frame,
                      const DataAvailableCallback& data_available_callback) = 0;
};

}  // namespace remoting

#endif  // REMOTING_CODEC_VIDEO_ENCODER_H_