OLD | NEW |
(Empty) | |
| 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_RENDERER_HOST_MEDIA_DESKTOP_CAPTURE_DEVICE_AURA_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_DESKTOP_CAPTURE_DEVICE_AURA_H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/threading/thread_checker.h" |
| 11 #include "content/browser/renderer_host/media/video_capture_oracle.h" |
| 12 #include "content/common/content_export.h" |
| 13 #include "content/public/browser/browser_thread.h" |
| 14 #include "content/public/common/desktop_media_id.h" |
| 15 #include "media/video/capture/video_capture_device.h" |
| 16 |
| 17 namespace gfx { |
| 18 class Display; |
| 19 } |
| 20 |
| 21 namespace ui { |
| 22 class Compositor; |
| 23 } |
| 24 |
| 25 namespace content { |
| 26 |
| 27 // A VideoCaptureDevice that mirrors the displayed contents of an Ash browser |
| 28 // compositor, producing a stream of video frames. |
| 29 class CONTENT_EXPORT DesktopCaptureDeviceAura |
| 30 : public media::VideoCaptureDevice { |
| 31 public: |
| 32 static media::VideoCaptureDevice* Create(const DesktopMediaID& source); |
| 33 virtual ~DesktopCaptureDeviceAura(); |
| 34 |
| 35 // media::VideoCaptureDevice implementation. |
| 36 virtual void Allocate(const media::VideoCaptureCapability& capture_format, |
| 37 VideoCaptureDevice::EventHandler* consumer) OVERRIDE; |
| 38 virtual void Start() OVERRIDE; |
| 39 virtual void Stop() OVERRIDE; |
| 40 virtual void DeAllocate() OVERRIDE; |
| 41 virtual const Name& device_name() OVERRIDE; |
| 42 |
| 43 // Report an error and go to error state. |
| 44 void ReportError(); |
| 45 |
| 46 private: |
| 47 enum State { |
| 48 kIdle, |
| 49 kAllocated, |
| 50 kCapturing, |
| 51 kError, |
| 52 }; |
| 53 |
| 54 class Impl; |
| 55 |
| 56 explicit DesktopCaptureDeviceAura(const Name& device_name); |
| 57 |
| 58 const base::ThreadChecker thread_checker_; |
| 59 const Name device_name_; |
| 60 State state_; |
| 61 |
| 62 // Weak factory and pointer for posting tasks back to this object on the |
| 63 // device_thread_. Outstanding pointers are invalidated on DeAllocate(). |
| 64 base::WeakPtrFactory<DesktopCaptureDeviceAura> weak_ptr_factory_; |
| 65 |
| 66 scoped_refptr<Impl> impl_; |
| 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(DesktopCaptureDeviceAura); |
| 69 }; |
| 70 |
| 71 } // namespace content |
| 72 |
| 73 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_DESKTOP_CAPTURE_DEVICE_AURA_H_ |
OLD | NEW |