OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2010 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 |
(...skipping 11 matching lines...) Expand all Loading... | |
22 #include "webrtc/base/constructormagic.h" | 22 #include "webrtc/base/constructormagic.h" |
23 #include "webrtc/base/criticalsection.h" | 23 #include "webrtc/base/criticalsection.h" |
24 #include "webrtc/media/base/videosourceinterface.h" | 24 #include "webrtc/media/base/videosourceinterface.h" |
25 #include "webrtc/base/sigslot.h" | 25 #include "webrtc/base/sigslot.h" |
26 #include "webrtc/base/thread_checker.h" | 26 #include "webrtc/base/thread_checker.h" |
27 #include "webrtc/base/timestampaligner.h" | 27 #include "webrtc/base/timestampaligner.h" |
28 #include "webrtc/media/base/videoadapter.h" | 28 #include "webrtc/media/base/videoadapter.h" |
29 #include "webrtc/media/base/videobroadcaster.h" | 29 #include "webrtc/media/base/videobroadcaster.h" |
30 #include "webrtc/media/base/videocommon.h" | 30 #include "webrtc/media/base/videocommon.h" |
31 | 31 |
32 namespace webrtc { | |
33 class VideoFrame; | |
perkj_webrtc
2016/10/25 10:53:36
dito- prefer include if possible.
| |
34 } | |
32 | 35 |
33 namespace cricket { | 36 namespace cricket { |
34 | 37 |
35 // Current state of the capturer. | 38 // Current state of the capturer. |
36 enum CaptureState { | 39 enum CaptureState { |
37 CS_STOPPED, // The capturer has been stopped or hasn't started yet. | 40 CS_STOPPED, // The capturer has been stopped or hasn't started yet. |
38 CS_STARTING, // The capturer is in the process of starting. Note, it may | 41 CS_STARTING, // The capturer is in the process of starting. Note, it may |
39 // still fail to start. | 42 // still fail to start. |
40 CS_RUNNING, // The capturer has been started successfully and is now | 43 CS_RUNNING, // The capturer has been started successfully and is now |
41 // capturing. | 44 // capturing. |
(...skipping 20 matching lines...) Expand all Loading... | |
62 // Start() | 65 // Start() |
63 // GetCaptureFormat() optionally | 66 // GetCaptureFormat() optionally |
64 // Stop() | 67 // Stop() |
65 // | 68 // |
66 // Assumption: | 69 // Assumption: |
67 // The Start() and Stop() methods are called by a single thread (E.g., the | 70 // The Start() and Stop() methods are called by a single thread (E.g., the |
68 // media engine thread). Hence, the VideoCapture subclasses dont need to be | 71 // media engine thread). Hence, the VideoCapture subclasses dont need to be |
69 // thread safe. | 72 // thread safe. |
70 // | 73 // |
71 class VideoCapturer : public sigslot::has_slots<>, | 74 class VideoCapturer : public sigslot::has_slots<>, |
72 public rtc::VideoSourceInterface<cricket::VideoFrame> { | 75 public rtc::VideoSourceInterface<webrtc::VideoFrame> { |
73 public: | 76 public: |
74 VideoCapturer(); | 77 VideoCapturer(); |
75 | 78 |
76 virtual ~VideoCapturer() {} | 79 virtual ~VideoCapturer() {} |
77 | 80 |
78 // Gets the id of the underlying device, which is available after the capturer | 81 // Gets the id of the underlying device, which is available after the capturer |
79 // is initialized. Can be used to determine if two capturers reference the | 82 // is initialized. Can be used to determine if two capturers reference the |
80 // same device. | 83 // same device. |
81 const std::string& GetId() const { return id_; } | 84 const std::string& GetId() const { return id_; } |
82 | 85 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 // and users must call video_adapter()->OnOutputFormatRequest() | 177 // and users must call video_adapter()->OnOutputFormatRequest() |
175 // to receive frames. | 178 // to receive frames. |
176 bool enable_video_adapter() const { return enable_video_adapter_; } | 179 bool enable_video_adapter() const { return enable_video_adapter_; } |
177 void set_enable_video_adapter(bool enable_video_adapter) { | 180 void set_enable_video_adapter(bool enable_video_adapter) { |
178 enable_video_adapter_ = enable_video_adapter; | 181 enable_video_adapter_ = enable_video_adapter; |
179 } | 182 } |
180 | 183 |
181 bool GetInputSize(int* width, int* height); | 184 bool GetInputSize(int* width, int* height); |
182 | 185 |
183 // Implements VideoSourceInterface | 186 // Implements VideoSourceInterface |
184 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink, | 187 void AddOrUpdateSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink, |
185 const rtc::VideoSinkWants& wants) override; | 188 const rtc::VideoSinkWants& wants) override; |
186 void RemoveSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override; | 189 void RemoveSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) override; |
187 | 190 |
188 protected: | 191 protected: |
189 // OnSinkWantsChanged can be overridden to change the default behavior | 192 // OnSinkWantsChanged can be overridden to change the default behavior |
190 // when a sink changes its VideoSinkWants by calling AddOrUpdateSink. | 193 // when a sink changes its VideoSinkWants by calling AddOrUpdateSink. |
191 virtual void OnSinkWantsChanged(const rtc::VideoSinkWants& wants); | 194 virtual void OnSinkWantsChanged(const rtc::VideoSinkWants& wants); |
192 | 195 |
193 // Reports the appropriate frame size after adaptation. Returns true | 196 // Reports the appropriate frame size after adaptation. Returns true |
194 // if a frame is wanted. Returns false if there are no interested | 197 // if a frame is wanted. Returns false if there are no interested |
195 // sinks, or if the VideoAdapter decides to drop the frame. | 198 // sinks, or if the VideoAdapter decides to drop the frame. |
196 | 199 |
(...skipping 18 matching lines...) Expand all Loading... | |
215 int* crop_width, | 218 int* crop_width, |
216 int* crop_height, | 219 int* crop_height, |
217 int* crop_x, | 220 int* crop_x, |
218 int* crop_y, | 221 int* crop_y, |
219 int64_t* translated_camera_time_us); | 222 int64_t* translated_camera_time_us); |
220 | 223 |
221 // Called when a frame has been captured and converted to a | 224 // Called when a frame has been captured and converted to a |
222 // VideoFrame. OnFrame can be called directly by an implementation | 225 // VideoFrame. OnFrame can be called directly by an implementation |
223 // that does not use SignalFrameCaptured or OnFrameCaptured. The | 226 // that does not use SignalFrameCaptured or OnFrameCaptured. The |
224 // orig_width and orig_height are used only to produce stats. | 227 // orig_width and orig_height are used only to produce stats. |
225 void OnFrame(const VideoFrame& frame, int orig_width, int orig_height); | 228 void OnFrame(const webrtc::VideoFrame& frame, |
229 int orig_width, | |
230 int orig_height); | |
226 | 231 |
227 VideoAdapter* video_adapter() { return &video_adapter_; } | 232 VideoAdapter* video_adapter() { return &video_adapter_; } |
228 | 233 |
229 void SetCaptureState(CaptureState state); | 234 void SetCaptureState(CaptureState state); |
230 | 235 |
231 // subclasses override this virtual method to provide a vector of fourccs, in | 236 // subclasses override this virtual method to provide a vector of fourccs, in |
232 // order of preference, that are expected by the media engine. | 237 // order of preference, that are expected by the media engine. |
233 virtual bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) = 0; | 238 virtual bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) = 0; |
234 | 239 |
235 // mutators to set private attributes | 240 // mutators to set private attributes |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 bool apply_rotation_; | 291 bool apply_rotation_; |
287 | 292 |
288 // State for the timestamp translation. | 293 // State for the timestamp translation. |
289 rtc::TimestampAligner timestamp_aligner_; | 294 rtc::TimestampAligner timestamp_aligner_; |
290 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer); | 295 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer); |
291 }; | 296 }; |
292 | 297 |
293 } // namespace cricket | 298 } // namespace cricket |
294 | 299 |
295 #endif // WEBRTC_MEDIA_BASE_VIDEOCAPTURER_H_ | 300 #endif // WEBRTC_MEDIA_BASE_VIDEOCAPTURER_H_ |
OLD | NEW |