blob: 58ccfc0675e2524222ad2578be7146d399cd6dea [file] [log] [blame]
Kári Tristan Helgasonede7cb22019-03-06 09:34:091/*
2 * Copyright (c) 2019 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 */
10#ifndef TEST_MAC_CAPTURER_H_
11#define TEST_MAC_CAPTURER_H_
12
Artem Titov6fd5f33d2023-03-25 20:15:0913#include <cstddef>
Kári Tristan Helgasonede7cb22019-03-06 09:34:0914#include <memory>
15#include <vector>
16
17#include "api/media_stream_interface.h"
18#include "api/scoped_refptr.h"
19#include "modules/video_capture/video_capture.h"
Artem Titov5246ae22023-06-21 13:09:3320#include "rtc_base/logging.h"
Kári Tristan Helgasonede7cb22019-03-06 09:34:0921#include "rtc_base/thread.h"
22#include "test/test_video_capturer.h"
23
24namespace webrtc {
25namespace test {
26
27class MacCapturer : public TestVideoCapturer,
28 public rtc::VideoSinkInterface<VideoFrame> {
29 public:
30 static MacCapturer* Create(size_t width,
31 size_t height,
32 size_t target_fps,
33 size_t capture_device_index);
34 ~MacCapturer() override;
35
Artem Titov5246ae22023-06-21 13:09:3336 void Start() override {
37 RTC_LOG(LS_WARNING) << "Capturer doesn't support resume/pause and always "
38 "produces the video";
39 }
40 void Stop() override {
41 RTC_LOG(LS_WARNING) << "Capturer doesn't support resume/pause and always "
42 "produces the video";
43 }
44
Kári Tristan Helgasonede7cb22019-03-06 09:34:0945 void OnFrame(const VideoFrame& frame) override;
46
Artem Titov6fd5f33d2023-03-25 20:15:0947 int GetFrameWidth() const override { return static_cast<int>(width_); }
48 int GetFrameHeight() const override { return static_cast<int>(height_); }
49
Kári Tristan Helgasonede7cb22019-03-06 09:34:0950 private:
51 MacCapturer(size_t width,
52 size_t height,
53 size_t target_fps,
54 size_t capture_device_index);
55 void Destroy();
56
Artem Titov6fd5f33d2023-03-25 20:15:0957 size_t width_;
58 size_t height_;
Kári Tristan Helgasonede7cb22019-03-06 09:34:0959 void* capturer_;
60 void* adapter_;
61};
62
63} // namespace test
64} // namespace webrtc
65
66#endif // TEST_MAC_CAPTURER_H_