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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 class NotifierInterface { | 64 class NotifierInterface { |
65 public: | 65 public: |
66 virtual void RegisterObserver(ObserverInterface* observer) = 0; | 66 virtual void RegisterObserver(ObserverInterface* observer) = 0; |
67 virtual void UnregisterObserver(ObserverInterface* observer) = 0; | 67 virtual void UnregisterObserver(ObserverInterface* observer) = 0; |
68 | 68 |
69 virtual ~NotifierInterface() {} | 69 virtual ~NotifierInterface() {} |
70 }; | 70 }; |
71 | 71 |
72 // Base class for sources. A MediaStreamTrack have an underlying source that | 72 // Base class for sources. A MediaStreamTrack have an underlying source that |
73 // provide media. A source can be shared with multiple tracks. | 73 // provide media. A source can be shared with multiple tracks. |
74 // TODO(perkj): Implement sources for local and remote audio tracks and | 74 // TODO(perkj): Implement sources for local and remote audio tracks and |
perkj_webrtc
2015/12/15 10:15:31
Remove this todo please.
tommi
2015/12/15 11:00:54
Done.
| |
75 // remote video tracks. | 75 // remote video tracks. |
76 class MediaSourceInterface : public rtc::RefCountInterface, | 76 class MediaSourceInterface : public rtc::RefCountInterface, |
77 public NotifierInterface { | 77 public NotifierInterface { |
78 public: | 78 public: |
79 enum SourceState { | 79 enum SourceState { |
80 kInitializing, | 80 kInitializing, |
81 kLive, | 81 kLive, |
82 kEnded, | 82 kEnded, |
83 kMuted | 83 kMuted |
84 }; | 84 }; |
85 | 85 |
86 virtual SourceState state() const = 0; | 86 virtual SourceState state() const = 0; |
87 | 87 |
88 virtual bool remote() const = 0; | |
89 | |
88 protected: | 90 protected: |
89 virtual ~MediaSourceInterface() {} | 91 virtual ~MediaSourceInterface() {} |
90 }; | 92 }; |
91 | 93 |
92 // Information about a track. | 94 // Information about a track. |
93 class MediaStreamTrackInterface : public rtc::RefCountInterface, | 95 class MediaStreamTrackInterface : public rtc::RefCountInterface, |
94 public NotifierInterface { | 96 public NotifierInterface { |
95 public: | 97 public: |
96 enum TrackState { | 98 enum TrackState { |
97 kInitializing, // Track is beeing negotiated. | 99 kInitializing, // Track is beeing negotiated. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 virtual void AddRenderer(VideoRendererInterface* renderer) = 0; | 147 virtual void AddRenderer(VideoRendererInterface* renderer) = 0; |
146 // Deregister a renderer. | 148 // Deregister a renderer. |
147 virtual void RemoveRenderer(VideoRendererInterface* renderer) = 0; | 149 virtual void RemoveRenderer(VideoRendererInterface* renderer) = 0; |
148 | 150 |
149 virtual VideoSourceInterface* GetSource() const = 0; | 151 virtual VideoSourceInterface* GetSource() const = 0; |
150 | 152 |
151 protected: | 153 protected: |
152 virtual ~VideoTrackInterface() {} | 154 virtual ~VideoTrackInterface() {} |
153 }; | 155 }; |
154 | 156 |
157 // Interface for receiving audio data from a AudioTrack. | |
158 class AudioTrackSinkInterface { | |
159 public: | |
160 virtual void OnData(const void* audio_data, | |
161 int bits_per_sample, | |
162 int sample_rate, | |
163 int number_of_channels, | |
164 size_t number_of_frames) = 0; | |
165 | |
166 protected: | |
167 virtual ~AudioTrackSinkInterface() {} | |
168 }; | |
169 | |
155 // AudioSourceInterface is a reference counted source used for AudioTracks. | 170 // AudioSourceInterface is a reference counted source used for AudioTracks. |
156 // The same source can be used in multiple AudioTracks. | 171 // The same source can be used in multiple AudioTracks. |
157 class AudioSourceInterface : public MediaSourceInterface { | 172 class AudioSourceInterface : public MediaSourceInterface { |
158 public: | 173 public: |
159 class AudioObserver { | 174 class AudioObserver { |
160 public: | 175 public: |
161 virtual void OnSetVolume(double volume) = 0; | 176 virtual void OnSetVolume(double volume) = 0; |
162 | 177 |
163 protected: | 178 protected: |
164 virtual ~AudioObserver() {} | 179 virtual ~AudioObserver() {} |
165 }; | 180 }; |
166 | 181 |
167 // TODO(xians): Makes all the interface pure virtual after Chrome has their | 182 // TODO(xians): Makes all the interface pure virtual after Chrome has their |
168 // implementations. | 183 // implementations. |
169 // Sets the volume to the source. |volume| is in the range of [0, 10]. | 184 // Sets the volume to the source. |volume| is in the range of [0, 10]. |
170 // TODO(tommi): This method should be on the track and ideally volume should | 185 // TODO(tommi): This method should be on the track and ideally volume should |
171 // be applied in the track in a way that does not affect clones of the track. | 186 // be applied in the track in a way that does not affect clones of the track. |
172 virtual void SetVolume(double volume) {} | 187 virtual void SetVolume(double volume) {} |
173 | 188 |
174 // Registers/unregisters observer to the audio source. | 189 // Registers/unregisters observer to the audio source. |
175 virtual void RegisterAudioObserver(AudioObserver* observer) {} | 190 virtual void RegisterAudioObserver(AudioObserver* observer) {} |
176 virtual void UnregisterAudioObserver(AudioObserver* observer) {} | 191 virtual void UnregisterAudioObserver(AudioObserver* observer) {} |
177 }; | |
178 | 192 |
179 // Interface for receiving audio data from a AudioTrack. | 193 // TODO(tommi): Make pure virtual. |
180 class AudioTrackSinkInterface { | 194 virtual void AddSink(AudioTrackSinkInterface* sink) {} |
181 public: | 195 virtual void RemoveSink(AudioTrackSinkInterface* sink) {} |
182 virtual void OnData(const void* audio_data, | |
183 int bits_per_sample, | |
184 int sample_rate, | |
185 int number_of_channels, | |
186 size_t number_of_frames) = 0; | |
187 protected: | |
188 virtual ~AudioTrackSinkInterface() {} | |
189 }; | 196 }; |
190 | 197 |
191 // Interface of the audio processor used by the audio track to collect | 198 // Interface of the audio processor used by the audio track to collect |
192 // statistics. | 199 // statistics. |
193 class AudioProcessorInterface : public rtc::RefCountInterface { | 200 class AudioProcessorInterface : public rtc::RefCountInterface { |
194 public: | 201 public: |
195 struct AudioProcessorStats { | 202 struct AudioProcessorStats { |
196 AudioProcessorStats() : typing_noise_detected(false), | 203 AudioProcessorStats() : typing_noise_detected(false), |
197 echo_return_loss(0), | 204 echo_return_loss(0), |
198 echo_return_loss_enhancement(0), | 205 echo_return_loss_enhancement(0), |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 virtual bool RemoveTrack(AudioTrackInterface* track) = 0; | 276 virtual bool RemoveTrack(AudioTrackInterface* track) = 0; |
270 virtual bool RemoveTrack(VideoTrackInterface* track) = 0; | 277 virtual bool RemoveTrack(VideoTrackInterface* track) = 0; |
271 | 278 |
272 protected: | 279 protected: |
273 virtual ~MediaStreamInterface() {} | 280 virtual ~MediaStreamInterface() {} |
274 }; | 281 }; |
275 | 282 |
276 } // namespace webrtc | 283 } // namespace webrtc |
277 | 284 |
278 #endif // TALK_APP_WEBRTC_MEDIASTREAMINTERFACE_H_ | 285 #endif // TALK_APP_WEBRTC_MEDIASTREAMINTERFACE_H_ |
OLD | NEW |