Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_ | 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/public/browser/desktop_media_id.h" | 11 #include "content/public/browser/desktop_media_id.h" |
| 12 #include "media/video/capture/video_capture_device.h" | 12 #include "media/video/capture/video_capture_device.h" |
| 13 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class SequencedTaskRunner; | 16 class SequencedTaskRunner; |
| 17 class Thread; | |
| 17 } // namespace base | 18 } // namespace base |
| 18 | 19 |
| 19 namespace webrtc { | 20 namespace webrtc { |
| 20 class DesktopCapturer; | 21 class DesktopCapturer; |
| 21 } // namespace webrtc | 22 } // namespace webrtc |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 | 25 |
| 25 // DesktopCaptureDevice implements VideoCaptureDevice for screens and windows. | 26 // DesktopCaptureDevice implements VideoCaptureDevice for screens and windows. |
| 26 // It's essentially an adapter between webrtc::DesktopCapturer and | 27 // It's essentially an adapter between webrtc::DesktopCapturer and |
| 27 // VideoCaptureDevice. | 28 // VideoCaptureDevice. |
| 28 class CONTENT_EXPORT DesktopCaptureDevice : public media::VideoCaptureDevice { | 29 class CONTENT_EXPORT DesktopCaptureDevice : public media::VideoCaptureDevice { |
| 29 public: | 30 public: |
| 30 // Creates capturer for the specified |source| and then creates | 31 // Creates capturer for the specified |source| and then creates |
| 31 // DesktopCaptureDevice for it. May return NULL in case of a failure (e.g. if | 32 // DesktopCaptureDevice for it. May return NULL in case of a failure (e.g. if |
| 32 // requested window was destroyed). | 33 // requested window was destroyed). |
| 33 static scoped_ptr<media::VideoCaptureDevice> Create( | 34 static scoped_ptr<media::VideoCaptureDevice> Create( |
| 34 const DesktopMediaID& source); | 35 const DesktopMediaID& source); |
| 35 | 36 |
| 37 // Run the capturer on the |task_runner|. | |
| 36 DesktopCaptureDevice(scoped_refptr<base::SequencedTaskRunner> task_runner, | 38 DesktopCaptureDevice(scoped_refptr<base::SequencedTaskRunner> task_runner, |
| 37 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer, | 39 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer, |
| 38 DesktopMediaID::Type type); | 40 DesktopMediaID::Type type); |
| 41 // Run the capturer on a dedicated thread. Needed for using the magnification | |
| 42 // API on Windows. | |
| 43 DesktopCaptureDevice(scoped_ptr<base::Thread> thread, | |
|
Sergey Ulanov
2014/05/05 20:10:06
It's better to avoid overriding constructor. I sug
| |
| 44 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer, | |
| 45 DesktopMediaID::Type type); | |
| 39 virtual ~DesktopCaptureDevice(); | 46 virtual ~DesktopCaptureDevice(); |
| 40 | 47 |
| 41 // VideoCaptureDevice interface. | 48 // VideoCaptureDevice interface. |
| 42 virtual void AllocateAndStart(const media::VideoCaptureParams& params, | 49 virtual void AllocateAndStart(const media::VideoCaptureParams& params, |
| 43 scoped_ptr<Client> client) OVERRIDE; | 50 scoped_ptr<Client> client) OVERRIDE; |
| 44 virtual void StopAndDeAllocate() OVERRIDE; | 51 virtual void StopAndDeAllocate() OVERRIDE; |
| 45 | 52 |
| 46 // Set the platform-dependent window id for the notification window. | 53 // Set the platform-dependent window id for the notification window. |
| 47 void SetNotificationWindowId(gfx::NativeViewId window_id); | 54 void SetNotificationWindowId(gfx::NativeViewId window_id); |
| 48 | 55 |
| 49 private: | 56 private: |
| 50 class Core; | 57 class Core; |
| 51 scoped_refptr<Core> core_; | 58 scoped_refptr<Core> core_; |
| 52 | 59 |
| 53 DISALLOW_COPY_AND_ASSIGN(DesktopCaptureDevice); | 60 DISALLOW_COPY_AND_ASSIGN(DesktopCaptureDevice); |
| 54 }; | 61 }; |
| 55 | 62 |
| 56 } // namespace content | 63 } // namespace content |
| 57 | 64 |
| 58 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_ | 65 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_ |
| OLD | NEW |