henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 2 | * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 4 | * 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.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 11 | #ifndef WEBRTC_API_VIDEOSOURCEINTERFACE_H_ |
| 12 | #define WEBRTC_API_VIDEOSOURCEINTERFACE_H_ |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 13 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 14 | #include "webrtc/api/mediastreaminterface.h" |
kjellander | a96e2d7 | 2016-02-04 23:52:28 -0800 | [diff] [blame] | 15 | #include "webrtc/media/base/mediachannel.h" |
| 16 | #include "webrtc/media/base/videorenderer.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 17 | |
| 18 | namespace 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. |
| 24 | class 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.org | 8f605e8 | 2015-02-17 13:53:56 +0000 | [diff] [blame] | 30 | |
| 31 | // Stop the video capturer. |
perkj@webrtc.org | 60f9d6f | 2015-03-02 11:33:20 +0000 | [diff] [blame] | 32 | virtual void Stop() = 0; |
| 33 | virtual void Restart() = 0; |
perkj@webrtc.org | 8f605e8 | 2015-02-17 13:53:56 +0000 | [diff] [blame] | 34 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 35 | // Adds |output| to the source to receive frames. |
nisse | 8cb910d | 2016-02-04 01:01:54 -0800 | [diff] [blame] | 36 | virtual void AddSink( |
| 37 | rtc::VideoSinkInterface<cricket::VideoFrame>* output) = 0; |
nisse | e73afba | 2016-01-28 04:47:08 -0800 | [diff] [blame] | 38 | virtual void RemoveSink( |
nisse | 8cb910d | 2016-02-04 01:01:54 -0800 | [diff] [blame] | 39 | rtc::VideoSinkInterface<cricket::VideoFrame>* output) = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 40 | virtual const cricket::VideoOptions* options() const = 0; |
nisse | 8e8908a | 2016-02-05 01:52:15 -0800 | [diff] [blame] | 41 | // TODO(nisse): Dummy implementation. Delete as soon as chrome's |
| 42 | // MockVideoSource is updated. |
| 43 | virtual cricket::VideoRenderer* FrameInput() { return nullptr; } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 44 | |
| 45 | protected: |
| 46 | virtual ~VideoSourceInterface() {} |
| 47 | }; |
| 48 | |
| 49 | } // namespace webrtc |
| 50 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 51 | #endif // WEBRTC_API_VIDEOSOURCEINTERFACE_H_ |