blob: 53d61fc53a27c188330be4ff98a8d4d06d4ec392 [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 */
10#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_VCM_CAPTURER_H_
11#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_VCM_CAPTURER_H_
12
Peter Boström1e737c62015-10-23 14:45:55 +020013#include "webrtc/base/criticalsection.h"
pbos@webrtc.org29d58392013-05-16 12:08:03 +000014#include "webrtc/common_types.h"
15#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
16#include "webrtc/modules/video_capture/include/video_capture.h"
pbos@webrtc.org16e03b72013-10-28 16:32:01 +000017#include "webrtc/test/video_capturer.h"
pbos@webrtc.org29d58392013-05-16 12:08:03 +000018
19namespace webrtc {
20namespace test {
21
22class VcmCapturer : public VideoCapturer, public VideoCaptureDataCallback {
23 public:
Peter Boström4b91bd02015-06-26 06:58:16 +020024 static VcmCapturer* Create(VideoCaptureInput* input,
25 size_t width,
26 size_t height,
27 size_t target_fps);
pbos@webrtc.org29d58392013-05-16 12:08:03 +000028 virtual ~VcmCapturer();
29
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000030 void Start() override;
31 void Stop() override;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000032
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000033 void OnIncomingCapturedFrame(const int32_t id,
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -070034 const VideoFrame& frame) override; // NOLINT
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000035 void OnCaptureDelayChanged(const int32_t id, const int32_t delay) override;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000036
37 private:
Peter Boström4b91bd02015-06-26 06:58:16 +020038 explicit VcmCapturer(VideoCaptureInput* input);
pbos@webrtc.org29d58392013-05-16 12:08:03 +000039 bool Init(size_t width, size_t height, size_t target_fps);
40 void Destroy();
41
Peter Boström1e737c62015-10-23 14:45:55 +020042 rtc::CriticalSection crit_;
43 bool started_ GUARDED_BY(crit_);
pbos@webrtc.org375deb42013-05-21 09:32:22 +000044 VideoCaptureModule* vcm_;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000045 VideoCaptureCapability capability_;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000046};
47} // test
48} // webrtc
49
50#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_VCM_CAPTURER_H_