OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 // Implementation of a fake VideoCaptureDevice class. Used for testing other | 5 // Implementation of a fake VideoCaptureDevice class. Used for testing other |
6 // video capture classes when no real hardware is available. | 6 // video capture classes when no real hardware is available. |
7 | 7 |
8 #ifndef MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ | 8 #ifndef MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ |
9 #define MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ | 9 #define MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
15 #include "media/video/capture/video_capture_device.h" | 15 #include "media/video/capture/video_capture_device.h" |
16 | 16 |
17 namespace media { | 17 namespace media { |
18 | 18 |
19 class MEDIA_EXPORT FakeVideoCaptureDevice : public VideoCaptureDevice { | 19 class MEDIA_EXPORT FakeVideoCaptureDevice : public VideoCaptureDevice1 { |
20 public: | 20 public: |
21 static VideoCaptureDevice* Create(const Name& device_name); | 21 static VideoCaptureDevice* Create(const Name& device_name); |
22 virtual ~FakeVideoCaptureDevice(); | 22 virtual ~FakeVideoCaptureDevice(); |
23 // Used for testing. This will make sure the next call to Create will | 23 // Used for testing. This will make sure the next call to Create will |
24 // return NULL; | 24 // return NULL; |
25 static void SetFailNextCreate(); | 25 static void SetFailNextCreate(); |
26 | 26 |
27 static void GetDeviceNames(Names* device_names); | 27 static void GetDeviceNames(Names* device_names); |
28 | 28 |
29 // VideoCaptureDevice implementation. | 29 // VideoCaptureDevice implementation. |
30 virtual void Allocate(const VideoCaptureCapability& capture_format, | 30 virtual void Allocate(const VideoCaptureCapability& capture_format, |
31 VideoCaptureDevice::EventHandler* observer) OVERRIDE; | 31 VideoCaptureDevice::EventHandler* observer) OVERRIDE; |
32 virtual void Start() OVERRIDE; | 32 virtual void Start() OVERRIDE; |
33 virtual void Stop() OVERRIDE; | 33 virtual void Stop() OVERRIDE; |
34 virtual void DeAllocate() OVERRIDE; | 34 virtual void DeAllocate() OVERRIDE; |
35 virtual const Name& device_name() OVERRIDE; | 35 virtual const Name& device_name() OVERRIDE; |
36 | 36 |
37 private: | 37 private: |
38 // Flag indicating the internal state. | 38 // Flag indicating the internal state. |
39 enum InternalState { | 39 enum InternalState { |
40 kIdle, | 40 kIdle, |
41 kAllocated, | 41 kAllocated, |
(...skipping 24 matching lines...) Expand all Loading... |
66 int capabilities_roster_index_; | 66 int capabilities_roster_index_; |
67 | 67 |
68 static bool fail_next_create_; | 68 static bool fail_next_create_; |
69 | 69 |
70 DISALLOW_IMPLICIT_CONSTRUCTORS(FakeVideoCaptureDevice); | 70 DISALLOW_IMPLICIT_CONSTRUCTORS(FakeVideoCaptureDevice); |
71 }; | 71 }; |
72 | 72 |
73 } // namespace media | 73 } // namespace media |
74 | 74 |
75 #endif // MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ | 75 #endif // MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |