OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #ifndef WEBRTC_COMMON_VIDEO_TEST_FRAME_GENERATOR_H_ | 10 #ifndef WEBRTC_COMMON_VIDEO_TEST_FRAME_GENERATOR_H_ |
11 #define WEBRTC_COMMON_VIDEO_TEST_FRAME_GENERATOR_H_ | 11 #define WEBRTC_COMMON_VIDEO_TEST_FRAME_GENERATOR_H_ |
12 | 12 |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "webrtc/typedefs.h" | 16 #include "webrtc/typedefs.h" |
17 #include "webrtc/video_frame.h" | 17 #include "webrtc/video_frame.h" |
18 | 18 |
19 namespace webrtc { | 19 namespace webrtc { |
| 20 class Clock; |
20 namespace test { | 21 namespace test { |
21 | 22 |
22 class FrameGenerator { | 23 class FrameGenerator { |
23 public: | 24 public: |
24 FrameGenerator() {} | 25 FrameGenerator() {} |
25 virtual ~FrameGenerator() {} | 26 virtual ~FrameGenerator() {} |
26 | 27 |
27 // Returns video frame that remains valid until next call. | 28 // Returns video frame that remains valid until next call. |
28 virtual VideoFrame* NextFrame() = 0; | 29 virtual VideoFrame* NextFrame() = 0; |
29 | 30 |
30 // Creates a test frame generator that creates fully saturated frames with | 31 // Creates a test frame generator that creates fully saturated frames with |
31 // varying U, V values over time. | 32 // varying U, V values over time. |
32 static FrameGenerator* CreateChromaGenerator(size_t width, size_t height); | 33 static FrameGenerator* CreateChromaGenerator(size_t width, size_t height); |
33 | 34 |
34 // Creates a frame generator that repeatedly plays a set of yuv files. | 35 // Creates a frame generator that repeatedly plays a set of yuv files. |
35 // The frame_repeat_count determines how many times each frame is shown, | 36 // The frame_repeat_count determines how many times each frame is shown, |
36 // with 1 = show each frame once, etc. | 37 // with 1 = show each frame once, etc. |
37 static FrameGenerator* CreateFromYuvFile(std::vector<std::string> files, | 38 static FrameGenerator* CreateFromYuvFile(std::vector<std::string> files, |
38 size_t width, | 39 size_t width, |
39 size_t height, | 40 size_t height, |
40 int frame_repeat_count); | 41 int frame_repeat_count); |
| 42 |
| 43 // Creates a frame generator which takes a set of yuv files (wrapping a |
| 44 // frame generator created by CreateFromYuvFile() above), but outputs frames |
| 45 // that have been cropped to specified resolution: source_width/source_height |
| 46 // is the size of the source images, target_width/target_height is the size of |
| 47 // the cropped output. For each source image read, the cropped viewport will |
| 48 // be scrolled top to bottom/left to right for scroll_tim_ms milliseconds. |
| 49 // After that the image will stay in place for pause_time_ms milliseconds, |
| 50 // and then this will be repeated with the next file from the input set. |
| 51 static FrameGenerator* CreateScrollingInputFromYuvFiles( |
| 52 Clock* clock, |
| 53 std::vector<std::string> filenames, |
| 54 size_t source_width, |
| 55 size_t source_height, |
| 56 size_t target_width, |
| 57 size_t target_height, |
| 58 int64_t scroll_time_ms, |
| 59 int64_t pause_time_ms); |
41 }; | 60 }; |
42 } // namespace test | 61 } // namespace test |
43 } // namespace webrtc | 62 } // namespace webrtc |
44 | 63 |
45 #endif // WEBRTC_COMMON_VIDEO_TEST_FRAME_GENERATOR_H_ | 64 #endif // WEBRTC_COMMON_VIDEO_TEST_FRAME_GENERATOR_H_ |
OLD | NEW |