pbos@webrtc.org | 08f3ca9 | 2013-05-23 12:37:11 +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_H_ |
| 11 | #define WEBRTC_VIDEO_ENGINE_TEST_COMMON_FRAME_GENERATOR_H_ |
| 12 | |
| 13 | #include "webrtc/common_video/interface/i420_video_frame.h" |
| 14 | #include "webrtc/typedefs.h" |
pbos@webrtc.org | 08f3ca9 | 2013-05-23 12:37:11 +0000 | [diff] [blame] | 15 | |
| 16 | namespace webrtc { |
| 17 | |
| 18 | class Clock; |
| 19 | |
pbos@webrtc.org | 2f02da8 | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 20 | class VideoSendStreamInput; |
pbos@webrtc.org | 2f02da8 | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 21 | |
pbos@webrtc.org | 08f3ca9 | 2013-05-23 12:37:11 +0000 | [diff] [blame] | 22 | namespace test { |
| 23 | |
| 24 | // A set of classes that generate sequences of I420VideoFrames for testing |
| 25 | // without using the webcam. |
| 26 | class FrameGenerator { |
| 27 | public: |
| 28 | static FrameGenerator* Create(size_t width, size_t height, Clock* clock); |
| 29 | virtual ~FrameGenerator() {} |
| 30 | |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame^] | 31 | void InsertFrame(VideoSendStreamInput* input); |
pbos@webrtc.org | 08f3ca9 | 2013-05-23 12:37:11 +0000 | [diff] [blame] | 32 | |
| 33 | protected: |
| 34 | FrameGenerator(size_t width, size_t height, Clock* clock); |
| 35 | virtual void GenerateNextFrame() = 0; |
| 36 | |
| 37 | size_t width_, height_; |
| 38 | I420VideoFrame frame_; |
| 39 | Clock* clock_; |
| 40 | }; |
| 41 | |
| 42 | class BlackFrameGenerator : public FrameGenerator { |
| 43 | public: |
| 44 | BlackFrameGenerator(size_t width, size_t height, Clock* clock); |
| 45 | |
| 46 | private: |
| 47 | virtual void GenerateNextFrame() OVERRIDE; |
| 48 | }; |
| 49 | |
| 50 | class WhiteFrameGenerator : public FrameGenerator { |
| 51 | public: |
| 52 | WhiteFrameGenerator(size_t width, size_t height, Clock* clock); |
| 53 | |
| 54 | private: |
| 55 | virtual void GenerateNextFrame() OVERRIDE; |
| 56 | }; |
| 57 | |
| 58 | class ChromaFrameGenerator : public FrameGenerator { |
| 59 | public: |
| 60 | ChromaFrameGenerator(size_t width, size_t height, Clock* clock); |
| 61 | |
| 62 | private: |
| 63 | virtual void GenerateNextFrame() OVERRIDE; |
| 64 | }; |
| 65 | } // test |
| 66 | } // webrtc |
| 67 | |
| 68 | #endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_FRAME_GENERATOR_H_ |