1/*
2 *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 *
4 *  Use of this source code is governed by a BSD-style license
5 *  that can be found in the LICENSE file in the root of the source
6 *  tree. An additional intellectual property rights grant can be found
7 *  in the file PATENTS.  All contributing project authors may
8 *  be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_TEST_CONFIGURABLE_FRAME_SIZE_ENCODER_H_
12#define WEBRTC_TEST_CONFIGURABLE_FRAME_SIZE_ENCODER_H_
13
14#include <vector>
15
16#include "webrtc/system_wrappers/interface/scoped_ptr.h"
17#include "webrtc/video_encoder.h"
18
19namespace webrtc {
20namespace test {
21
22class ConfigurableFrameSizeEncoder : public VideoEncoder {
23 public:
24  explicit ConfigurableFrameSizeEncoder(uint32_t max_frame_size);
25  virtual ~ConfigurableFrameSizeEncoder();
26
27  virtual int32_t InitEncode(const VideoCodec* codec_settings,
28                             int32_t number_of_cores,
29                             uint32_t max_payload_size) OVERRIDE;
30
31  virtual int32_t Encode(const I420VideoFrame& input_image,
32                         const CodecSpecificInfo* codec_specific_info,
33                         const std::vector<VideoFrameType>* frame_types)
34      OVERRIDE;
35
36  virtual int32_t RegisterEncodeCompleteCallback(EncodedImageCallback* callback)
37      OVERRIDE;
38
39  virtual int32_t Release() OVERRIDE;
40
41  virtual int32_t SetChannelParameters(uint32_t packet_loss, int rtt) OVERRIDE;
42
43  virtual int32_t SetRates(uint32_t new_bit_rate, uint32_t frame_rate) OVERRIDE;
44
45  virtual int32_t SetPeriodicKeyFrames(bool enable) OVERRIDE;
46
47  virtual int32_t CodecConfigParameters(uint8_t* buffer, int32_t size) OVERRIDE;
48
49  int32_t SetFrameSize(uint32_t size);
50
51 private:
52  EncodedImageCallback* callback_;
53  const uint32_t max_frame_size_;
54  uint32_t current_frame_size_;
55  scoped_ptr<uint8_t[]> buffer_;
56};
57
58}  // namespace test
59}  // namespace webrtc
60
61#endif  // WEBRTC_TEST_CONFIGURABLE_FRAME_SIZE_ENCODER_H_
62