OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 virtual bool enabled() const = 0; | 94 virtual bool enabled() const = 0; |
95 virtual TrackState state() const = 0; | 95 virtual TrackState state() const = 0; |
96 virtual bool set_enabled(bool enable) = 0; | 96 virtual bool set_enabled(bool enable) = 0; |
97 // These methods should be called by implementation only. | 97 // These methods should be called by implementation only. |
98 virtual bool set_state(TrackState new_state) = 0; | 98 virtual bool set_state(TrackState new_state) = 0; |
99 | 99 |
100 protected: | 100 protected: |
101 virtual ~MediaStreamTrackInterface() {} | 101 virtual ~MediaStreamTrackInterface() {} |
102 }; | 102 }; |
103 | 103 |
104 // Interface for rendering VideoFrames from a VideoTrack | |
105 class VideoRendererInterface | |
106 : public rtc::VideoSinkInterface<cricket::VideoFrame> { | |
107 public: | |
108 // |frame| may have pending rotation. For clients which can't apply rotation, | |
109 // |frame|->GetCopyWithRotationApplied() will return a frame that has the | |
110 // rotation applied. | |
111 virtual void RenderFrame(const cricket::VideoFrame* frame) = 0; | |
112 // Intended to replace RenderFrame. | |
113 void OnFrame(const cricket::VideoFrame& frame) override { | |
114 RenderFrame(&frame); | |
115 } | |
116 | |
117 protected: | |
118 // The destructor is protected to prevent deletion via the interface. | |
119 // This is so that we allow reference counted classes, where the destructor | |
120 // should never be public, to implement the interface. | |
121 virtual ~VideoRendererInterface() {} | |
122 }; | |
123 | |
124 // VideoTrackSourceInterface is a reference counted source used for VideoTracks. | 104 // VideoTrackSourceInterface is a reference counted source used for VideoTracks. |
125 // The same source can be used in multiple VideoTracks. | 105 // The same source can be used in multiple VideoTracks. |
126 class VideoTrackSourceInterface | 106 class VideoTrackSourceInterface |
127 : public MediaSourceInterface, | 107 : public MediaSourceInterface, |
128 public rtc::VideoSourceInterface<cricket::VideoFrame> { | 108 public rtc::VideoSourceInterface<cricket::VideoFrame> { |
129 public: | 109 public: |
130 // Get access to the source implementation of cricket::VideoCapturer. | 110 // Get access to the source implementation of cricket::VideoCapturer. |
131 // This can be used for receiving frames and state notifications. | 111 // This can be used for receiving frames and state notifications. |
132 // But it should not be used for starting or stopping capturing. | 112 // But it should not be used for starting or stopping capturing. |
133 // TODO(perkj): We are currently trying to replace all internal use of | 113 // TODO(perkj): We are currently trying to replace all internal use of |
(...skipping 18 matching lines...) Expand all Loading... |
152 virtual bool needs_denoising() const = 0; | 132 virtual bool needs_denoising() const = 0; |
153 | 133 |
154 protected: | 134 protected: |
155 virtual ~VideoTrackSourceInterface() {} | 135 virtual ~VideoTrackSourceInterface() {} |
156 }; | 136 }; |
157 | 137 |
158 class VideoTrackInterface | 138 class VideoTrackInterface |
159 : public MediaStreamTrackInterface, | 139 : public MediaStreamTrackInterface, |
160 public rtc::VideoSourceInterface<cricket::VideoFrame> { | 140 public rtc::VideoSourceInterface<cricket::VideoFrame> { |
161 public: | 141 public: |
162 // AddRenderer and RemoveRenderer are for backwards compatibility | |
163 // only. They are obsoleted by the methods of | |
164 // rtc::VideoSourceInterface. | |
165 virtual void AddRenderer(VideoRendererInterface* renderer) { | |
166 AddOrUpdateSink(renderer, rtc::VideoSinkWants()); | |
167 } | |
168 virtual void RemoveRenderer(VideoRendererInterface* renderer) { | |
169 RemoveSink(renderer); | |
170 } | |
171 | |
172 // Register a video sink for this track. | 142 // Register a video sink for this track. |
173 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink, | 143 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink, |
174 const rtc::VideoSinkWants& wants) override{}; | 144 const rtc::VideoSinkWants& wants) override{}; |
175 void RemoveSink( | 145 void RemoveSink( |
176 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override{}; | 146 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override{}; |
177 | 147 |
178 virtual VideoTrackSourceInterface* GetSource() const = 0; | 148 virtual VideoTrackSourceInterface* GetSource() const = 0; |
179 | 149 |
180 protected: | 150 protected: |
181 virtual ~VideoTrackInterface() {} | 151 virtual ~VideoTrackInterface() {} |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 virtual bool RemoveTrack(AudioTrackInterface* track) = 0; | 267 virtual bool RemoveTrack(AudioTrackInterface* track) = 0; |
298 virtual bool RemoveTrack(VideoTrackInterface* track) = 0; | 268 virtual bool RemoveTrack(VideoTrackInterface* track) = 0; |
299 | 269 |
300 protected: | 270 protected: |
301 virtual ~MediaStreamInterface() {} | 271 virtual ~MediaStreamInterface() {} |
302 }; | 272 }; |
303 | 273 |
304 } // namespace webrtc | 274 } // namespace webrtc |
305 | 275 |
306 #endif // WEBRTC_API_MEDIASTREAMINTERFACE_H_ | 276 #endif // WEBRTC_API_MEDIASTREAMINTERFACE_H_ |
OLD | NEW |