blob: 8dd5157b5b1a1ca5040b5d77ce9002cafc2a97c9 [file] [log] [blame]
sprang@webrtc.org8b881922013-12-10 10:05:171/*
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
Mirko Bonadei92ea95e2017-09-15 04:47:3111#ifndef TEST_CONFIGURABLE_FRAME_SIZE_ENCODER_H_
12#define TEST_CONFIGURABLE_FRAME_SIZE_ENCODER_H_
sprang@webrtc.org8b881922013-12-10 10:05:1713
Yves Gerey3e707812018-11-28 15:47:4914#include <stddef.h>
15#include <stdint.h>
Jonas Olssona4d87372019-07-05 17:08:3316
Yves Gerey3e707812018-11-28 15:47:4917#include <functional>
kwibergbfefb032016-05-01 21:53:4618#include <memory>
sprang@webrtc.org8b881922013-12-10 10:05:1719#include <vector>
20
Yves Gerey3e707812018-11-28 15:47:4921#include "absl/types/optional.h"
22#include "api/video/video_bitrate_allocation.h"
23#include "api/video/video_frame.h"
24#include "api/video_codecs/video_codec.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3125#include "api/video_codecs/video_encoder.h"
Yves Gerey3e707812018-11-28 15:47:4926#include "modules/video_coding/include/video_codec_interface.h"
sprang@webrtc.org8b881922013-12-10 10:05:1727
28namespace webrtc {
29namespace test {
30
31class ConfigurableFrameSizeEncoder : public VideoEncoder {
32 public:
pkasting@chromium.org4591fbd2014-11-20 22:28:1433 explicit ConfigurableFrameSizeEncoder(size_t max_frame_size);
Ilya Nikolaevskiyb0588e62018-08-27 12:12:2734 ~ConfigurableFrameSizeEncoder() override;
sprang@webrtc.org8b881922013-12-10 10:05:1735
Elad Alon8f01c4e2019-06-28 13:19:4336 void SetFecControllerOverride(
37 FecControllerOverride* fec_controller_override) override;
38
kjellander@webrtc.org14665ff2015-03-04 12:58:3539 int32_t InitEncode(const VideoCodec* codec_settings,
Elad Alon370f93a2019-06-11 12:57:5740 const Settings& settings) override;
sprang@webrtc.org8b881922013-12-10 10:05:1741
Miguel Casas-Sanchez47650702015-05-30 00:21:4042 int32_t Encode(const VideoFrame& input_image,
Niels Möller87e2d782019-03-07 09:18:2343 const std::vector<VideoFrameType>* frame_types) override;
sprang@webrtc.org8b881922013-12-10 10:05:1744
kjellander@webrtc.org14665ff2015-03-04 12:58:3545 int32_t RegisterEncodeCompleteCallback(
46 EncodedImageCallback* callback) override;
sprang@webrtc.org8b881922013-12-10 10:05:1747
kjellander@webrtc.org14665ff2015-03-04 12:58:3548 int32_t Release() override;
sprang@webrtc.org8b881922013-12-10 10:05:1749
Erik Språng16cb8f52019-04-12 11:59:0950 void SetRates(const RateControlParameters& parameters) override;
sprang@webrtc.org8b881922013-12-10 10:05:1751
pkasting@chromium.org4591fbd2014-11-20 22:28:1452 int32_t SetFrameSize(size_t size);
sprang@webrtc.org8b881922013-12-10 10:05:1753
Philip Eliassond52a1a62018-09-07 13:03:5554 void SetCodecType(VideoCodecType codec_type_);
55
Niels Möller759f9592018-10-09 12:57:0156 void RegisterPostEncodeCallback(
57 std::function<void(void)> post_encode_callback);
58
sprang@webrtc.org8b881922013-12-10 10:05:1759 private:
60 EncodedImageCallback* callback_;
Niels Möller759f9592018-10-09 12:57:0161 absl::optional<std::function<void(void)>> post_encode_callback_;
62
pkasting@chromium.org4591fbd2014-11-20 22:28:1463 size_t current_frame_size_;
Philip Eliassond52a1a62018-09-07 13:03:5564 VideoCodecType codec_type_;
sprang@webrtc.org8b881922013-12-10 10:05:1765};
66
67} // namespace test
68} // namespace webrtc
69
Mirko Bonadei92ea95e2017-09-15 04:47:3170#endif // TEST_CONFIGURABLE_FRAME_SIZE_ENCODER_H_