1 /*
2  *  Copyright (c) 2017 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 SDK_OBJC_CLASSES_VIDEO_OBJC_VIDEO_TRACK_SOURCE_H_
12 #define SDK_OBJC_CLASSES_VIDEO_OBJC_VIDEO_TRACK_SOURCE_H_
13 
14 #import "base/RTCVideoCapturer.h"
15 
16 #include "base/RTCMacros.h"
17 #include "media/base/adapted_video_track_source.h"
18 #include "rtc_base/timestamp_aligner.h"
19 
20 RTC_FWD_DECL_OBJC_CLASS(RTC_OBJC_TYPE(RTCVideoFrame));
21 
22 @interface RTCObjCVideoSourceAdapter : NSObject <RTC_OBJC_TYPE (RTCVideoCapturerDelegate)>
23 @end
24 
25 namespace webrtc {
26 
27 class ObjCVideoTrackSource : public rtc::AdaptedVideoTrackSource {
28  public:
29   ObjCVideoTrackSource();
30   explicit ObjCVideoTrackSource(RTCObjCVideoSourceAdapter* adapter);
31 
32   // This class can not be used for implementing screen casting. Hopefully, this
33   // function will be removed before we add that to iOS/Mac.
34   bool is_screencast() const override;
35 
36   // Indicates that the encoder should denoise video before encoding it.
37   // If it is not set, the default configuration is used which is different
38   // depending on video codec.
39   absl::optional<bool> needs_denoising() const override;
40 
41   SourceState state() const override;
42 
43   bool remote() const override;
44 
45   void OnCapturedFrame(RTC_OBJC_TYPE(RTCVideoFrame) * frame);
46 
47   // Called by RTCVideoSource.
48   void OnOutputFormatRequest(int width, int height, int fps);
49 
50  private:
51   rtc::VideoBroadcaster broadcaster_;
52   rtc::TimestampAligner timestamp_aligner_;
53 
54   RTCObjCVideoSourceAdapter* adapter_;
55 };
56 
57 }  // namespace webrtc
58 
59 #endif  // SDK_OBJC_CLASSES_VIDEO_OBJC_VIDEO_TRACK_SOURCE_H_
60