| 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 int* out_width, |
| 231 int* out_height, |
| 232 int* crop_width, |
| 233 int* crop_height, |
| 234 int* crop_x, |
| 235 int* crop_y); |
| 236 |
| 225 // Callback attached to SignalFrameCaptured where SignalVideoFrames is called. | 237 // Callback attached to SignalFrameCaptured where SignalVideoFrames is called. |
| 226 void OnFrameCaptured(VideoCapturer* video_capturer, | 238 void OnFrameCaptured(VideoCapturer* video_capturer, |
| 227 const CapturedFrame* captured_frame); | 239 const CapturedFrame* captured_frame); |
| 228 | 240 |
| 229 // Called when a frame has been captured and converted to a VideoFrame. | 241 // Called when a frame has been captured and converted to a |
| 230 // OnFrame can be called directly by an implementation that does not use | 242 // VideoFrame. OnFrame can be called directly by an implementation |
| 231 // SignalFrameCaptured or OnFrameCaptured. | 243 // that does not use SignalFrameCaptured or OnFrameCaptured. The |
| 232 void OnFrame(VideoCapturer* capturer, const VideoFrame* frame); | 244 // orig_width and orig_height are used only to produce stats. |
| 245 void OnFrame(const VideoFrame& frame, int orig_width, int orig_height); |
| 233 | 246 |
| 234 VideoAdapter* video_adapter() { return &video_adapter_; } | 247 VideoAdapter* video_adapter() { return &video_adapter_; } |
| 235 | 248 |
| 236 void SetCaptureState(CaptureState state); | 249 void SetCaptureState(CaptureState state); |
| 237 | 250 |
| 238 // subclasses override this virtual method to provide a vector of fourccs, in | 251 // subclasses override this virtual method to provide a vector of fourccs, in |
| 239 // order of preference, that are expected by the media engine. | 252 // order of preference, that are expected by the media engine. |
| 240 virtual bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) = 0; | 253 virtual bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) = 0; |
| 241 | 254 |
| 242 // mutators to set private attributes | 255 // mutators to set private attributes |
| (...skipping 23 matching lines...) Expand all Loading... |
| 266 | 279 |
| 267 // Convert captured frame to readable string for LOG messages. | 280 // Convert captured frame to readable string for LOG messages. |
| 268 std::string ToString(const CapturedFrame* frame) const; | 281 std::string ToString(const CapturedFrame* frame) const; |
| 269 | 282 |
| 270 // Updates filtered_supported_formats_ so that it contains the formats in | 283 // Updates filtered_supported_formats_ so that it contains the formats in |
| 271 // supported_formats_ that fulfill all applied restrictions. | 284 // supported_formats_ that fulfill all applied restrictions. |
| 272 void UpdateFilteredSupportedFormats(); | 285 void UpdateFilteredSupportedFormats(); |
| 273 // Returns true if format doesn't fulfill all applied restrictions. | 286 // Returns true if format doesn't fulfill all applied restrictions. |
| 274 bool ShouldFilterFormat(const VideoFormat& format) const; | 287 bool ShouldFilterFormat(const VideoFormat& format) const; |
| 275 | 288 |
| 276 void UpdateInputSize(const CapturedFrame* captured_frame); | 289 void UpdateInputSize(int width, int height); |
| 277 | 290 |
| 278 rtc::ThreadChecker thread_checker_; | 291 rtc::ThreadChecker thread_checker_; |
| 279 std::string id_; | 292 std::string id_; |
| 280 CaptureState capture_state_; | 293 CaptureState capture_state_; |
| 281 std::unique_ptr<VideoFrameFactory> frame_factory_; | 294 std::unique_ptr<VideoFrameFactory> frame_factory_; |
| 282 std::unique_ptr<VideoFormat> capture_format_; | 295 std::unique_ptr<VideoFormat> capture_format_; |
| 283 std::vector<VideoFormat> supported_formats_; | 296 std::vector<VideoFormat> supported_formats_; |
| 284 std::unique_ptr<VideoFormat> max_format_; | 297 std::unique_ptr<VideoFormat> max_format_; |
| 285 std::vector<VideoFormat> filtered_supported_formats_; | 298 std::vector<VideoFormat> filtered_supported_formats_; |
| 286 | 299 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 300 | 313 |
| 301 // Whether capturer should apply rotation to the frame before signaling it. | 314 // Whether capturer should apply rotation to the frame before signaling it. |
| 302 bool apply_rotation_; | 315 bool apply_rotation_; |
| 303 | 316 |
| 304 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer); | 317 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer); |
| 305 }; | 318 }; |
| 306 | 319 |
| 307 } // namespace cricket | 320 } // namespace cricket |
| 308 | 321 |
| 309 #endif // WEBRTC_MEDIA_BASE_VIDEOCAPTURER_H_ | 322 #endif // WEBRTC_MEDIA_BASE_VIDEOCAPTURER_H_ |
| OLD | NEW |