pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 | [diff] [blame] | 1 | /* |
| 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 Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 10 | #ifndef TEST_VCM_CAPTURER_H_ |
| 11 | #define TEST_VCM_CAPTURER_H_ |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 | [diff] [blame] | 12 | |
sprang | c5d62e2 | 2017-04-03 06:53:04 | [diff] [blame] | 13 | #include <memory> |
Niels Möller | 3793bb4 | 2018-12-20 12:46:06 | [diff] [blame] | 14 | #include <vector> |
sprang | c5d62e2 | 2017-04-03 06:53:04 | [diff] [blame] | 15 | |
Mirko Bonadei | d970807 | 2019-01-25 19:26:48 | [diff] [blame] | 16 | #include "api/scoped_refptr.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 17 | #include "modules/video_capture/video_capture.h" |
Artem Titov | 5246ae2 | 2023-06-21 13:09:33 | [diff] [blame] | 18 | #include "rtc_base/logging.h" |
Sebastian Jansson | f1f363f | 2018-08-13 12:24:58 | [diff] [blame] | 19 | #include "test/test_video_capturer.h" |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 | [diff] [blame] | 20 | |
| 21 | namespace webrtc { |
| 22 | namespace test { |
| 23 | |
Sebastian Jansson | f1f363f | 2018-08-13 12:24:58 | [diff] [blame] | 24 | class VcmCapturer : public TestVideoCapturer, |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 25 | public rtc::VideoSinkInterface<VideoFrame> { |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 | [diff] [blame] | 26 | public: |
Tarun Chawla | 8e857d1 | 2017-05-31 13:50:57 | [diff] [blame] | 27 | static VcmCapturer* Create(size_t width, |
| 28 | size_t height, |
| 29 | size_t target_fps, |
| 30 | size_t capture_device_index); |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 | [diff] [blame] | 31 | virtual ~VcmCapturer(); |
| 32 | |
Artem Titov | 5246ae2 | 2023-06-21 13:09:33 | [diff] [blame] | 33 | 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 | |
nisse | b29b9c8 | 2016-12-12 08:22:56 | [diff] [blame] | 42 | void OnFrame(const VideoFrame& frame) override; |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 | [diff] [blame] | 43 | |
Artem Titov | 6fd5f33d | 2023-03-25 20:15:09 | [diff] [blame] | 44 | int GetFrameWidth() const override { return static_cast<int>(width_); } |
| 45 | int GetFrameHeight() const override { return static_cast<int>(height_); } |
| 46 | |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 | [diff] [blame] | 47 | private: |
perkj | a49cbd3 | 2016-09-16 14:53:41 | [diff] [blame] | 48 | VcmCapturer(); |
Tarun Chawla | 8e857d1 | 2017-05-31 13:50:57 | [diff] [blame] | 49 | bool Init(size_t width, |
| 50 | size_t height, |
| 51 | size_t target_fps, |
| 52 | size_t capture_device_index); |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 | [diff] [blame] | 53 | void Destroy(); |
| 54 | |
Artem Titov | 6fd5f33d | 2023-03-25 20:15:09 | [diff] [blame] | 55 | size_t width_; |
| 56 | size_t height_; |
Peter Boström | 1d19441 | 2016-03-21 15:44:31 | [diff] [blame] | 57 | rtc::scoped_refptr<VideoCaptureModule> vcm_; |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 | [diff] [blame] | 58 | VideoCaptureCapability capability_; |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 | [diff] [blame] | 59 | }; |
perkj | a49cbd3 | 2016-09-16 14:53:41 | [diff] [blame] | 60 | |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 61 | } // namespace test |
| 62 | } // namespace webrtc |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 | [diff] [blame] | 63 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 64 | #endif // TEST_VCM_CAPTURER_H_ |