| 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 WIN_MEDIA_FOUNDATION, | |
| 20 WIN_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( | |
| 46 const std::string& display_name, | |
| 47 const std::string& device_id, | |
| 48 VideoCaptureApi capture_api = VideoCaptureApi::UNKNOWN, | |
| 49 VideoCaptureTransportType transport_type = | |
| 50 VideoCaptureTransportType::OTHER_TRANSPORT); | |
| 51 VideoCaptureDeviceDescriptor(const std::string& display_name, | |
| 52 const std::string& device_id, | |
| 53 const std::string& model_id, | |
| 54 VideoCaptureApi capture_api, | |
| 55 VideoCaptureTransportType transport_type = | |
| 56 VideoCaptureTransportType::OTHER_TRANSPORT); | |
| 57 VideoCaptureDeviceDescriptor(const VideoCaptureDeviceDescriptor& other); | |
| 58 ~VideoCaptureDeviceDescriptor(); | |
| 59 | |
| 60 // These operators are needed due to storing the name in an STL container. | |
| 61 // In the shared build, all methods from the STL container will be exported | |
| 62 // so even though they're not used, they're still depended upon. | |
| 63 bool operator==(const VideoCaptureDeviceDescriptor& other) const { | |
| 64 return (other.device_id == device_id) && (other.capture_api == capture_api); | |
| 65 } | |
| 66 bool operator<(const VideoCaptureDeviceDescriptor& other) const { | |
| 67 if (device_id < other.device_id) | |
| 68 return true; | |
| 69 return capture_api < other.capture_api; | |
| 70 } | |
| 71 | |
| 72 const char* GetCaptureApiTypeString() const; | |
| 73 // Friendly name of a device, plus the model identifier in parentheses. | |
| 74 std::string GetNameAndModel() const; | |
| 75 | |
| 76 std::string display_name; // Name that is intended for display in the UI | |
| 77 std::string device_id; | |
| 78 // A unique hardware identifier of the capture device. | |
| 79 // It is of the form "[vid]:[pid]" when a USB device is detected, and empty | |
| 80 // otherwise. | |
| 81 std::string model_id; | |
| 82 | |
| 83 VideoCaptureApi capture_api; | |
| 84 VideoCaptureTransportType transport_type; | |
| 85 }; | |
| 86 | |
| 87 using VideoCaptureDeviceDescriptors = std::list<VideoCaptureDeviceDescriptor>; | |
| 88 | |
| 89 } // namespace media | |
| 90 | |
| 91 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_DESCRIPTOR_H_ | |
| OLD | NEW |