blob: deeb5c8c2a58284fbad9da7e3a32b56bcec41876 [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
sprangc5d62e22017-04-02 23:53:04 -070015#include <memory>
16
kwiberg84f6a3f2017-09-05 08:43:13 -070017#include "webrtc/api/optional.h"
sprangc5d62e22017-04-02 23:53:04 -070018#include "webrtc/api/video/i420_buffer.h"
nisseaf916892017-01-10 07:44:26 -080019#include "webrtc/api/video/video_frame.h"
sprangc5d62e22017-04-02 23:53:04 -070020#include "webrtc/media/base/videoadapter.h"
perkja49cbd32016-09-16 07:53:41 -070021#include "webrtc/media/base/videosourceinterface.h"
Edward Lemurc20978e2017-07-06 19:44:34 +020022#include "webrtc/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
Peter Boström7623ce42015-12-09 12:13:30 +010053#endif // WEBRTC_TEST_VIDEO_CAPTURER_H_