Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(922)

Side by Side Diff: media/capture/video/video_capture_system.h

Issue 2769543002: [Mojo Video Capture] Introduce abstraction VideoCaptureSystem (Closed)
Patch Set: Fix for code that should only be run for MEDIA_DEVICE_VIDEO_CAPTURE Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_SYSTEM_H_
6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_SYSTEM_H_
7
8 #include "media/capture/video/video_capture_device_factory.h"
9 #include "media/capture/video/video_capture_device_info.h"
10
11 namespace media {
12
13 // Layer on top of VideoCaptureDeviceFactory that translates device descriptors
14 // to string identifiers and consolidates and caches device descriptors and
15 // supported formats into VideoCaptureDeviceInfos.
16 class CAPTURE_EXPORT VideoCaptureSystem {
17 public:
18 using DeviceInfoCallback =
19 base::Callback<void(const std::vector<VideoCaptureDeviceInfo>&)>;
20
21 explicit VideoCaptureSystem(
22 std::unique_ptr<VideoCaptureDeviceFactory> factory);
23 ~VideoCaptureSystem();
24
25 void GetDeviceInfosAsync(const DeviceInfoCallback& result_callback);
26
27 // Creates a VideoCaptureDevice object. Returns nullptr if something goes
28 // wrong.
29 std::unique_ptr<VideoCaptureDevice> CreateDevice(
30 const std::string& device_id);
31
32 media::VideoCaptureDeviceFactory* video_capture_device_factory() const {
33 return factory_.get();
34 }
35
36 private:
37 void OnDescriptorsReceived(
38 const DeviceInfoCallback& result_callback,
39 std::unique_ptr<VideoCaptureDeviceDescriptors> descriptors);
40
41 // Returns nullptr if no descriptor found.
42 const VideoCaptureDeviceInfo* LookupDeviceInfoFromId(
43 const std::string& device_id);
44
45 const std::unique_ptr<VideoCaptureDeviceFactory> factory_;
46 std::vector<VideoCaptureDeviceInfo> devices_info_cache_;
47 };
48
49 } // namespace media
50
51 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698