blob: 9c5b498f9f41b571cf70a3300e5bdf9d66eb2007 [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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "api/video/video_frame.h"
Niels Möller0327c2d2018-05-21 14:09:31 +020018#include "api/video/video_source_interface.h"
Steve Anton10542f22019-01-11 09:11:00 -080019#include "media/base/video_adapter.h"
20#include "media/base/video_broadcaster.h"
sprangc5d62e22017-04-02 23:53:04 -070021
pbos@webrtc.org29d58392013-05-16 12:08:03 +000022namespace webrtc {
pbos@webrtc.org29d58392013-05-16 12:08:03 +000023namespace test {
24
Sebastian Janssonf1f363f2018-08-13 14:24:58 +020025class TestVideoCapturer : public rtc::VideoSourceInterface<VideoFrame> {
pbos@webrtc.org29d58392013-05-16 12:08:03 +000026 public:
Sebastian Janssonf1f363f2018-08-13 14:24:58 +020027 TestVideoCapturer();
28 virtual ~TestVideoCapturer();
pbos@webrtc.org29d58392013-05-16 12:08:03 +000029
sprangc5d62e22017-04-02 23:53:04 -070030 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
31 const rtc::VideoSinkWants& wants) override;
Niels Möller3793bb42018-12-20 13:46:06 +010032 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override;
sprangc5d62e22017-04-02 23:53:04 -070033
34 protected:
Niels Möller3793bb42018-12-20 13:46:06 +010035 void OnFrame(const VideoFrame& frame);
sprangc5d62e22017-04-02 23:53:04 -070036 rtc::VideoSinkWants GetSinkWants();
37
38 private:
Niels Möller3793bb42018-12-20 13:46:06 +010039 void UpdateVideoAdapter();
40
41 rtc::VideoBroadcaster broadcaster_;
42 cricket::VideoAdapter video_adapter_;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000043};
sprangc5d62e22017-04-02 23:53:04 -070044} // namespace test
45} // namespace webrtc
pbos@webrtc.org29d58392013-05-16 12:08:03 +000046
Sebastian Janssonf1f363f2018-08-13 14:24:58 +020047#endif // TEST_TEST_VIDEO_CAPTURER_H_