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/atomicops.h" | 13 #include "base/atomicops.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
17 #include "media/video/capture/video_capture_device.h" | 17 #include "media/video/capture/video_capture_device.h" |
18 | 18 |
19 namespace media { | 19 namespace media { |
20 | 20 |
21 class MEDIA_EXPORT FakeVideoCaptureDevice : public VideoCaptureDevice { | 21 class MEDIA_EXPORT FakeVideoCaptureDevice : public VideoCaptureDevice { |
22 public: | 22 public: |
23 static VideoCaptureDevice* Create(const Name& device_name); | 23 static VideoCaptureDevice* Create(const Name& device_name); |
24 virtual ~FakeVideoCaptureDevice(); | 24 virtual ~FakeVideoCaptureDevice(); |
25 // Used for testing. This will make sure the next call to Create will | 25 // Used for testing. This will make sure the next call to Create will |
26 // return NULL; | 26 // return NULL; |
27 static void SetFailNextCreate(); | 27 static void SetFailNextCreate(); |
28 static void SetNumberOfFakeDevices(size_t number_of_devices); | 28 static void SetNumberOfFakeDevices(size_t number_of_devices); |
29 static int NumberOfFakeDevices(); | |
perkj_chrome
2013/12/10 12:27:14
size_t to match SetNumberOfFakeDevices
mcasas
2013/12/12 10:38:05
Done.
| |
29 | 30 |
30 static void GetDeviceNames(Names* device_names); | 31 static void GetDeviceNames(Names* device_names); |
31 static void GetDeviceSupportedFormats(const Name& device, | 32 static void GetDeviceSupportedFormats(const Name& device, |
32 VideoCaptureCapabilities* formats); | 33 VideoCaptureFormats* supported_formats); |
33 | 34 |
34 // VideoCaptureDevice implementation. | 35 // VideoCaptureDevice implementation. |
35 virtual void AllocateAndStart(const VideoCaptureParams& params, | 36 virtual void AllocateAndStart(const VideoCaptureParams& params, |
36 scoped_ptr<VideoCaptureDevice::Client> client) | 37 scoped_ptr<VideoCaptureDevice::Client> client) |
37 OVERRIDE; | 38 OVERRIDE; |
38 virtual void StopAndDeAllocate() OVERRIDE; | 39 virtual void StopAndDeAllocate() OVERRIDE; |
39 | 40 |
40 private: | 41 private: |
41 FakeVideoCaptureDevice(); | 42 FakeVideoCaptureDevice(); |
42 | 43 |
(...skipping 28 matching lines...) Expand all Loading... | |
71 // read from a separate thread. | 72 // read from a separate thread. |
72 // TODO(perkj): Make tests independent of global state. crbug/323913 | 73 // TODO(perkj): Make tests independent of global state. crbug/323913 |
73 static base::subtle::Atomic32 number_of_devices_; | 74 static base::subtle::Atomic32 number_of_devices_; |
74 | 75 |
75 DISALLOW_COPY_AND_ASSIGN(FakeVideoCaptureDevice); | 76 DISALLOW_COPY_AND_ASSIGN(FakeVideoCaptureDevice); |
76 }; | 77 }; |
77 | 78 |
78 } // namespace media | 79 } // namespace media |
79 | 80 |
80 #endif // MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ | 81 #endif // MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |