OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_CAPTURE_VIDEO_VIDEO_CAPTURE_SYSTEM_H_ | 5 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_SYSTEM_H_ |
6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_SYSTEM_H_ | 6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_SYSTEM_H_ |
7 | 7 |
8 #include "media/capture/video/video_capture_device_factory.h" | 8 #include "media/capture/video/video_capture_device_factory.h" |
9 #include "media/capture/video/video_capture_device_info.h" | 9 #include "media/capture/video/video_capture_device_info.h" |
10 | 10 |
11 namespace media { | 11 namespace media { |
12 | 12 |
13 // GetDeviceInfosAsync() should be called at least once before calling | 13 // GetDeviceInfosAsync() should be called at least once before calling |
14 // CreateDevice(), because otherwise CreateDevice() will allways return nullptr. | 14 // CreateDevice(), because otherwise CreateDevice() will allways return nullptr. |
15 class CAPTURE_EXPORT VideoCaptureSystem { | 15 class CAPTURE_EXPORT VideoCaptureSystem { |
16 public: | 16 public: |
17 using DeviceInfoCallback = | 17 using DeviceInfoCallback = |
18 base::Callback<void(const std::vector<VideoCaptureDeviceInfo>&)>; | 18 base::Callback<void(const std::vector<VideoCaptureDeviceInfo>&)>; |
19 | 19 |
20 virtual ~VideoCaptureSystem() {} | 20 virtual ~VideoCaptureSystem() {} |
21 | 21 |
22 // The passed-in |result_callback| must have ownership of the called | 22 // The passed-in |result_callback| must have ownership of the called |
23 // VideoCaptureSystem instance to guarantee that it stays alive during the | 23 // VideoCaptureSystem instance to guarantee that it stays alive during the |
24 // asynchronous operation. |result_callback| is invoked on the same thread | 24 // asynchronous operation. |
25 // that calls GetDeviceInfosAsync() | |
26 virtual void GetDeviceInfosAsync( | 25 virtual void GetDeviceInfosAsync( |
27 const DeviceInfoCallback& result_callback) = 0; | 26 const DeviceInfoCallback& result_callback) = 0; |
28 | 27 |
29 // Creates a VideoCaptureDevice object. Returns nullptr if something goes | 28 // Creates a VideoCaptureDevice object. Returns nullptr if something goes |
30 // wrong. | 29 // wrong. |
31 virtual std::unique_ptr<VideoCaptureDevice> CreateDevice( | 30 virtual std::unique_ptr<VideoCaptureDevice> CreateDevice( |
32 const std::string& device_id) = 0; | 31 const std::string& device_id) = 0; |
33 }; | 32 }; |
34 | 33 |
35 } // namespace media | 34 } // namespace media |
36 | 35 |
37 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_SYSTEM_H_ | 36 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_SYSTEM_H_ |
OLD | NEW |