blob: 667d89c89c55804db90014b27506be3ab9361f7e [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 */
Peter Boström7623ce42015-12-09 12:13:30 +010010#ifndef WEBRTC_TEST_VIDEO_CAPTURER_H_
11#define WEBRTC_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
sprang3ea3c772017-03-30 07:23:48 -070015#include <memory>
16
17#include "webrtc/api/video/i420_buffer.h"
nisseaf916892017-01-10 07:44:26 -080018#include "webrtc/api/video/video_frame.h"
sprang3ea3c772017-03-30 07:23:48 -070019#include "webrtc/base/criticalsection.h"
20#include "webrtc/base/optional.h"
21#include "webrtc/media/base/videoadapter.h"
perkja49cbd32016-09-16 07:53:41 -070022#include "webrtc/media/base/videosourceinterface.h"
perkja49cbd32016-09-16 07:53:41 -070023
sprang3ea3c772017-03-30 07:23:48 -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:
sprang3ea3c772017-03-30 07:23:48 -070034 VideoCapturer();
35 virtual ~VideoCapturer();
pbos@webrtc.org29d58392013-05-16 12:08:03 +000036
37 virtual void Start() = 0;
38 virtual void Stop() = 0;
sprang3ea3c772017-03-30 07:23:48 -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};
sprang3ea3c772017-03-30 07:23:48 -070050} // namespace test
51} // namespace webrtc
pbos@webrtc.org29d58392013-05-16 12:08:03 +000052
Peter Boström7623ce42015-12-09 12:13:30 +010053#endif // WEBRTC_TEST_VIDEO_CAPTURER_H_