Kári Tristan Helgason | ede7cb2 | 2019-03-06 09:34:09 | [diff] [blame] | 1 | /* |
| 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 Titov | 6fd5f33d | 2023-03-25 20:15:09 | [diff] [blame] | 13 | #include <cstddef> |
Kári Tristan Helgason | ede7cb2 | 2019-03-06 09:34:09 | [diff] [blame] | 14 | #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 Titov | 5246ae2 | 2023-06-21 13:09:33 | [diff] [blame] | 20 | #include "rtc_base/logging.h" |
Kári Tristan Helgason | ede7cb2 | 2019-03-06 09:34:09 | [diff] [blame] | 21 | #include "rtc_base/thread.h" |
| 22 | #include "test/test_video_capturer.h" |
| 23 | |
| 24 | namespace webrtc { |
| 25 | namespace test { |
| 26 | |
| 27 | class 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 Titov | 5246ae2 | 2023-06-21 13:09:33 | [diff] [blame] | 36 | 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 Helgason | ede7cb2 | 2019-03-06 09:34:09 | [diff] [blame] | 45 | void OnFrame(const VideoFrame& frame) override; |
| 46 | |
Artem Titov | 6fd5f33d | 2023-03-25 20:15:09 | [diff] [blame] | 47 | int GetFrameWidth() const override { return static_cast<int>(width_); } |
| 48 | int GetFrameHeight() const override { return static_cast<int>(height_); } |
| 49 | |
Kári Tristan Helgason | ede7cb2 | 2019-03-06 09:34:09 | [diff] [blame] | 50 | 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 Titov | 6fd5f33d | 2023-03-25 20:15:09 | [diff] [blame] | 57 | size_t width_; |
| 58 | size_t height_; |
Kári Tristan Helgason | ede7cb2 | 2019-03-06 09:34:09 | [diff] [blame] | 59 | void* capturer_; |
| 60 | void* adapter_; |
| 61 | }; |
| 62 | |
| 63 | } // namespace test |
| 64 | } // namespace webrtc |
| 65 | |
| 66 | #endif // TEST_MAC_CAPTURER_H_ |