blob: 93b3e8f2d81392c52759cdf54f13d63d9709a5a7 [file] [log] [blame]
pbos@webrtc.org29d58392013-05-16 12:08:03 +00001/*
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 */
Sebastian Janssonf1f363f2018-08-13 14:24:58 +020010#ifndef TEST_TEST_VIDEO_CAPTURER_H_
11#define TEST_TEST_VIDEO_CAPTURER_H_
pbos@webrtc.org29d58392013-05-16 12:08:03 +000012
pbos@webrtc.org26d12102013-05-29 13:41:03 +000013#include <stddef.h>
14
sprangc5d62e22017-04-02 23:53:04 -070015#include <memory>
16
Danil Chapovalov431abd92018-06-18 12:54:17 +020017#include "absl/types/optional.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020018#include "api/video/i420_buffer.h"
19#include "api/video/video_frame.h"
Niels Möller0327c2d2018-05-21 14:09:31 +020020#include "api/video/video_source_interface.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020021#include "media/base/videoadapter.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020022#include "rtc_base/criticalsection.h"
perkja49cbd32016-09-16 07:53:41 -070023
sprangc5d62e22017-04-02 23:53:04 -070024namespace cricket {
25class VideoAdapter;
26} // namespace cricket
27
pbos@webrtc.org29d58392013-05-16 12:08:03 +000028namespace webrtc {
pbos@webrtc.org26d12102013-05-29 13:41:03 +000029class Clock;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000030namespace test {
31
Sebastian Janssonf1f363f2018-08-13 14:24:58 +020032class TestVideoCapturer : public rtc::VideoSourceInterface<VideoFrame> {
pbos@webrtc.org29d58392013-05-16 12:08:03 +000033 public:
Sebastian Janssonf1f363f2018-08-13 14:24:58 +020034 TestVideoCapturer();
35 virtual ~TestVideoCapturer();
pbos@webrtc.org29d58392013-05-16 12:08:03 +000036
sprangc5d62e22017-04-02 23:53:04 -070037 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
38 const rtc::VideoSinkWants& wants) override;
39
40 protected:
Danil Chapovalov431abd92018-06-18 12:54:17 +020041 absl::optional<VideoFrame> AdaptFrame(const VideoFrame& frame);
sprangc5d62e22017-04-02 23:53:04 -070042 rtc::VideoSinkWants GetSinkWants();
43
44 private:
45 const std::unique_ptr<cricket::VideoAdapter> video_adapter_;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000046};
sprangc5d62e22017-04-02 23:53:04 -070047} // namespace test
48} // namespace webrtc
pbos@webrtc.org29d58392013-05-16 12:08:03 +000049
Sebastian Janssonf1f363f2018-08-13 14:24:58 +020050#endif // TEST_TEST_VIDEO_CAPTURER_H_