desktop_capture_device.h revision a1401311d1ab56c4ed0a474bd38c108f75cb0cd9
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 3// found in the LICENSE file. 4 5#ifndef CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_ 6#define CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_ 7 8#include "base/memory/ref_counted.h" 9#include "base/memory/scoped_ptr.h" 10#include "content/common/content_export.h" 11#include "media/video/capture/video_capture_device.h" 12 13namespace base { 14class SequencedTaskRunner; 15} // namespace base 16 17namespace webrtc { 18class DesktopCapturer; 19} // namespace webrtc 20 21namespace content { 22 23struct DesktopMediaID; 24 25// DesktopCaptureDevice implements VideoCaptureDevice for screens and windows. 26// It's essentially an adapter between webrtc::DesktopCapturer and 27// VideoCaptureDevice. 28class CONTENT_EXPORT DesktopCaptureDevice : public media::VideoCaptureDevice { 29 public: 30 // 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 // requested window was destroyed). 33 static scoped_ptr<media::VideoCaptureDevice> Create( 34 const DesktopMediaID& source); 35 36 DesktopCaptureDevice(scoped_refptr<base::SequencedTaskRunner> task_runner, 37 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer); 38 virtual ~DesktopCaptureDevice(); 39 40 // VideoCaptureDevice interface. 41 virtual void AllocateAndStart(const media::VideoCaptureParams& params, 42 scoped_ptr<Client> client) OVERRIDE; 43 virtual void StopAndDeAllocate() OVERRIDE; 44 45 private: 46 class Core; 47 scoped_refptr<Core> core_; 48 49 DISALLOW_COPY_AND_ASSIGN(DesktopCaptureDevice); 50}; 51 52} // namespace content 53 54#endif // CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_ 55