blob: 3e319fcc3c1824bcb373d9ec637f994d7ed35727 [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_VIDEOSOURCEINTERFACE_H_
12#define WEBRTC_API_VIDEOSOURCEINTERFACE_H_
henrike@webrtc.org28e20752013-07-10 00:45:36 +000013
Henrik Kjellander15583c12016-02-10 10:53:12 +010014#include "webrtc/api/mediastreaminterface.h"
kjellandera96e2d72016-02-04 23:52:28 -080015#include "webrtc/media/base/mediachannel.h"
16#include "webrtc/media/base/videorenderer.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000017
18namespace webrtc {
19
20// VideoSourceInterface is a reference counted source used for VideoTracks.
21// The same source can be used in multiple VideoTracks.
22// The methods are only supposed to be called by the PeerConnection
23// implementation.
24class VideoSourceInterface : public MediaSourceInterface {
25 public:
26 // Get access to the source implementation of cricket::VideoCapturer.
27 // This can be used for receiving frames and state notifications.
28 // But it should not be used for starting or stopping capturing.
29 virtual cricket::VideoCapturer* GetVideoCapturer() = 0;
perkj@webrtc.org8f605e82015-02-17 13:53:56 +000030
31 // Stop the video capturer.
perkj@webrtc.org60f9d6f2015-03-02 11:33:20 +000032 virtual void Stop() = 0;
33 virtual void Restart() = 0;
perkj@webrtc.org8f605e82015-02-17 13:53:56 +000034
henrike@webrtc.org28e20752013-07-10 00:45:36 +000035 // Adds |output| to the source to receive frames.
nisse8cb910d2016-02-04 01:01:54 -080036 virtual void AddSink(
37 rtc::VideoSinkInterface<cricket::VideoFrame>* output) = 0;
nissee73afba2016-01-28 04:47:08 -080038 virtual void RemoveSink(
nisse8cb910d2016-02-04 01:01:54 -080039 rtc::VideoSinkInterface<cricket::VideoFrame>* output) = 0;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000040 virtual const cricket::VideoOptions* options() const = 0;
nisse8e8908a2016-02-05 01:52:15 -080041 // TODO(nisse): Dummy implementation. Delete as soon as chrome's
42 // MockVideoSource is updated.
43 virtual cricket::VideoRenderer* FrameInput() { return nullptr; }
henrike@webrtc.org28e20752013-07-10 00:45:36 +000044
45 protected:
46 virtual ~VideoSourceInterface() {}
47};
48
49} // namespace webrtc
50
Henrik Kjellander15583c12016-02-10 10:53:12 +010051#endif // WEBRTC_API_VIDEOSOURCEINTERFACE_H_