2013-07-10 00:45:36 +00:00
|
|
|
/*
|
2016-02-10 07:54:43 -08:00
|
|
|
* Copyright 2011 The WebRTC project authors. All Rights Reserved.
|
2013-07-10 00:45:36 +00:00
|
|
|
*
|
2016-02-10 07:54:43 -08:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2013-07-10 00:45:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// This file contains the implementation of MediaStreamInterface interface.
|
|
|
|
|
|
2016-02-10 10:53:12 +01:00
|
|
|
#ifndef WEBRTC_API_MEDIASTREAM_H_
|
|
|
|
|
#define WEBRTC_API_MEDIASTREAM_H_
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2016-02-10 10:53:12 +01:00
|
|
|
#include "webrtc/api/mediastreaminterface.h"
|
|
|
|
|
#include "webrtc/api/notifier.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
class MediaStream : public Notifier<MediaStreamInterface> {
|
|
|
|
|
public:
|
2014-07-29 17:36:52 +00:00
|
|
|
static rtc::scoped_refptr<MediaStream> Create(const std::string& label);
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-03-04 12:58:35 +00:00
|
|
|
std::string label() const override { return label_; }
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-03-04 12:58:35 +00:00
|
|
|
bool AddTrack(AudioTrackInterface* track) override;
|
|
|
|
|
bool AddTrack(VideoTrackInterface* track) override;
|
|
|
|
|
bool RemoveTrack(AudioTrackInterface* track) override;
|
|
|
|
|
bool RemoveTrack(VideoTrackInterface* track) override;
|
2016-04-29 06:09:15 -07:00
|
|
|
rtc::scoped_refptr<AudioTrackInterface>
|
|
|
|
|
FindAudioTrack(const std::string& track_id) override;
|
|
|
|
|
rtc::scoped_refptr<VideoTrackInterface>
|
|
|
|
|
FindVideoTrack(const std::string& track_id) override;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-03-04 12:58:35 +00:00
|
|
|
AudioTrackVector GetAudioTracks() override { return audio_tracks_; }
|
|
|
|
|
VideoTrackVector GetVideoTracks() override { return video_tracks_; }
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
explicit MediaStream(const std::string& label);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
template <typename TrackVector, typename Track>
|
|
|
|
|
bool AddTrack(TrackVector* Tracks, Track* track);
|
|
|
|
|
template <typename TrackVector>
|
|
|
|
|
bool RemoveTrack(TrackVector* Tracks, MediaStreamTrackInterface* track);
|
|
|
|
|
|
|
|
|
|
std::string label_;
|
|
|
|
|
AudioTrackVector audio_tracks_;
|
|
|
|
|
VideoTrackVector video_tracks_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2016-02-10 10:53:12 +01:00
|
|
|
#endif // WEBRTC_API_MEDIASTREAM_H_
|