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 | 24e2089 | 2013-10-28 16:32:01 +0000 | [diff] [blame] | 14 | #include "webrtc/test/video_capturer.h" |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 15 | #include "webrtc/typedefs.h" |
| 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 | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame] | 29 | static FrameGeneratorCapturer* Create(VideoSendStreamInput* input, |
andresp@webrtc.org | 28631e7 | 2013-09-19 12:14:03 +0000 | [diff] [blame] | 30 | 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.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 41 | virtual ~FrameGeneratorCapturer(); |
| 42 | |
| 43 | virtual void Start() OVERRIDE; |
| 44 | virtual void Stop() OVERRIDE; |
| 45 | |
wu@webrtc.org | 093fc0b | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 46 | int64_t first_frame_capture_time() const { return first_frame_capture_time_; } |
| 47 | |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 48 | private: |
andresp@webrtc.org | 28631e7 | 2013-09-19 12:14:03 +0000 | [diff] [blame] | 49 | FrameGeneratorCapturer(Clock* clock, |
| 50 | VideoSendStreamInput* input, |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 51 | FrameGenerator* frame_generator, |
pbos@webrtc.org | 2f02da8 | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 52 | int target_fps); |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 53 | bool Init(); |
| 54 | void InsertFrame(); |
| 55 | static bool Run(void* obj); |
| 56 | |
pbos@webrtc.org | c476e64 | 2014-04-28 13:00:21 +0000 | [diff] [blame] | 57 | Clock* const clock_; |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 58 | bool sending_; |
| 59 | |
pbos@webrtc.org | 2f02da8 | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 60 | scoped_ptr<EventWrapper> tick_; |
| 61 | scoped_ptr<CriticalSectionWrapper> lock_; |
| 62 | scoped_ptr<ThreadWrapper> thread_; |
pbos@webrtc.org | 7deb335 | 2013-08-21 12:07:37 +0000 | [diff] [blame] | 63 | scoped_ptr<FrameGenerator> frame_generator_; |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 64 | |
| 65 | int target_fps_; |
wu@webrtc.org | 093fc0b | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 66 | |
| 67 | int64_t first_frame_capture_time_; |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 68 | }; |
| 69 | } // test |
| 70 | } // webrtc |
| 71 | |
| 72 | #endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_FRAME_GENERATOR_CAPTURER_H_ |