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 const int kFakeCaptureTimeoutMs = 50; | 23 static const int kFakeCaptureTimeoutMs = 50; |
24 | 24 |
25 FakeVideoCaptureDevice(); | 25 FakeVideoCaptureDevice(); |
26 virtual ~FakeVideoCaptureDevice(); | 26 ~FakeVideoCaptureDevice() override; |
27 | 27 |
28 // VideoCaptureDevice implementation. | 28 // VideoCaptureDevice implementation. |
29 virtual void AllocateAndStart( | 29 void AllocateAndStart(const VideoCaptureParams& params, |
30 const VideoCaptureParams& params, | 30 scoped_ptr<VideoCaptureDevice::Client> client) override; |
31 scoped_ptr<VideoCaptureDevice::Client> client) override; | 31 void StopAndDeAllocate() override; |
32 virtual void StopAndDeAllocate() override; | |
33 | 32 |
34 // Sets the formats to use sequentially when the device is configured as | 33 // Sets the formats to use sequentially when the device is configured as |
35 // variable capture resolution. Works only before AllocateAndStart() or | 34 // variable capture resolution. Works only before AllocateAndStart() or |
36 // after StopAndDeallocate(). | 35 // after StopAndDeallocate(). |
37 void PopulateVariableFormatsRoster(const VideoCaptureFormats& formats); | 36 void PopulateVariableFormatsRoster(const VideoCaptureFormats& formats); |
38 | 37 |
39 private: | 38 private: |
40 // Called on the |capture_thread_| only. | 39 // Called on the |capture_thread_| only. |
41 void OnAllocateAndStart(const VideoCaptureParams& params, | 40 void OnAllocateAndStart(const VideoCaptureParams& params, |
42 scoped_ptr<Client> client); | 41 scoped_ptr<Client> client); |
(...skipping 18 matching lines...) Expand all Loading... |
61 // running and are subsequently read-only in that thread. | 60 // running and are subsequently read-only in that thread. |
62 std::vector<VideoCaptureFormat> format_roster_; | 61 std::vector<VideoCaptureFormat> format_roster_; |
63 int format_roster_index_; | 62 int format_roster_index_; |
64 | 63 |
65 DISALLOW_COPY_AND_ASSIGN(FakeVideoCaptureDevice); | 64 DISALLOW_COPY_AND_ASSIGN(FakeVideoCaptureDevice); |
66 }; | 65 }; |
67 | 66 |
68 } // namespace media | 67 } // namespace media |
69 | 68 |
70 #endif // MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ | 69 #endif // MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |