2013-05-16 12:08:03 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
2015-12-09 12:13:30 +01:00
|
|
|
#ifndef WEBRTC_TEST_VCM_CAPTURER_H_
|
|
|
|
|
#define WEBRTC_TEST_VCM_CAPTURER_H_
|
2013-05-16 12:08:03 +00:00
|
|
|
|
2015-10-23 14:45:55 +02:00
|
|
|
#include "webrtc/base/criticalsection.h"
|
2016-03-21 16:44:31 +01:00
|
|
|
#include "webrtc/base/scoped_ref_ptr.h"
|
2013-05-16 12:08:03 +00:00
|
|
|
#include "webrtc/common_types.h"
|
|
|
|
|
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
2015-11-12 12:46:09 +01:00
|
|
|
#include "webrtc/modules/video_capture/video_capture.h"
|
2013-10-28 16:32:01 +00:00
|
|
|
#include "webrtc/test/video_capturer.h"
|
2013-05-16 12:08:03 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
namespace test {
|
|
|
|
|
|
2016-12-12 00:22:56 -08:00
|
|
|
class VcmCapturer
|
|
|
|
|
: public VideoCapturer,
|
|
|
|
|
public rtc::VideoSinkInterface<VideoFrame> {
|
2013-05-16 12:08:03 +00:00
|
|
|
public:
|
2016-09-16 07:53:41 -07:00
|
|
|
static VcmCapturer* Create(size_t width, size_t height, size_t target_fps);
|
2013-05-16 12:08:03 +00:00
|
|
|
virtual ~VcmCapturer();
|
|
|
|
|
|
2015-03-04 12:58:35 +00:00
|
|
|
void Start() override;
|
|
|
|
|
void Stop() override;
|
2016-09-16 07:53:41 -07:00
|
|
|
void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
|
|
|
|
|
const rtc::VideoSinkWants& wants) override;
|
|
|
|
|
void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override;
|
2013-05-16 12:08:03 +00:00
|
|
|
|
2016-12-12 00:22:56 -08:00
|
|
|
void OnFrame(const VideoFrame& frame) override;
|
2013-05-16 12:08:03 +00:00
|
|
|
|
|
|
|
|
private:
|
2016-09-16 07:53:41 -07:00
|
|
|
VcmCapturer();
|
2013-05-16 12:08:03 +00:00
|
|
|
bool Init(size_t width, size_t height, size_t target_fps);
|
|
|
|
|
void Destroy();
|
|
|
|
|
|
2015-10-23 14:45:55 +02:00
|
|
|
rtc::CriticalSection crit_;
|
|
|
|
|
bool started_ GUARDED_BY(crit_);
|
2016-09-16 07:53:41 -07:00
|
|
|
rtc::VideoSinkInterface<VideoFrame>* sink_ GUARDED_BY(crit_);
|
2016-03-21 16:44:31 +01:00
|
|
|
rtc::scoped_refptr<VideoCaptureModule> vcm_;
|
2013-05-16 12:08:03 +00:00
|
|
|
VideoCaptureCapability capability_;
|
|
|
|
|
};
|
2016-09-16 07:53:41 -07:00
|
|
|
|
2013-05-16 12:08:03 +00:00
|
|
|
} // test
|
|
|
|
|
} // webrtc
|
|
|
|
|
|
2015-12-09 12:13:30 +01:00
|
|
|
#endif // WEBRTC_TEST_VCM_CAPTURER_H_
|