pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [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 06:47:31 +0200 | [diff] [blame] | 10 | #ifndef TEST_VCM_CAPTURER_H_ |
| 11 | #define TEST_VCM_CAPTURER_H_ |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 12 | |
sprang | c5d62e2 | 2017-04-02 23:53:04 -0700 | [diff] [blame] | 13 | #include <memory> |
| 14 | |
Mirko Bonadei | 7120742 | 2017-09-15 13:58:09 +0200 | [diff] [blame] | 15 | #include "common_types.h" // NOLINT(build/include) |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 16 | #include "common_video/libyuv/include/webrtc_libyuv.h" |
| 17 | #include "modules/video_capture/video_capture.h" |
| 18 | #include "rtc_base/criticalsection.h" |
| 19 | #include "rtc_base/scoped_ref_ptr.h" |
| 20 | #include "test/video_capturer.h" |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 21 | |
| 22 | namespace webrtc { |
| 23 | namespace test { |
| 24 | |
nisse | b29b9c8 | 2016-12-12 00:22:56 -0800 | [diff] [blame] | 25 | class VcmCapturer |
| 26 | : public VideoCapturer, |
| 27 | public rtc::VideoSinkInterface<VideoFrame> { |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 28 | public: |
Tarun Chawla | 8e857d1 | 2017-05-31 19:20:57 +0530 | [diff] [blame] | 29 | static VcmCapturer* Create(size_t width, |
| 30 | size_t height, |
| 31 | size_t target_fps, |
| 32 | size_t capture_device_index); |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 33 | virtual ~VcmCapturer(); |
| 34 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 35 | void Start() override; |
| 36 | void Stop() override; |
perkj | a49cbd3 | 2016-09-16 07:53:41 -0700 | [diff] [blame] | 37 | void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, |
| 38 | const rtc::VideoSinkWants& wants) override; |
| 39 | void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override; |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 40 | |
nisse | b29b9c8 | 2016-12-12 00:22:56 -0800 | [diff] [blame] | 41 | void OnFrame(const VideoFrame& frame) override; |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 42 | |
| 43 | private: |
perkj | a49cbd3 | 2016-09-16 07:53:41 -0700 | [diff] [blame] | 44 | VcmCapturer(); |
Tarun Chawla | 8e857d1 | 2017-05-31 19:20:57 +0530 | [diff] [blame] | 45 | bool Init(size_t width, |
| 46 | size_t height, |
| 47 | size_t target_fps, |
| 48 | size_t capture_device_index); |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 49 | void Destroy(); |
| 50 | |
Peter Boström | 1e737c6 | 2015-10-23 14:45:55 +0200 | [diff] [blame] | 51 | rtc::CriticalSection crit_; |
danilchap | a37de39 | 2017-09-09 04:17:22 -0700 | [diff] [blame] | 52 | bool started_ RTC_GUARDED_BY(crit_); |
| 53 | rtc::VideoSinkInterface<VideoFrame>* sink_ RTC_GUARDED_BY(crit_); |
Peter Boström | 1d19441 | 2016-03-21 16:44:31 +0100 | [diff] [blame] | 54 | rtc::scoped_refptr<VideoCaptureModule> vcm_; |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 55 | VideoCaptureCapability capability_; |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 56 | }; |
perkj | a49cbd3 | 2016-09-16 07:53:41 -0700 | [diff] [blame] | 57 | |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 58 | } // test |
| 59 | } // webrtc |
| 60 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 61 | #endif // TEST_VCM_CAPTURER_H_ |