| 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 // This file contains interfaces for MediaStream, MediaTrack and MediaSource. | 11 // This file contains interfaces for MediaStream, MediaTrack and MediaSource. |
| 12 // These interfaces are used for implementing MediaStream and MediaTrack as | 12 // These interfaces are used for implementing MediaStream and MediaTrack as |
| 13 // defined in http://dev.w3.org/2011/webrtc/editor/webrtc.html#stream-api. These | 13 // defined in http://dev.w3.org/2011/webrtc/editor/webrtc.html#stream-api. These |
| 14 // interfaces must be used only with PeerConnection. PeerConnectionManager | 14 // interfaces must be used only with PeerConnection. PeerConnectionManager |
| 15 // interface provides the factory methods to create MediaStream and MediaTracks. | 15 // interface provides the factory methods to create MediaStream and MediaTracks. |
| 16 | 16 |
| 17 #ifndef WEBRTC_API_MEDIASTREAMINTERFACE_H_ | 17 #ifndef WEBRTC_API_MEDIASTREAMINTERFACE_H_ |
| 18 #define WEBRTC_API_MEDIASTREAMINTERFACE_H_ | 18 #define WEBRTC_API_MEDIASTREAMINTERFACE_H_ |
| 19 | 19 |
| 20 #include <string> | 20 #include <string> |
| 21 #include <vector> | 21 #include <vector> |
| 22 | 22 |
| 23 #include "webrtc/base/basictypes.h" | 23 #include "webrtc/base/basictypes.h" |
| 24 #include "webrtc/base/refcount.h" | 24 #include "webrtc/base/refcount.h" |
| 25 #include "webrtc/base/scoped_ref_ptr.h" | 25 #include "webrtc/base/scoped_ref_ptr.h" |
| 26 #include "webrtc/base/optional.h" | 26 #include "webrtc/base/optional.h" |
| 27 #include "webrtc/media/base/mediachannel.h" | 27 #include "webrtc/media/base/mediachannel.h" |
| 28 #include "webrtc/media/base/videoframe.h" |
| 28 #include "webrtc/media/base/videosinkinterface.h" | 29 #include "webrtc/media/base/videosinkinterface.h" |
| 29 #include "webrtc/media/base/videosourceinterface.h" | 30 #include "webrtc/media/base/videosourceinterface.h" |
| 30 #include "webrtc/video_frame.h" | |
| 31 | 31 |
| 32 namespace webrtc { | 32 namespace webrtc { |
| 33 | 33 |
| 34 // Generic observer interface. | 34 // Generic observer interface. |
| 35 class ObserverInterface { | 35 class ObserverInterface { |
| 36 public: | 36 public: |
| 37 virtual void OnChanged() = 0; | 37 virtual void OnChanged() = 0; |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 virtual ~ObserverInterface() {} | 40 virtual ~ObserverInterface() {} |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 virtual bool set_enabled(bool enable) = 0; | 91 virtual bool set_enabled(bool enable) = 0; |
| 92 | 92 |
| 93 protected: | 93 protected: |
| 94 virtual ~MediaStreamTrackInterface() {} | 94 virtual ~MediaStreamTrackInterface() {} |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 // VideoTrackSourceInterface is a reference counted source used for VideoTracks. | 97 // VideoTrackSourceInterface is a reference counted source used for VideoTracks. |
| 98 // The same source can be used in multiple VideoTracks. | 98 // The same source can be used in multiple VideoTracks. |
| 99 class VideoTrackSourceInterface | 99 class VideoTrackSourceInterface |
| 100 : public MediaSourceInterface, | 100 : public MediaSourceInterface, |
| 101 public rtc::VideoSourceInterface<VideoFrame> { | 101 public rtc::VideoSourceInterface<cricket::VideoFrame> { |
| 102 public: | 102 public: |
| 103 struct Stats { | 103 struct Stats { |
| 104 // Original size of captured frame, before video adaptation. | 104 // Original size of captured frame, before video adaptation. |
| 105 int input_width; | 105 int input_width; |
| 106 int input_height; | 106 int input_height; |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 // Indicates that parameters suitable for screencasts should be automatically | 109 // Indicates that parameters suitable for screencasts should be automatically |
| 110 // applied to RtpSenders. | 110 // applied to RtpSenders. |
| 111 // TODO(perkj): Remove these once all known applications have moved to | 111 // TODO(perkj): Remove these once all known applications have moved to |
| (...skipping 12 matching lines...) Expand all Loading... |
| 124 // source, or a source which has not seen its first frame yet. | 124 // source, or a source which has not seen its first frame yet. |
| 125 // Should avoid blocking. | 125 // Should avoid blocking. |
| 126 virtual bool GetStats(Stats* stats) = 0; | 126 virtual bool GetStats(Stats* stats) = 0; |
| 127 | 127 |
| 128 protected: | 128 protected: |
| 129 virtual ~VideoTrackSourceInterface() {} | 129 virtual ~VideoTrackSourceInterface() {} |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 class VideoTrackInterface | 132 class VideoTrackInterface |
| 133 : public MediaStreamTrackInterface, | 133 : public MediaStreamTrackInterface, |
| 134 public rtc::VideoSourceInterface<VideoFrame> { | 134 public rtc::VideoSourceInterface<cricket::VideoFrame> { |
| 135 public: | 135 public: |
| 136 // Register a video sink for this track. | 136 // Register a video sink for this track. |
| 137 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, | 137 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink, |
| 138 const rtc::VideoSinkWants& wants) override{}; | 138 const rtc::VideoSinkWants& wants) override{}; |
| 139 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override{}; | 139 void RemoveSink( |
| 140 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override{}; |
| 140 | 141 |
| 141 virtual VideoTrackSourceInterface* GetSource() const = 0; | 142 virtual VideoTrackSourceInterface* GetSource() const = 0; |
| 142 | 143 |
| 143 protected: | 144 protected: |
| 144 virtual ~VideoTrackInterface() {} | 145 virtual ~VideoTrackInterface() {} |
| 145 }; | 146 }; |
| 146 | 147 |
| 147 // Interface for receiving audio data from a AudioTrack. | 148 // Interface for receiving audio data from a AudioTrack. |
| 148 class AudioTrackSinkInterface { | 149 class AudioTrackSinkInterface { |
| 149 public: | 150 public: |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 virtual bool RemoveTrack(AudioTrackInterface* track) = 0; | 265 virtual bool RemoveTrack(AudioTrackInterface* track) = 0; |
| 265 virtual bool RemoveTrack(VideoTrackInterface* track) = 0; | 266 virtual bool RemoveTrack(VideoTrackInterface* track) = 0; |
| 266 | 267 |
| 267 protected: | 268 protected: |
| 268 virtual ~MediaStreamInterface() {} | 269 virtual ~MediaStreamInterface() {} |
| 269 }; | 270 }; |
| 270 | 271 |
| 271 } // namespace webrtc | 272 } // namespace webrtc |
| 272 | 273 |
| 273 #endif // WEBRTC_API_MEDIASTREAMINTERFACE_H_ | 274 #endif // WEBRTC_API_MEDIASTREAMINTERFACE_H_ |
| OLD | NEW |