blob: 6b5b9fac77908de59be47d30328e3c64cdb826d4 [file] [log] [blame]
Artem Titov503d7232019-12-04 12:37:13 +01001/*
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 Titovfd76b5f2019-12-04 23:06:35 +010016#include "test/testsupport/ivf_video_frame_generator.h"
Artem Titov503d7232019-12-04 12:37:13 +010017
18namespace webrtc {
19namespace test {
20
21std::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
30std::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 Titovfd76b5f2019-12-04 23:06:35 +010039// Creates a frame generator that repeatedly plays an ivf file.
40std::unique_ptr<FrameGeneratorInterface> CreateFromYuvFileFrameGenerator(
41 std::string file) {
42 return std::make_unique<IvfVideoFrameGenerator>(std::move(file));
43}
44
Artem Titov503d7232019-12-04 12:37:13 +010045std::unique_ptr<FrameGeneratorInterface>
46CreateScrollingInputFromYuvFilesFrameGenerator(
47 Clock* clock,
48 std::vector<std::string> filenames,
49 size_t source_width,
50 size_t source_height,
51 size_t target_width,
52 size_t target_height,
53 int64_t scroll_time_ms,
54 int64_t pause_time_ms) {
55 return FrameGenerator::CreateScrollingInputFromYuvFiles(
56 clock, std::move(filenames), source_width, source_height, target_width,
57 target_height, scroll_time_ms, pause_time_ms);
58}
59
60std::unique_ptr<FrameGeneratorInterface>
61CreateSlideFrameGenerator(int width, int height, int frame_repeat_count) {
62 return FrameGenerator::CreateSlideGenerator(width, height,
63 frame_repeat_count);
64}
65
66} // namespace test
67} // namespace webrtc