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 | #include "api/test/create_frame_generator.h" |
| 12 | |
| 13 | #include <utility> |
| 14 | |
| 15 | #include "test/frame_generator.h" |
Artem Titov | fd76b5f | 2019-12-04 23:06:35 +0100 | [diff] [blame] | 16 | #include "test/testsupport/ivf_video_frame_generator.h" |
Artem Titov | 503d723 | 2019-12-04 12:37:13 +0100 | [diff] [blame] | 17 | |
| 18 | namespace webrtc { |
| 19 | namespace test { |
| 20 | |
| 21 | std::unique_ptr<FrameGeneratorInterface> CreateSquareFrameGenerator( |
| 22 | int width, |
| 23 | int height, |
| 24 | absl::optional<FrameGeneratorInterface::OutputType> type, |
| 25 | absl::optional<int> num_squares) { |
| 26 | return FrameGenerator::CreateSquareGenerator(width, height, type, |
| 27 | num_squares); |
| 28 | } |
| 29 | |
| 30 | std::unique_ptr<FrameGeneratorInterface> CreateFromYuvFileFrameGenerator( |
| 31 | std::vector<std::string> files, |
| 32 | size_t width, |
| 33 | size_t height, |
| 34 | int frame_repeat_count) { |
| 35 | return FrameGenerator::CreateFromYuvFile(std::move(files), width, height, |
| 36 | frame_repeat_count); |
| 37 | } |
| 38 | |
Artem Titov | 78782a8 | 2019-12-05 10:38:05 +0100 | [diff] [blame] | 39 | std::unique_ptr<FrameGeneratorInterface> CreateFromIvfFileFrameGenerator( |
Artem Titov | fd76b5f | 2019-12-04 23:06:35 +0100 | [diff] [blame] | 40 | std::string file) { |
| 41 | return std::make_unique<IvfVideoFrameGenerator>(std::move(file)); |
| 42 | } |
| 43 | |
Artem Titov | 503d723 | 2019-12-04 12:37:13 +0100 | [diff] [blame] | 44 | std::unique_ptr<FrameGeneratorInterface> |
| 45 | CreateScrollingInputFromYuvFilesFrameGenerator( |
| 46 | Clock* clock, |
| 47 | std::vector<std::string> filenames, |
| 48 | size_t source_width, |
| 49 | size_t source_height, |
| 50 | size_t target_width, |
| 51 | size_t target_height, |
| 52 | int64_t scroll_time_ms, |
| 53 | int64_t pause_time_ms) { |
| 54 | return FrameGenerator::CreateScrollingInputFromYuvFiles( |
| 55 | clock, std::move(filenames), source_width, source_height, target_width, |
| 56 | target_height, scroll_time_ms, pause_time_ms); |
| 57 | } |
| 58 | |
| 59 | std::unique_ptr<FrameGeneratorInterface> |
| 60 | CreateSlideFrameGenerator(int width, int height, int frame_repeat_count) { |
| 61 | return FrameGenerator::CreateSlideGenerator(width, height, |
| 62 | frame_repeat_count); |
| 63 | } |
| 64 | |
| 65 | } // namespace test |
| 66 | } // namespace webrtc |