OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef MEDIA_VIDEO_CAPTURE_FILE_VIDEO_CAPTURE_DEVICE_H_ | 5 #ifndef MEDIA_VIDEO_CAPTURE_FILE_VIDEO_CAPTURE_DEVICE_H_ |
6 #define MEDIA_VIDEO_CAPTURE_FILE_VIDEO_CAPTURE_DEVICE_H_ | 6 #define MEDIA_VIDEO_CAPTURE_FILE_VIDEO_CAPTURE_DEVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "base/files/file.h" |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/platform_file.h" | |
12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
14 #include "media/video/capture/video_capture_device.h" | 14 #include "media/video/capture/video_capture_device.h" |
15 | 15 |
16 namespace media { | 16 namespace media { |
17 | 17 |
18 // Implementation of a VideoCaptureDevice class that reads from a file. Used for | 18 // Implementation of a VideoCaptureDevice class that reads from a file. Used for |
19 // testing the video capture pipeline when no real hardware is available. The | 19 // testing the video capture pipeline when no real hardware is available. The |
20 // only supported file format is YUV4MPEG2 (a.k.a. Y4M), a minimal container | 20 // only supported file format is YUV4MPEG2 (a.k.a. Y4M), a minimal container |
21 // with a series of uncompressed video only frames, see the link | 21 // with a series of uncompressed video only frames, see the link |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // |thread_checker_| is used to check that destructor, AllocateAndStart() and | 57 // |thread_checker_| is used to check that destructor, AllocateAndStart() and |
58 // StopAndDeAllocate() are called in the correct thread that owns the object. | 58 // StopAndDeAllocate() are called in the correct thread that owns the object. |
59 base::ThreadChecker thread_checker_; | 59 base::ThreadChecker thread_checker_; |
60 | 60 |
61 // |capture_thread_| is used for internal operations via posting tasks to it. | 61 // |capture_thread_| is used for internal operations via posting tasks to it. |
62 // It is active between OnAllocateAndStart() and OnStopAndDeAllocate(). | 62 // It is active between OnAllocateAndStart() and OnStopAndDeAllocate(). |
63 base::Thread capture_thread_; | 63 base::Thread capture_thread_; |
64 // The following members belong to |capture_thread_|. | 64 // The following members belong to |capture_thread_|. |
65 scoped_ptr<VideoCaptureDevice::Client> client_; | 65 scoped_ptr<VideoCaptureDevice::Client> client_; |
66 const base::FilePath file_path_; | 66 const base::FilePath file_path_; |
67 base::PlatformFile file_; | 67 base::File file_; |
68 scoped_ptr<uint8[]> video_frame_; | 68 scoped_ptr<uint8[]> video_frame_; |
69 VideoCaptureFormat capture_format_; | 69 VideoCaptureFormat capture_format_; |
70 int frame_size_; | 70 int frame_size_; |
71 int64 current_byte_index_; | 71 int64 current_byte_index_; |
72 int64 first_frame_byte_index_; | 72 int64 first_frame_byte_index_; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(FileVideoCaptureDevice); | 74 DISALLOW_COPY_AND_ASSIGN(FileVideoCaptureDevice); |
75 }; | 75 }; |
76 | 76 |
77 } // namespace media | 77 } // namespace media |
78 | 78 |
79 #endif // MEDIA_VIDEO_CAPTURE_FILE_VIDEO_CAPTURE_DEVICE_H_ | 79 #endif // MEDIA_VIDEO_CAPTURE_FILE_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |