OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // The destructor is protected to prevent deletion via the interface. | 133 // The destructor is protected to prevent deletion via the interface. |
134 // This is so that we allow reference counted classes, where the destructor | 134 // This is so that we allow reference counted classes, where the destructor |
135 // should never be public, to implement the interface. | 135 // should never be public, to implement the interface. |
136 virtual ~VideoRendererInterface() {} | 136 virtual ~VideoRendererInterface() {} |
137 }; | 137 }; |
138 | 138 |
139 class VideoSourceInterface; | 139 class VideoSourceInterface; |
140 | 140 |
141 class VideoTrackInterface : public MediaStreamTrackInterface { | 141 class VideoTrackInterface : public MediaStreamTrackInterface { |
142 public: | 142 public: |
143 // Register a renderer that will render all frames received on this track. | 143 // Backwards compatibility wrappers |
144 virtual void AddRenderer(VideoRendererInterface* renderer) = 0; | 144 virtual void AddRenderer(VideoRendererInterface* renderer) { |
145 // Deregister a renderer. | 145 AddSink(renderer); |
146 virtual void RemoveRenderer(VideoRendererInterface* renderer) = 0; | 146 } |
147 | 147 virtual void RemoveRenderer(VideoRendererInterface* renderer) { |
| 148 RemoveSink(renderer); |
| 149 } |
| 150 // Register a sink that will receive all frames received on this |
| 151 // track. Requires |sink| != nullptr. |
| 152 virtual void AddSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink) = 0; |
| 153 // Deregister a sink. Tolerates |sink| == nullptr. |
| 154 virtual void RemoveSink( |
| 155 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) = 0; |
148 virtual VideoSourceInterface* GetSource() const = 0; | 156 virtual VideoSourceInterface* GetSource() const = 0; |
149 | 157 |
150 protected: | 158 protected: |
151 virtual ~VideoTrackInterface() {} | 159 virtual ~VideoTrackInterface() {} |
152 }; | 160 }; |
153 | 161 |
154 // Interface for receiving audio data from a AudioTrack. | 162 // Interface for receiving audio data from a AudioTrack. |
155 class AudioTrackSinkInterface { | 163 class AudioTrackSinkInterface { |
156 public: | 164 public: |
157 virtual void OnData(const void* audio_data, | 165 virtual void OnData(const void* audio_data, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 virtual bool RemoveTrack(AudioTrackInterface* track) = 0; | 275 virtual bool RemoveTrack(AudioTrackInterface* track) = 0; |
268 virtual bool RemoveTrack(VideoTrackInterface* track) = 0; | 276 virtual bool RemoveTrack(VideoTrackInterface* track) = 0; |
269 | 277 |
270 protected: | 278 protected: |
271 virtual ~MediaStreamInterface() {} | 279 virtual ~MediaStreamInterface() {} |
272 }; | 280 }; |
273 | 281 |
274 } // namespace webrtc | 282 } // namespace webrtc |
275 | 283 |
276 #endif // TALK_APP_WEBRTC_MEDIASTREAMINTERFACE_H_ | 284 #endif // TALK_APP_WEBRTC_MEDIASTREAMINTERFACE_H_ |
OLD | NEW |