blob: 7e640c93a5eac198229cf4ea67d377e6beb13755 [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 */
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020010#ifndef TEST_VIDEO_CAPTURER_H_
11#define 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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "api/optional.h"
18#include "api/video/i420_buffer.h"
19#include "api/video/video_frame.h"
Patrik Höglund9e194032018-01-04 15:58:20 +010020#include "api/videosourceinterface.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
perkja49cbd32016-09-16 07:53:41 -070032class VideoCapturer : public rtc::VideoSourceInterface<VideoFrame> {
pbos@webrtc.org29d58392013-05-16 12:08:03 +000033 public:
sprangc5d62e22017-04-02 23:53:04 -070034 VideoCapturer();
35 virtual ~VideoCapturer();
pbos@webrtc.org29d58392013-05-16 12:08:03 +000036
37 virtual void Start() = 0;
38 virtual void Stop() = 0;
sprangc5d62e22017-04-02 23:53:04 -070039
40 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
41 const rtc::VideoSinkWants& wants) override;
42
43 protected:
44 rtc::Optional<VideoFrame> AdaptFrame(const VideoFrame& frame);
45 rtc::VideoSinkWants GetSinkWants();
46
47 private:
48 const std::unique_ptr<cricket::VideoAdapter> video_adapter_;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000049};
sprangc5d62e22017-04-02 23:53:04 -070050} // namespace test
51} // namespace webrtc
pbos@webrtc.org29d58392013-05-16 12:08:03 +000052
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020053#endif // TEST_VIDEO_CAPTURER_H_