blob: 65916ec52e14327ac1560b7b7cf6c489773885e5 [file] [log] [blame]
pbos@webrtc.org29d58392013-05-16 12:08:03 +00001/*
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 */
Peter Boström7623ce42015-12-09 12:13:30 +010010#ifndef WEBRTC_TEST_VCM_CAPTURER_H_
11#define WEBRTC_TEST_VCM_CAPTURER_H_
pbos@webrtc.org29d58392013-05-16 12:08:03 +000012
Peter Boström1e737c62015-10-23 14:45:55 +020013#include "webrtc/base/criticalsection.h"
Peter Boström1d194412016-03-21 16:44:31 +010014#include "webrtc/base/scoped_ref_ptr.h"
pbos@webrtc.org29d58392013-05-16 12:08:03 +000015#include "webrtc/common_types.h"
16#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
Henrik Kjellander5dda80a2015-11-12 12:46:09 +010017#include "webrtc/modules/video_capture/video_capture.h"
pbos@webrtc.org16e03b72013-10-28 16:32:01 +000018#include "webrtc/test/video_capturer.h"
pbos@webrtc.org29d58392013-05-16 12:08:03 +000019
20namespace webrtc {
21namespace test {
22
23class VcmCapturer : public VideoCapturer, public VideoCaptureDataCallback {
24 public:
perkj9fdbda62016-09-15 09:19:20 -070025 static VcmCapturer* Create(VideoCaptureInput* input,
26 size_t width,
27 size_t height,
28 size_t target_fps);
pbos@webrtc.org29d58392013-05-16 12:08:03 +000029 virtual ~VcmCapturer();
30
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000031 void Start() override;
32 void Stop() override;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000033
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000034 void OnIncomingCapturedFrame(const int32_t id,
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -070035 const VideoFrame& frame) override; // NOLINT
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000036 void OnCaptureDelayChanged(const int32_t id, const int32_t delay) override;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000037
38 private:
perkj9fdbda62016-09-15 09:19:20 -070039 explicit VcmCapturer(VideoCaptureInput* input);
pbos@webrtc.org29d58392013-05-16 12:08:03 +000040 bool Init(size_t width, size_t height, size_t target_fps);
41 void Destroy();
42
Peter Boström1e737c62015-10-23 14:45:55 +020043 rtc::CriticalSection crit_;
44 bool started_ GUARDED_BY(crit_);
Peter Boström1d194412016-03-21 16:44:31 +010045 rtc::scoped_refptr<VideoCaptureModule> vcm_;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000046 VideoCaptureCapability capability_;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000047};
48} // test
49} // webrtc
50
Peter Boström7623ce42015-12-09 12:13:30 +010051#endif // WEBRTC_TEST_VCM_CAPTURER_H_