| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #ifndef WEBRTC_MEDIA_BASE_FAKESCREENCAPTURERFACTORY_H_ | |
| 12 #define WEBRTC_MEDIA_BASE_FAKESCREENCAPTURERFACTORY_H_ | |
| 13 | |
| 14 #include "webrtc/media/base/fakevideocapturer.h" | |
| 15 #include "webrtc/media/base/videocapturerfactory.h" | |
| 16 | |
| 17 namespace cricket { | |
| 18 | |
| 19 class FakeScreenCapturerFactory | |
| 20 : public cricket::ScreenCapturerFactory, | |
| 21 public sigslot::has_slots<> { | |
| 22 public: | |
| 23 FakeScreenCapturerFactory() | |
| 24 : window_capturer_(NULL), | |
| 25 capture_state_(cricket::CS_STOPPED) {} | |
| 26 | |
| 27 virtual cricket::VideoCapturer* Create(const ScreencastId& window) { | |
| 28 if (window_capturer_ != NULL) { | |
| 29 return NULL; | |
| 30 } | |
| 31 window_capturer_ = new cricket::FakeVideoCapturer; | |
| 32 window_capturer_->SignalDestroyed.connect( | |
| 33 this, | |
| 34 &FakeScreenCapturerFactory::OnWindowCapturerDestroyed); | |
| 35 window_capturer_->SignalStateChange.connect( | |
| 36 this, | |
| 37 &FakeScreenCapturerFactory::OnStateChange); | |
| 38 return window_capturer_; | |
| 39 } | |
| 40 | |
| 41 cricket::FakeVideoCapturer* window_capturer() { return window_capturer_; } | |
| 42 | |
| 43 cricket::CaptureState capture_state() { return capture_state_; } | |
| 44 | |
| 45 private: | |
| 46 void OnWindowCapturerDestroyed(cricket::FakeVideoCapturer* capturer) { | |
| 47 if (capturer == window_capturer_) { | |
| 48 window_capturer_ = NULL; | |
| 49 } | |
| 50 } | |
| 51 void OnStateChange(cricket::VideoCapturer*, cricket::CaptureState state) { | |
| 52 capture_state_ = state; | |
| 53 } | |
| 54 | |
| 55 cricket::FakeVideoCapturer* window_capturer_; | |
| 56 cricket::CaptureState capture_state_; | |
| 57 }; | |
| 58 | |
| 59 } // namespace cricket | |
| 60 | |
| 61 #endif // WEBRTC_MEDIA_BASE_FAKESCREENCAPTURERFACTORY_H_ | |
| OLD | NEW |