• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef API_TEST_FRAME_GENERATOR_INTERFACE_H_
12 #define API_TEST_FRAME_GENERATOR_INTERFACE_H_
13 
14 #include <utility>
15 
16 #include "absl/types/optional.h"
17 #include "api/scoped_refptr.h"
18 #include "api/video/video_frame.h"
19 #include "api/video/video_frame_buffer.h"
20 
21 namespace webrtc {
22 namespace test {
23 
24 class FrameGeneratorInterface {
25  public:
26   struct VideoFrameData {
VideoFrameDataVideoFrameData27     VideoFrameData(rtc::scoped_refptr<VideoFrameBuffer> buffer,
28                    absl::optional<VideoFrame::UpdateRect> update_rect)
29         : buffer(std::move(buffer)), update_rect(update_rect) {}
30 
31     rtc::scoped_refptr<VideoFrameBuffer> buffer;
32     absl::optional<VideoFrame::UpdateRect> update_rect;
33   };
34 
35   enum class OutputType { kI420, kI420A, kI010 };
36 
37   virtual ~FrameGeneratorInterface() = default;
38 
39   // Returns VideoFrameBuffer and area where most of update was done to set them
40   // on the VideoFrame object.
41   virtual VideoFrameData NextFrame() = 0;
42 
43   // Change the capture resolution.
44   virtual void ChangeResolution(size_t width, size_t height) = 0;
45 };
46 
47 }  // namespace test
48 }  // namespace webrtc
49 
50 #endif  // API_TEST_FRAME_GENERATOR_INTERFACE_H_
51