blob: 920ff862b050ddc670bfdb5a21da75918a0ad99f [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#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
22namespace webrtc {
23namespace 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.
29std::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.
38std::unique_ptr<FrameGeneratorInterface> CreateFromYuvFileFrameGenerator(
39 std::vector<std::string> files,
40 size_t width,
41 size_t height,
42 int frame_repeat_count);
43
Artem Titovfd76b5f2019-12-04 23:06:35 +010044// Creates a frame generator that repeatedly plays an ivf file.
45std::unique_ptr<FrameGeneratorInterface> CreateFromYuvFileFrameGenerator(
46 std::string file);
47
Artem Titov503d7232019-12-04 12:37:13 +010048// Creates a frame generator which takes a set of yuv files (wrapping a
49// frame generator created by CreateFromYuvFile() above), but outputs frames
50// that have been cropped to specified resolution: source_width/source_height
51// is the size of the source images, target_width/target_height is the size of
52// the cropped output. For each source image read, the cropped viewport will
53// be scrolled top to bottom/left to right for scroll_tim_ms milliseconds.
54// After that the image will stay in place for pause_time_ms milliseconds,
55// and then this will be repeated with the next file from the input set.
56std::unique_ptr<FrameGeneratorInterface>
57CreateScrollingInputFromYuvFilesFrameGenerator(
58 Clock* clock,
59 std::vector<std::string> filenames,
60 size_t source_width,
61 size_t source_height,
62 size_t target_width,
63 size_t target_height,
64 int64_t scroll_time_ms,
65 int64_t pause_time_ms);
66
67// Creates a frame generator that produces randomly generated slides. It fills
68// the frames with randomly sized and colored squares.
69// |frame_repeat_count| determines how many times each slide is shown.
70std::unique_ptr<FrameGeneratorInterface>
71CreateSlideFrameGenerator(int width, int height, int frame_repeat_count);
72
73} // namespace test
74} // namespace webrtc
75
76#endif // API_TEST_CREATE_FRAME_GENERATOR_H_