frame_generator_interface.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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_FRAME_GENERATOR_INTERFACE_H_
  11. #define API_TEST_FRAME_GENERATOR_INTERFACE_H_
  12. #include <utility>
  13. #include "absl/types/optional.h"
  14. #include "api/scoped_refptr.h"
  15. #include "api/video/video_frame.h"
  16. #include "api/video/video_frame_buffer.h"
  17. namespace webrtc {
  18. namespace test {
  19. class FrameGeneratorInterface {
  20. public:
  21. struct VideoFrameData {
  22. VideoFrameData(rtc::scoped_refptr<VideoFrameBuffer> buffer,
  23. absl::optional<VideoFrame::UpdateRect> update_rect)
  24. : buffer(std::move(buffer)), update_rect(update_rect) {}
  25. rtc::scoped_refptr<VideoFrameBuffer> buffer;
  26. absl::optional<VideoFrame::UpdateRect> update_rect;
  27. };
  28. enum class OutputType { kI420, kI420A, kI010, kNV12 };
  29. static const char* OutputTypeToString(OutputType type);
  30. virtual ~FrameGeneratorInterface() = default;
  31. // Returns VideoFrameBuffer and area where most of update was done to set them
  32. // on the VideoFrame object.
  33. virtual VideoFrameData NextFrame() = 0;
  34. // Change the capture resolution.
  35. virtual void ChangeResolution(size_t width, size_t height) = 0;
  36. };
  37. } // namespace test
  38. } // namespace webrtc
  39. #endif // API_TEST_FRAME_GENERATOR_INTERFACE_H_