pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 1 | /* |
| 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.org | 2f02da8 | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 13 | #include "webrtc/system_wrappers/interface/scoped_ptr.h" |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 14 | #include "webrtc/typedefs.h" |
pbos@webrtc.org | 2f02da8 | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 15 | #include "webrtc/video_engine/test/common/video_capturer.h" |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 16 | |
| 17 | namespace webrtc { |
| 18 | |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 19 | class CriticalSectionWrapper; |
pbos@webrtc.org | 2f02da8 | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 20 | class EventWrapper; |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 21 | class ThreadWrapper; |
| 22 | |
| 23 | namespace test { |
| 24 | |
| 25 | class FrameGenerator; |
| 26 | |
| 27 | class FrameGeneratorCapturer : public VideoCapturer { |
| 28 | public: |
pbos@webrtc.org | 7deb335 | 2013-08-21 12:07:37 +0000 | [diff] [blame] | 29 | // The FrameGeneratorCapturer takes ownership of the FrameGenerator, which |
| 30 | // will be freed when the FrameGeneratorCapturer is deleted. |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame] | 31 | static FrameGeneratorCapturer* Create(VideoSendStreamInput* input, |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 32 | FrameGenerator* frame_generator, |
pbos@webrtc.org | 2f02da8 | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 33 | int target_fps); |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 34 | virtual ~FrameGeneratorCapturer(); |
| 35 | |
| 36 | virtual void Start() OVERRIDE; |
| 37 | virtual void Stop() OVERRIDE; |
| 38 | |
| 39 | private: |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame] | 40 | FrameGeneratorCapturer(VideoSendStreamInput* input, |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 41 | FrameGenerator* frame_generator, |
pbos@webrtc.org | 2f02da8 | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 42 | int target_fps); |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 43 | bool Init(); |
| 44 | void InsertFrame(); |
| 45 | static bool Run(void* obj); |
| 46 | |
| 47 | bool sending_; |
| 48 | |
pbos@webrtc.org | 2f02da8 | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 49 | scoped_ptr<EventWrapper> tick_; |
| 50 | scoped_ptr<CriticalSectionWrapper> lock_; |
| 51 | scoped_ptr<ThreadWrapper> thread_; |
pbos@webrtc.org | 7deb335 | 2013-08-21 12:07:37 +0000 | [diff] [blame] | 52 | scoped_ptr<FrameGenerator> frame_generator_; |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 53 | |
| 54 | int target_fps_; |
| 55 | }; |
| 56 | } // test |
| 57 | } // webrtc |
| 58 | |
| 59 | #endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_FRAME_GENERATOR_CAPTURER_H_ |