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