Artem Titov | 503d723 | 2019-12-04 12:37:13 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2019 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 | |
| 11 | #ifndef API_TEST_CREATE_FRAME_GENERATOR_H_ |
| 12 | #define API_TEST_CREATE_FRAME_GENERATOR_H_ |
| 13 | |
| 14 | #include <memory> |
| 15 | #include <string> |
| 16 | #include <vector> |
| 17 | |
| 18 | #include "absl/types/optional.h" |
| 19 | #include "api/test/frame_generator_interface.h" |
| 20 | #include "system_wrappers/include/clock.h" |
| 21 | |
| 22 | namespace webrtc { |
| 23 | namespace test { |
| 24 | |
| 25 | // Creates a frame generator that produces frames with small squares that |
| 26 | // move randomly towards the lower right corner. |
| 27 | // |type| has the default value FrameGeneratorInterface::OutputType::I420. |
| 28 | // |num_squares| has the default value 10. |
| 29 | std::unique_ptr<FrameGeneratorInterface> CreateSquareFrameGenerator( |
| 30 | int width, |
| 31 | int height, |
| 32 | absl::optional<FrameGeneratorInterface::OutputType> type, |
| 33 | absl::optional<int> num_squares); |
| 34 | |
| 35 | // Creates a frame generator that repeatedly plays a set of yuv files. |
| 36 | // The frame_repeat_count determines how many times each frame is shown, |
| 37 | // with 1 = show each frame once, etc. |
| 38 | std::unique_ptr<FrameGeneratorInterface> CreateFromYuvFileFrameGenerator( |
| 39 | std::vector<std::string> files, |
| 40 | size_t width, |
| 41 | size_t height, |
| 42 | int frame_repeat_count); |
| 43 | |
| 44 | // Creates a frame generator which takes a set of yuv files (wrapping a |
| 45 | // frame generator created by CreateFromYuvFile() above), but outputs frames |
| 46 | // that have been cropped to specified resolution: source_width/source_height |
| 47 | // is the size of the source images, target_width/target_height is the size of |
| 48 | // the cropped output. For each source image read, the cropped viewport will |
| 49 | // be scrolled top to bottom/left to right for scroll_tim_ms milliseconds. |
| 50 | // After that the image will stay in place for pause_time_ms milliseconds, |
| 51 | // and then this will be repeated with the next file from the input set. |
| 52 | std::unique_ptr<FrameGeneratorInterface> |
| 53 | CreateScrollingInputFromYuvFilesFrameGenerator( |
| 54 | Clock* clock, |
| 55 | std::vector<std::string> filenames, |
| 56 | size_t source_width, |
| 57 | size_t source_height, |
| 58 | size_t target_width, |
| 59 | size_t target_height, |
| 60 | int64_t scroll_time_ms, |
| 61 | int64_t pause_time_ms); |
| 62 | |
| 63 | // Creates a frame generator that produces randomly generated slides. It fills |
| 64 | // the frames with randomly sized and colored squares. |
| 65 | // |frame_repeat_count| determines how many times each slide is shown. |
| 66 | std::unique_ptr<FrameGeneratorInterface> |
| 67 | CreateSlideFrameGenerator(int width, int height, int frame_repeat_count); |
| 68 | |
| 69 | } // namespace test |
| 70 | } // namespace webrtc |
| 71 | |
| 72 | #endif // API_TEST_CREATE_FRAME_GENERATOR_H_ |