blob: 5be6bb2cb1b850e215fbf35d3fb9f5aefb6d7262 [file] [log] [blame]
pbos@webrtc.orgc1506a22013-05-29 13:41: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_FRAME_GENERATOR_CAPTURER_H_
11#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_FRAME_GENERATOR_CAPTURER_H_
12
pbos@webrtc.org2f02da82013-07-09 08:02:33 +000013#include "webrtc/system_wrappers/interface/scoped_ptr.h"
pbos@webrtc.org24e20892013-10-28 16:32:01 +000014#include "webrtc/test/video_capturer.h"
pbos@webrtc.orgc1506a22013-05-29 13:41:03 +000015#include "webrtc/typedefs.h"
16
17namespace webrtc {
18
pbos@webrtc.orgc1506a22013-05-29 13:41:03 +000019class CriticalSectionWrapper;
pbos@webrtc.org2f02da82013-07-09 08:02:33 +000020class EventWrapper;
pbos@webrtc.orgc1506a22013-05-29 13:41:03 +000021class ThreadWrapper;
22
23namespace test {
24
25class FrameGenerator;
26
27class FrameGeneratorCapturer : public VideoCapturer {
28 public:
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000029 static FrameGeneratorCapturer* Create(VideoSendStreamInput* input,
andresp@webrtc.org28631e72013-09-19 12:14:03 +000030 size_t width,
31 size_t height,
32 int target_fps,
33 Clock* clock);
34
35 static FrameGeneratorCapturer* CreateFromYuvFile(VideoSendStreamInput* input,
36 const char* file_name,
37 size_t width,
38 size_t height,
39 int target_fps,
40 Clock* clock);
pbos@webrtc.orgc1506a22013-05-29 13:41:03 +000041 virtual ~FrameGeneratorCapturer();
42
43 virtual void Start() OVERRIDE;
44 virtual void Stop() OVERRIDE;
45
46 private:
andresp@webrtc.org28631e72013-09-19 12:14:03 +000047 FrameGeneratorCapturer(Clock* clock,
48 VideoSendStreamInput* input,
pbos@webrtc.orgc1506a22013-05-29 13:41:03 +000049 FrameGenerator* frame_generator,
pbos@webrtc.org2f02da82013-07-09 08:02:33 +000050 int target_fps);
pbos@webrtc.orgc1506a22013-05-29 13:41:03 +000051 bool Init();
52 void InsertFrame();
53 static bool Run(void* obj);
54
andresp@webrtc.org28631e72013-09-19 12:14:03 +000055 Clock* clock_;
pbos@webrtc.orgc1506a22013-05-29 13:41:03 +000056 bool sending_;
57
pbos@webrtc.org2f02da82013-07-09 08:02:33 +000058 scoped_ptr<EventWrapper> tick_;
59 scoped_ptr<CriticalSectionWrapper> lock_;
60 scoped_ptr<ThreadWrapper> thread_;
pbos@webrtc.org7deb3352013-08-21 12:07:37 +000061 scoped_ptr<FrameGenerator> frame_generator_;
pbos@webrtc.orgc1506a22013-05-29 13:41:03 +000062
63 int target_fps_;
64};
65} // test
66} // webrtc
67
68#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_FRAME_GENERATOR_CAPTURER_H_