| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_VIDEO_CAPTURE_SCREEN_SCREEN_CAPTURER_H_ | |
| 6 #define MEDIA_VIDEO_CAPTURE_SCREEN_SCREEN_CAPTURER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/callback.h" | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "media/base/media_export.h" | |
| 12 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" | |
| 13 | |
| 14 namespace media { | |
| 15 | |
| 16 struct MouseCursorShape; | |
| 17 | |
| 18 // Class used to capture video frames asynchronously. | |
| 19 // | |
| 20 // The full capture sequence is as follows: | |
| 21 // | |
| 22 // (1) Start | |
| 23 // This is when pre-capture steps are executed, such as flagging the | |
| 24 // display to prevent it from sleeping during a session. | |
| 25 // | |
| 26 // (2) CaptureFrame | |
| 27 // This is where the bits for the invalid rects are packaged up and sent | |
| 28 // to the encoder. | |
| 29 // A screen capture is performed if needed. For example, Windows requires | |
| 30 // a capture to calculate the diff from the previous screen, whereas the | |
| 31 // Mac version does not. | |
| 32 // | |
| 33 // Implementation has to ensure the following guarantees: | |
| 34 // 1. Double buffering | |
| 35 // Since data can be read while another capture action is happening. | |
| 36 class MEDIA_EXPORT ScreenCapturer | |
| 37 : public NON_EXPORTED_BASE(webrtc::DesktopCapturer) { | |
| 38 public: | |
| 39 // Provides callbacks used by the capturer to pass captured video frames and | |
| 40 // mouse cursor shapes to the processing pipeline. | |
| 41 // | |
| 42 // TODO(sergeyu): Move cursor shape capturing to a separate class because it's | |
| 43 // unrelated. | |
| 44 class MEDIA_EXPORT MouseShapeObserver { | |
| 45 public: | |
| 46 // Called when the cursor shape has changed. | |
| 47 virtual void OnCursorShapeChanged( | |
| 48 scoped_ptr<MouseCursorShape> cursor_shape) = 0; | |
| 49 | |
| 50 protected: | |
| 51 virtual ~MouseShapeObserver() {} | |
| 52 }; | |
| 53 | |
| 54 virtual ~ScreenCapturer() {} | |
| 55 | |
| 56 // Creates platform-specific capturer. | |
| 57 static scoped_ptr<ScreenCapturer> Create(); | |
| 58 | |
| 59 #if defined(OS_LINUX) | |
| 60 // Creates platform-specific capturer and instructs it whether it should use | |
| 61 // X DAMAGE support. | |
| 62 static scoped_ptr<ScreenCapturer> CreateWithXDamage(bool use_x_damage); | |
| 63 #elif defined(OS_WIN) | |
| 64 // Creates Windows-specific capturer and instructs it whether or not to | |
| 65 // disable desktop compositing. | |
| 66 static scoped_ptr<ScreenCapturer> CreateWithDisableAero(bool disable_aero); | |
| 67 #endif // defined(OS_WIN) | |
| 68 | |
| 69 // Called at the beginning of a capturing session. |mouse_shape_observer| must | |
| 70 // remain valid until the capturer is destroyed. | |
| 71 virtual void SetMouseShapeObserver( | |
| 72 MouseShapeObserver* mouse_shape_observer) = 0; | |
| 73 }; | |
| 74 | |
| 75 } // namespace media | |
| 76 | |
| 77 #endif // MEDIA_VIDEO_CAPTURE_SCREEN_SCREEN_CAPTURER_H_ | |
| OLD | NEW |