2013-07-10 00:45:36 +00:00
|
|
|
/*
|
2016-02-10 07:54:43 -08:00
|
|
|
* Copyright 2012 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
|
|
|
*/
|
|
|
|
|
|
2016-02-10 10:53:12 +01:00
|
|
|
#ifndef WEBRTC_API_VIDEOTRACK_H_
|
|
|
|
|
#define WEBRTC_API_VIDEOTRACK_H_
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
#include <string>
|
2016-03-17 10:35:23 +01:00
|
|
|
#include <vector>
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2016-02-10 10:53:12 +01:00
|
|
|
#include "webrtc/api/mediastreamtrack.h"
|
2014-07-29 17:36:52 +00:00
|
|
|
#include "webrtc/base/scoped_ref_ptr.h"
|
2016-03-17 10:35:23 +01:00
|
|
|
#include "webrtc/base/thread_checker.h"
|
|
|
|
|
#include "webrtc/media/base/videosourcebase.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2016-03-17 10:35:23 +01:00
|
|
|
class VideoTrack : public MediaStreamTrack<VideoTrackInterface>,
|
2016-03-23 00:33:56 -07:00
|
|
|
public rtc::VideoSourceBase,
|
|
|
|
|
public ObserverInterface {
|
2013-07-10 00:45:36 +00:00
|
|
|
public:
|
2016-03-08 01:27:48 +01:00
|
|
|
static rtc::scoped_refptr<VideoTrack> Create(
|
|
|
|
|
const std::string& label,
|
|
|
|
|
VideoTrackSourceInterface* source);
|
2016-02-26 01:24:58 -08:00
|
|
|
|
|
|
|
|
void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink,
|
|
|
|
|
const rtc::VideoSinkWants& wants) override;
|
|
|
|
|
void RemoveSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2016-04-29 06:09:15 -07:00
|
|
|
VideoTrackSourceInterface* GetSource() const override {
|
2013-07-10 00:45:36 +00:00
|
|
|
return video_source_.get();
|
|
|
|
|
}
|
2016-04-29 06:09:15 -07:00
|
|
|
bool set_enabled(bool enable) override;
|
|
|
|
|
std::string kind() const override;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
protected:
|
2016-03-08 01:27:48 +01:00
|
|
|
VideoTrack(const std::string& id, VideoTrackSourceInterface* video_source);
|
2013-07-10 00:45:36 +00:00
|
|
|
~VideoTrack();
|
|
|
|
|
|
|
|
|
|
private:
|
2016-03-23 00:33:56 -07:00
|
|
|
// Implements ObserverInterface. Observes |video_source_| state.
|
|
|
|
|
void OnChanged() override;
|
|
|
|
|
|
2016-04-07 07:45:54 -07:00
|
|
|
rtc::ThreadChecker signaling_thread_checker_;
|
|
|
|
|
rtc::ThreadChecker worker_thread_checker_;
|
2016-03-08 01:27:48 +01:00
|
|
|
rtc::scoped_refptr<VideoTrackSourceInterface> video_source_;
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2016-02-10 10:53:12 +01:00
|
|
|
#endif // WEBRTC_API_VIDEOTRACK_H_
|