blob: 1deea212292ca6582a23e0edb3a00a816fe08f8f [file] [log] [blame]
pbos@webrtc.org29d58392013-05-16 12:08:031/*
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 04:47:3110#ifndef TEST_VCM_CAPTURER_H_
11#define TEST_VCM_CAPTURER_H_
pbos@webrtc.org29d58392013-05-16 12:08:0312
sprangc5d62e22017-04-03 06:53:0413#include <memory>
Niels Möller3793bb42018-12-20 12:46:0614#include <vector>
sprangc5d62e22017-04-03 06:53:0415
Mirko Bonadeid9708072019-01-25 19:26:4816#include "api/scoped_refptr.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3117#include "modules/video_capture/video_capture.h"
Artem Titov5246ae22023-06-21 13:09:3318#include "rtc_base/logging.h"
Sebastian Janssonf1f363f2018-08-13 12:24:5819#include "test/test_video_capturer.h"
pbos@webrtc.org29d58392013-05-16 12:08:0320
21namespace webrtc {
22namespace test {
23
Sebastian Janssonf1f363f2018-08-13 12:24:5824class VcmCapturer : public TestVideoCapturer,
Yves Gerey665174f2018-06-19 13:03:0525 public rtc::VideoSinkInterface<VideoFrame> {
pbos@webrtc.org29d58392013-05-16 12:08:0326 public:
Tarun Chawla8e857d12017-05-31 13:50:5727 static VcmCapturer* Create(size_t width,
28 size_t height,
29 size_t target_fps,
30 size_t capture_device_index);
pbos@webrtc.org29d58392013-05-16 12:08:0331 virtual ~VcmCapturer();
32
Artem Titov5246ae22023-06-21 13:09:3333 void Start() override {
34 RTC_LOG(LS_WARNING) << "Capturer doesn't support resume/pause and always "
35 "produces the video";
36 }
37 void Stop() override {
38 RTC_LOG(LS_WARNING) << "Capturer doesn't support resume/pause and always "
39 "produces the video";
40 }
41
nisseb29b9c82016-12-12 08:22:5642 void OnFrame(const VideoFrame& frame) override;
pbos@webrtc.org29d58392013-05-16 12:08:0343
Artem Titov6fd5f33d2023-03-25 20:15:0944 int GetFrameWidth() const override { return static_cast<int>(width_); }
45 int GetFrameHeight() const override { return static_cast<int>(height_); }
46
pbos@webrtc.org29d58392013-05-16 12:08:0347 private:
perkja49cbd32016-09-16 14:53:4148 VcmCapturer();
Tarun Chawla8e857d12017-05-31 13:50:5749 bool Init(size_t width,
50 size_t height,
51 size_t target_fps,
52 size_t capture_device_index);
pbos@webrtc.org29d58392013-05-16 12:08:0353 void Destroy();
54
Artem Titov6fd5f33d2023-03-25 20:15:0955 size_t width_;
56 size_t height_;
Peter Boström1d194412016-03-21 15:44:3157 rtc::scoped_refptr<VideoCaptureModule> vcm_;
pbos@webrtc.org29d58392013-05-16 12:08:0358 VideoCaptureCapability capability_;
pbos@webrtc.org29d58392013-05-16 12:08:0359};
perkja49cbd32016-09-16 14:53:4160
Yves Gerey665174f2018-06-19 13:03:0561} // namespace test
62} // namespace webrtc
pbos@webrtc.org29d58392013-05-16 12:08:0363
Mirko Bonadei92ea95e2017-09-15 04:47:3164#endif // TEST_VCM_CAPTURER_H_