xref: /aosp_15_r20/external/webrtc/test/vcm_capturer.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker /*
2*d9f75844SAndroid Build Coastguard Worker  *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3*d9f75844SAndroid Build Coastguard Worker  *
4*d9f75844SAndroid Build Coastguard Worker  *  Use of this source code is governed by a BSD-style license
5*d9f75844SAndroid Build Coastguard Worker  *  that can be found in the LICENSE file in the root of the source
6*d9f75844SAndroid Build Coastguard Worker  *  tree. An additional intellectual property rights grant can be found
7*d9f75844SAndroid Build Coastguard Worker  *  in the file PATENTS.  All contributing project authors may
8*d9f75844SAndroid Build Coastguard Worker  *  be found in the AUTHORS file in the root of the source tree.
9*d9f75844SAndroid Build Coastguard Worker  */
10*d9f75844SAndroid Build Coastguard Worker #ifndef TEST_VCM_CAPTURER_H_
11*d9f75844SAndroid Build Coastguard Worker #define TEST_VCM_CAPTURER_H_
12*d9f75844SAndroid Build Coastguard Worker 
13*d9f75844SAndroid Build Coastguard Worker #include <memory>
14*d9f75844SAndroid Build Coastguard Worker #include <vector>
15*d9f75844SAndroid Build Coastguard Worker 
16*d9f75844SAndroid Build Coastguard Worker #include "api/scoped_refptr.h"
17*d9f75844SAndroid Build Coastguard Worker #include "modules/video_capture/video_capture.h"
18*d9f75844SAndroid Build Coastguard Worker #include "test/test_video_capturer.h"
19*d9f75844SAndroid Build Coastguard Worker 
20*d9f75844SAndroid Build Coastguard Worker namespace webrtc {
21*d9f75844SAndroid Build Coastguard Worker namespace test {
22*d9f75844SAndroid Build Coastguard Worker 
23*d9f75844SAndroid Build Coastguard Worker class VcmCapturer : public TestVideoCapturer,
24*d9f75844SAndroid Build Coastguard Worker                     public rtc::VideoSinkInterface<VideoFrame> {
25*d9f75844SAndroid Build Coastguard Worker  public:
26*d9f75844SAndroid Build Coastguard Worker   static VcmCapturer* Create(size_t width,
27*d9f75844SAndroid Build Coastguard Worker                              size_t height,
28*d9f75844SAndroid Build Coastguard Worker                              size_t target_fps,
29*d9f75844SAndroid Build Coastguard Worker                              size_t capture_device_index);
30*d9f75844SAndroid Build Coastguard Worker   virtual ~VcmCapturer();
31*d9f75844SAndroid Build Coastguard Worker 
32*d9f75844SAndroid Build Coastguard Worker   void OnFrame(const VideoFrame& frame) override;
33*d9f75844SAndroid Build Coastguard Worker 
34*d9f75844SAndroid Build Coastguard Worker  private:
35*d9f75844SAndroid Build Coastguard Worker   VcmCapturer();
36*d9f75844SAndroid Build Coastguard Worker   bool Init(size_t width,
37*d9f75844SAndroid Build Coastguard Worker             size_t height,
38*d9f75844SAndroid Build Coastguard Worker             size_t target_fps,
39*d9f75844SAndroid Build Coastguard Worker             size_t capture_device_index);
40*d9f75844SAndroid Build Coastguard Worker   void Destroy();
41*d9f75844SAndroid Build Coastguard Worker 
42*d9f75844SAndroid Build Coastguard Worker   rtc::scoped_refptr<VideoCaptureModule> vcm_;
43*d9f75844SAndroid Build Coastguard Worker   VideoCaptureCapability capability_;
44*d9f75844SAndroid Build Coastguard Worker };
45*d9f75844SAndroid Build Coastguard Worker 
46*d9f75844SAndroid Build Coastguard Worker }  // namespace test
47*d9f75844SAndroid Build Coastguard Worker }  // namespace webrtc
48*d9f75844SAndroid Build Coastguard Worker 
49*d9f75844SAndroid Build Coastguard Worker #endif  // TEST_VCM_CAPTURER_H_
50