OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_API_VIDEOSOURCEINTERFACE_H_ | 11 #ifndef WEBRTC_API_VIDEOSOURCEINTERFACE_H_ |
12 #define WEBRTC_API_VIDEOSOURCEINTERFACE_H_ | 12 #define WEBRTC_API_VIDEOSOURCEINTERFACE_H_ |
13 | 13 |
14 #include "webrtc/api/mediastreaminterface.h" | 14 #include "webrtc/api/mediastreaminterface.h" |
15 #include "webrtc/media/base/mediachannel.h" | 15 #include "webrtc/media/base/mediachannel.h" |
16 #include "webrtc/media/base/videorenderer.h" | 16 #include "webrtc/media/base/videosourceinterface.h" |
17 | 17 |
18 namespace webrtc { | 18 namespace webrtc { |
19 | 19 |
20 // VideoSourceInterface is a reference counted source used for VideoTracks. | 20 // VideoSourceInterface is a reference counted source used for VideoTracks. |
21 // The same source can be used in multiple VideoTracks. | 21 // The same source can be used in multiple VideoTracks. |
22 // The methods are only supposed to be called by the PeerConnection | 22 // The methods are only supposed to be called by the PeerConnection |
23 // implementation. | 23 // implementation. |
24 class VideoSourceInterface : public MediaSourceInterface { | 24 class VideoSourceInterface : |
| 25 public MediaSourceInterface, |
| 26 public rtc::VideoSourceInterface<cricket::VideoFrame> { |
25 public: | 27 public: |
26 // Get access to the source implementation of cricket::VideoCapturer. | 28 // Get access to the source implementation of cricket::VideoCapturer. |
27 // This can be used for receiving frames and state notifications. | 29 // This can be used for receiving frames and state notifications. |
28 // But it should not be used for starting or stopping capturing. | 30 // But it should not be used for starting or stopping capturing. |
29 virtual cricket::VideoCapturer* GetVideoCapturer() = 0; | 31 virtual cricket::VideoCapturer* GetVideoCapturer() = 0; |
30 | 32 |
31 // Stop the video capturer. | |
32 virtual void Stop() = 0; | 33 virtual void Stop() = 0; |
33 virtual void Restart() = 0; | 34 virtual void Restart() = 0; |
34 | 35 |
35 // Adds |output| to the source to receive frames. | |
36 virtual void AddSink( | |
37 rtc::VideoSinkInterface<cricket::VideoFrame>* output) = 0; | |
38 virtual void RemoveSink( | |
39 rtc::VideoSinkInterface<cricket::VideoFrame>* output) = 0; | |
40 virtual const cricket::VideoOptions* options() const = 0; | 36 virtual const cricket::VideoOptions* options() const = 0; |
41 // TODO(nisse): Dummy implementation. Delete as soon as chrome's | |
42 // MockVideoSource is updated. | |
43 virtual cricket::VideoRenderer* FrameInput() { return nullptr; } | |
44 | 37 |
45 protected: | 38 protected: |
46 virtual ~VideoSourceInterface() {} | 39 virtual ~VideoSourceInterface() {} |
47 }; | 40 }; |
48 | 41 |
| 42 // TODO(perkj): Rename webrtc::VideoSourceInterface to |
| 43 // webrtc::VideoTrackSourceInterface |
| 44 using VideoTrackSourceInterface = VideoSourceInterface; |
| 45 |
49 } // namespace webrtc | 46 } // namespace webrtc |
50 | 47 |
51 #endif // WEBRTC_API_VIDEOSOURCEINTERFACE_H_ | 48 #endif // WEBRTC_API_VIDEOSOURCEINTERFACE_H_ |
OLD | NEW |