| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 161 } |
| 162 | 162 |
| 163 // Stop the video capturer. | 163 // Stop the video capturer. |
| 164 virtual void Stop() = 0; | 164 virtual void Stop() = 0; |
| 165 // Check if the video capturer is running. | 165 // Check if the video capturer is running. |
| 166 virtual bool IsRunning() = 0; | 166 virtual bool IsRunning() = 0; |
| 167 CaptureState capture_state() const { | 167 CaptureState capture_state() const { |
| 168 return capture_state_; | 168 return capture_state_; |
| 169 } | 169 } |
| 170 | 170 |
| 171 virtual bool GetApplyRotation() { return apply_rotation_; } | 171 virtual bool apply_rotation() { return apply_rotation_; } |
| 172 | 172 |
| 173 // Returns true if the capturer is screencasting. This can be used to | 173 // Returns true if the capturer is screencasting. This can be used to |
| 174 // implement screencast specific behavior. | 174 // implement screencast specific behavior. |
| 175 virtual bool IsScreencast() const = 0; | 175 virtual bool IsScreencast() const = 0; |
| 176 | 176 |
| 177 // Caps the VideoCapturer's format according to max_format. It can e.g. be | 177 // Caps the VideoCapturer's format according to max_format. It can e.g. be |
| 178 // used to prevent cameras from capturing at a resolution or framerate that | 178 // used to prevent cameras from capturing at a resolution or framerate that |
| 179 // the capturer is capable of but not performing satisfactorily at. | 179 // the capturer is capable of but not performing satisfactorily at. |
| 180 // The capping is an upper bound for each component of the capturing format. | 180 // The capping is an upper bound for each component of the capturing format. |
| 181 // The fourcc component is ignored. | 181 // The fourcc component is ignored. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 // Implements VideoSourceInterface | 215 // Implements VideoSourceInterface |
| 216 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink, | 216 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink, |
| 217 const rtc::VideoSinkWants& wants) override; | 217 const rtc::VideoSinkWants& wants) override; |
| 218 void RemoveSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override; | 218 void RemoveSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override; |
| 219 | 219 |
| 220 protected: | 220 protected: |
| 221 // OnSinkWantsChanged can be overridden to change the default behavior | 221 // OnSinkWantsChanged can be overridden to change the default behavior |
| 222 // when a sink changes its VideoSinkWants by calling AddOrUpdateSink. | 222 // when a sink changes its VideoSinkWants by calling AddOrUpdateSink. |
| 223 virtual void OnSinkWantsChanged(const rtc::VideoSinkWants& wants); | 223 virtual void OnSinkWantsChanged(const rtc::VideoSinkWants& wants); |
| 224 | 224 |
| 225 // Reports the appropriate frame size after adaptation. Returns true |
| 226 // if a frame is wanted. Returns false if there are no interested |
| 227 // sinks, or if the VideoAdapter decides to drop the frame. |
| 228 bool AdaptFrame(int width, |
| 229 int height, |
| 230 int64_t capture_time_ns, |
| 231 int* out_width, |
| 232 int* out_height, |
| 233 int* crop_width, |
| 234 int* crop_height, |
| 235 int* crop_x, |
| 236 int* crop_y); |
| 237 |
| 225 // Callback attached to SignalFrameCaptured where SignalVideoFrames is called. | 238 // Callback attached to SignalFrameCaptured where SignalVideoFrames is called. |
| 226 void OnFrameCaptured(VideoCapturer* video_capturer, | 239 void OnFrameCaptured(VideoCapturer* video_capturer, |
| 227 const CapturedFrame* captured_frame); | 240 const CapturedFrame* captured_frame); |
| 228 | 241 |
| 229 // Called when a frame has been captured and converted to a VideoFrame. | 242 // Called when a frame has been captured and converted to a |
| 230 // OnFrame can be called directly by an implementation that does not use | 243 // VideoFrame. OnFrame can be called directly by an implementation |
| 231 // SignalFrameCaptured or OnFrameCaptured. | 244 // that does not use SignalFrameCaptured or OnFrameCaptured. The |
| 232 void OnFrame(VideoCapturer* capturer, const VideoFrame* frame); | 245 // orig_width and orig_height are used only to produce stats. |
| 246 void OnFrame(const VideoFrame& frame, int orig_width, int orig_height); |
| 233 | 247 |
| 234 VideoAdapter* video_adapter() { return &video_adapter_; } | 248 VideoAdapter* video_adapter() { return &video_adapter_; } |
| 235 | 249 |
| 236 void SetCaptureState(CaptureState state); | 250 void SetCaptureState(CaptureState state); |
| 237 | 251 |
| 238 // subclasses override this virtual method to provide a vector of fourccs, in | 252 // subclasses override this virtual method to provide a vector of fourccs, in |
| 239 // order of preference, that are expected by the media engine. | 253 // order of preference, that are expected by the media engine. |
| 240 virtual bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) = 0; | 254 virtual bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) = 0; |
| 241 | 255 |
| 242 // mutators to set private attributes | 256 // mutators to set private attributes |
| (...skipping 18 matching lines...) Expand all Loading... |
| 261 | 275 |
| 262 // Convert captured frame to readable string for LOG messages. | 276 // Convert captured frame to readable string for LOG messages. |
| 263 std::string ToString(const CapturedFrame* frame) const; | 277 std::string ToString(const CapturedFrame* frame) const; |
| 264 | 278 |
| 265 // Updates filtered_supported_formats_ so that it contains the formats in | 279 // Updates filtered_supported_formats_ so that it contains the formats in |
| 266 // supported_formats_ that fulfill all applied restrictions. | 280 // supported_formats_ that fulfill all applied restrictions. |
| 267 void UpdateFilteredSupportedFormats(); | 281 void UpdateFilteredSupportedFormats(); |
| 268 // Returns true if format doesn't fulfill all applied restrictions. | 282 // Returns true if format doesn't fulfill all applied restrictions. |
| 269 bool ShouldFilterFormat(const VideoFormat& format) const; | 283 bool ShouldFilterFormat(const VideoFormat& format) const; |
| 270 | 284 |
| 271 void UpdateInputSize(const CapturedFrame* captured_frame); | 285 void UpdateInputSize(int width, int height); |
| 272 | 286 |
| 273 rtc::ThreadChecker thread_checker_; | 287 rtc::ThreadChecker thread_checker_; |
| 274 std::string id_; | 288 std::string id_; |
| 275 CaptureState capture_state_; | 289 CaptureState capture_state_; |
| 276 std::unique_ptr<VideoFrameFactory> frame_factory_; | 290 std::unique_ptr<VideoFrameFactory> frame_factory_; |
| 277 std::unique_ptr<VideoFormat> capture_format_; | 291 std::unique_ptr<VideoFormat> capture_format_; |
| 278 std::vector<VideoFormat> supported_formats_; | 292 std::vector<VideoFormat> supported_formats_; |
| 279 std::unique_ptr<VideoFormat> max_format_; | 293 std::unique_ptr<VideoFormat> max_format_; |
| 280 std::vector<VideoFormat> filtered_supported_formats_; | 294 std::vector<VideoFormat> filtered_supported_formats_; |
| 281 | 295 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 295 | 309 |
| 296 // Whether capturer should apply rotation to the frame before signaling it. | 310 // Whether capturer should apply rotation to the frame before signaling it. |
| 297 bool apply_rotation_; | 311 bool apply_rotation_; |
| 298 | 312 |
| 299 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer); | 313 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer); |
| 300 }; | 314 }; |
| 301 | 315 |
| 302 } // namespace cricket | 316 } // namespace cricket |
| 303 | 317 |
| 304 #endif // WEBRTC_MEDIA_BASE_VIDEOCAPTURER_H_ | 318 #endif // WEBRTC_MEDIA_BASE_VIDEOCAPTURER_H_ |
| OLD | NEW |