blob: 1964cb48988ad7129477f3ccedcda3623b6b67e6 [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
kjellanderb24317b2016-02-10 07:54:43 -08002 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00003 *
kjellanderb24317b2016-02-10 07:54:43 -08004 * 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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00009 */
10
Henrik Kjellander15583c12016-02-10 10:53:12 +010011#ifndef WEBRTC_API_VIDEOTRACK_H_
12#define WEBRTC_API_VIDEOTRACK_H_
henrike@webrtc.org28e20752013-07-10 00:45:36 +000013
14#include <string>
15
Henrik Kjellander15583c12016-02-10 10:53:12 +010016#include "webrtc/api/mediastreamtrack.h"
17#include "webrtc/api/videosourceinterface.h"
18#include "webrtc/api/videotrackrenderers.h"
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000019#include "webrtc/base/scoped_ref_ptr.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000020
21namespace webrtc {
22
23class VideoTrack : public MediaStreamTrack<VideoTrackInterface> {
24 public:
nissedb25d2e2016-02-26 01:24:58 -080025 static rtc::scoped_refptr<VideoTrack> Create(const std::string& label,
26 VideoSourceInterface* source);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000027
nissedb25d2e2016-02-26 01:24:58 -080028 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink,
29 const rtc::VideoSinkWants& wants) override;
30 void RemoveSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override;
31
henrike@webrtc.org28e20752013-07-10 00:45:36 +000032 virtual VideoSourceInterface* GetSource() const {
33 return video_source_.get();
34 }
nisse8e8908a2016-02-05 01:52:15 -080035 rtc::VideoSinkInterface<cricket::VideoFrame>* GetSink() override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000036 virtual bool set_enabled(bool enable);
37 virtual std::string kind() const;
38
39 protected:
40 VideoTrack(const std::string& id, VideoSourceInterface* video_source);
41 ~VideoTrack();
42
43 private:
44 VideoTrackRenderers renderers_;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000045 rtc::scoped_refptr<VideoSourceInterface> video_source_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000046};
47
48} // namespace webrtc
49
Henrik Kjellander15583c12016-02-10 10:53:12 +010050#endif // WEBRTC_API_VIDEOTRACK_H_