OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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_DEVICE_DESCRIPTOR_H_ | |
6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_DESCRIPTOR_H_ | |
7 | |
8 #include <list> | |
9 #include <string> | |
10 | |
11 #include "media/capture/capture_export.h" | |
12 | |
13 namespace media { | |
14 | |
15 // A Java counterpart will be generated for this enum. | |
16 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.media | |
17 enum class VideoCaptureApi { | |
18 LINUX_V4L2_SINGLE_PLANE, | |
19 WINDOWS_MEDIA_FOUNDATION, | |
20 WINDOWS_DIRECT_SHOW, | |
21 MACOSX_AVFOUNDATION, | |
22 MACOSX_DECKLINK, | |
23 ANDROID_API1, | |
24 ANDROID_API2_LEGACY, | |
25 ANDROID_API2_FULL, | |
26 ANDROID_API2_LIMITED, | |
27 ANDROID_TANGO, | |
28 UNKNOWN | |
29 }; | |
30 | |
31 enum class VideoCaptureTransportType { | |
32 // For AVFoundation Api, identify devices that are built-in or USB. | |
33 MACOSX_USB_OR_BUILT_IN, | |
34 OTHER_TRANSPORT | |
35 }; | |
36 | |
37 // Represents information about a capture device as returned by | |
38 // VideoCaptureDeviceFactory::EnumerateDeviceDescriptors(). | |
39 // |device_id| represents a unique id of a physical device. Since the same | |
40 // physical device may be accessible through different APIs |capture_api| | |
41 // disambiguates the API. | |
42 struct CAPTURE_EXPORT VideoCaptureDeviceDescriptor { | |
43 public: | |
44 VideoCaptureDeviceDescriptor(); | |
45 VideoCaptureDeviceDescriptor(const std::string friendly_name, | |
emircan
2016/07/28 21:23:02
const std::string& friendly_name and below.
Also,
chfremer
2016/07/29 18:09:51
Done.
| |
46 const std::string device_id, | |
47 VideoCaptureApi capture_api); | |
48 VideoCaptureDeviceDescriptor(const std::string friendly_name, | |
49 const std::string device_id, | |
50 const std::string model_id, | |
51 VideoCaptureApi capture_api); | |
52 VideoCaptureDeviceDescriptor(const std::string friendly_name, | |
53 const std::string device_id, | |
54 VideoCaptureApi capture_api, | |
55 VideoCaptureTransportType transport_type); | |
56 VideoCaptureDeviceDescriptor(const std::string friendly_name, | |
57 const std::string device_id, | |
58 const std::string model_id, | |
59 VideoCaptureApi capture_api, | |
60 VideoCaptureTransportType transport_type); | |
61 VideoCaptureDeviceDescriptor(const VideoCaptureDeviceDescriptor& other); | |
62 ~VideoCaptureDeviceDescriptor(); | |
63 | |
64 // These operators are needed due to storing the name in an STL container. | |
65 // In the shared build, all methods from the STL container will be exported | |
66 // so even though they're not used, they're still depended upon. | |
67 bool operator==(const VideoCaptureDeviceDescriptor& other) const { | |
68 return (other.device_id == device_id) && (other.capture_api == capture_api); | |
69 } | |
70 bool operator<(const VideoCaptureDeviceDescriptor& other) const { | |
71 if (device_id < other.device_id) | |
72 return true; | |
73 return capture_api < other.capture_api; | |
74 } | |
75 | |
76 const char* GetCaptureApiTypeString() const; | |
77 // Friendly name of a device, plus the model identifier in parentheses. | |
78 std::string GetNameAndModel() const; | |
79 | |
80 std::string friendly_name; // Name that is intended for display in the UI | |
81 std::string device_id; | |
82 // A unique hardware identifier of the capture device. | |
83 // It is of the form "[vid]:[pid]" when a USB device is detected, and empty | |
84 // otherwise. | |
85 std::string model_id; | |
86 | |
87 VideoCaptureApi capture_api; | |
88 VideoCaptureTransportType transport_type; | |
89 }; | |
90 | |
91 using VideoCaptureDeviceDescriptors = std::list<VideoCaptureDeviceDescriptor>; | |
92 | |
93 } // namespace media | |
94 | |
95 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_DESCRIPTOR_H_ | |
OLD | NEW |