| 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/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
| 17 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
| 18 #include "media/video/capture/video_capture_device.h" | 18 #include "media/video/capture/video_capture_device.h" |
| 19 | 19 |
| 20 #if defined(OS_POSIX) |
| 21 #include "base/files/scoped_file.h" |
| 22 #endif |
| 23 |
| 20 namespace media { | 24 namespace media { |
| 21 | 25 |
| 22 class MEDIA_EXPORT FakeVideoCaptureDevice : public VideoCaptureDevice { | 26 class MEDIA_EXPORT FakeVideoCaptureDevice : public VideoCaptureDevice { |
| 23 public: | 27 public: |
| 24 enum FakeVideoCaptureDeviceType { | 28 enum FakeVideoCaptureDeviceType { |
| 25 USING_OWN_BUFFERS, | 29 USING_OWN_BUFFERS, |
| 26 USING_OWN_BUFFERS_TRIPLANAR, | 30 USING_OWN_BUFFERS_TRIPLANAR, |
| 27 USING_CLIENT_BUFFERS_I420, | 31 USING_CLIENT_BUFFERS_I420, |
| 28 USING_CLIENT_BUFFERS_GPU, | 32 USING_CLIENT_BUFFERS_GPU, |
| 29 }; | 33 }; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 50 base::ThreadChecker thread_checker_; | 54 base::ThreadChecker thread_checker_; |
| 51 | 55 |
| 52 const FakeVideoCaptureDeviceType device_type_; | 56 const FakeVideoCaptureDeviceType device_type_; |
| 53 | 57 |
| 54 scoped_ptr<VideoCaptureDevice::Client> client_; | 58 scoped_ptr<VideoCaptureDevice::Client> client_; |
| 55 // |fake_frame_| is used for capturing on Own Buffers. | 59 // |fake_frame_| is used for capturing on Own Buffers. |
| 56 scoped_ptr<uint8[]> fake_frame_; | 60 scoped_ptr<uint8[]> fake_frame_; |
| 57 int frame_count_; | 61 int frame_count_; |
| 58 VideoCaptureFormat capture_format_; | 62 VideoCaptureFormat capture_format_; |
| 59 | 63 |
| 64 #if defined(OS_POSIX) |
| 65 class DrmDumbBuffer; |
| 66 scoped_ptr<DrmDumbBuffer> drm_buffer_; |
| 67 #endif |
| 68 |
| 60 // FakeVideoCaptureDevice post tasks to itself for frame construction and | 69 // FakeVideoCaptureDevice post tasks to itself for frame construction and |
| 61 // needs to deal with asynchronous StopAndDeallocate(). | 70 // needs to deal with asynchronous StopAndDeallocate(). |
| 62 base::WeakPtrFactory<FakeVideoCaptureDevice> weak_factory_; | 71 base::WeakPtrFactory<FakeVideoCaptureDevice> weak_factory_; |
| 63 | 72 |
| 64 DISALLOW_COPY_AND_ASSIGN(FakeVideoCaptureDevice); | 73 DISALLOW_COPY_AND_ASSIGN(FakeVideoCaptureDevice); |
| 65 }; | 74 }; |
| 66 | 75 |
| 67 } // namespace media | 76 } // namespace media |
| 68 | 77 |
| 69 #endif // MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ | 78 #endif // MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ |
| OLD | NEW |