create_frame_generator.h 2.9 KB

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