| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_DEVICE_DESCRIPTOR_H_ | 5 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_DESCRIPTOR_H_ |
| 6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_DESCRIPTOR_H_ | 6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_DESCRIPTOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "media/base/video_facing.h" |
| 11 #include "media/capture/capture_export.h" | 12 #include "media/capture/capture_export.h" |
| 12 | 13 |
| 13 namespace media { | 14 namespace media { |
| 14 | 15 |
| 15 // A Java counterpart will be generated for this enum. | 16 // A Java counterpart will be generated for this enum. |
| 16 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.media | 17 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.media |
| 17 enum class VideoCaptureApi { | 18 enum class VideoCaptureApi { |
| 18 LINUX_V4L2_SINGLE_PLANE, | 19 LINUX_V4L2_SINGLE_PLANE, |
| 19 WIN_MEDIA_FOUNDATION, | 20 WIN_MEDIA_FOUNDATION, |
| 20 WIN_DIRECT_SHOW, | 21 WIN_DIRECT_SHOW, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 41 // disambiguates the API. | 42 // disambiguates the API. |
| 42 struct CAPTURE_EXPORT VideoCaptureDeviceDescriptor { | 43 struct CAPTURE_EXPORT VideoCaptureDeviceDescriptor { |
| 43 public: | 44 public: |
| 44 VideoCaptureDeviceDescriptor(); | 45 VideoCaptureDeviceDescriptor(); |
| 45 VideoCaptureDeviceDescriptor( | 46 VideoCaptureDeviceDescriptor( |
| 46 const std::string& display_name, | 47 const std::string& display_name, |
| 47 const std::string& device_id, | 48 const std::string& device_id, |
| 48 VideoCaptureApi capture_api = VideoCaptureApi::UNKNOWN, | 49 VideoCaptureApi capture_api = VideoCaptureApi::UNKNOWN, |
| 49 VideoCaptureTransportType transport_type = | 50 VideoCaptureTransportType transport_type = |
| 50 VideoCaptureTransportType::OTHER_TRANSPORT); | 51 VideoCaptureTransportType::OTHER_TRANSPORT); |
| 51 VideoCaptureDeviceDescriptor(const std::string& display_name, | 52 VideoCaptureDeviceDescriptor( |
| 52 const std::string& device_id, | 53 const std::string& display_name, |
| 53 const std::string& model_id, | 54 const std::string& device_id, |
| 54 VideoCaptureApi capture_api, | 55 const std::string& model_id, |
| 55 VideoCaptureTransportType transport_type = | 56 VideoCaptureApi capture_api, |
| 56 VideoCaptureTransportType::OTHER_TRANSPORT); | 57 VideoCaptureTransportType transport_type = |
| 58 VideoCaptureTransportType::OTHER_TRANSPORT, |
| 59 VideoFacingMode facing = VideoFacingMode::MEDIA_VIDEO_FACING_NONE); |
| 57 VideoCaptureDeviceDescriptor(const VideoCaptureDeviceDescriptor& other); | 60 VideoCaptureDeviceDescriptor(const VideoCaptureDeviceDescriptor& other); |
| 58 ~VideoCaptureDeviceDescriptor(); | 61 ~VideoCaptureDeviceDescriptor(); |
| 59 | 62 |
| 60 // These operators are needed due to storing the name in an STL container. | 63 // 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 | 64 // 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. | 65 // so even though they're not used, they're still depended upon. |
| 63 bool operator==(const VideoCaptureDeviceDescriptor& other) const { | 66 bool operator==(const VideoCaptureDeviceDescriptor& other) const { |
| 64 return (other.device_id == device_id) && (other.capture_api == capture_api); | 67 return (other.device_id == device_id) && (other.capture_api == capture_api); |
| 65 } | 68 } |
| 66 bool operator<(const VideoCaptureDeviceDescriptor& other) const { | 69 bool operator<(const VideoCaptureDeviceDescriptor& other) const { |
| 67 if (device_id < other.device_id) | 70 if (device_id < other.device_id) |
| 68 return true; | 71 return true; |
| 69 return capture_api < other.capture_api; | 72 return capture_api < other.capture_api; |
| 70 } | 73 } |
| 71 | 74 |
| 72 const char* GetCaptureApiTypeString() const; | 75 const char* GetCaptureApiTypeString() const; |
| 73 // Friendly name of a device, plus the model identifier in parentheses. | 76 // Friendly name of a device, plus the model identifier in parentheses. |
| 74 std::string GetNameAndModel() const; | 77 std::string GetNameAndModel() const; |
| 75 | 78 |
| 76 std::string display_name; // Name that is intended for display in the UI | 79 std::string display_name; // Name that is intended for display in the UI |
| 77 std::string device_id; | 80 std::string device_id; |
| 78 // A unique hardware identifier of the capture device. | 81 // A unique hardware identifier of the capture device. |
| 79 // It is of the form "[vid]:[pid]" when a USB device is detected, and empty | 82 // It is of the form "[vid]:[pid]" when a USB device is detected, and empty |
| 80 // otherwise. | 83 // otherwise. |
| 81 std::string model_id; | 84 std::string model_id; |
| 82 | 85 |
| 86 VideoFacingMode facing; |
| 87 |
| 83 VideoCaptureApi capture_api; | 88 VideoCaptureApi capture_api; |
| 84 VideoCaptureTransportType transport_type; | 89 VideoCaptureTransportType transport_type; |
| 85 }; | 90 }; |
| 86 | 91 |
| 87 using VideoCaptureDeviceDescriptors = std::vector<VideoCaptureDeviceDescriptor>; | 92 using VideoCaptureDeviceDescriptors = std::vector<VideoCaptureDeviceDescriptor>; |
| 88 | 93 |
| 89 } // namespace media | 94 } // namespace media |
| 90 | 95 |
| 91 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_DESCRIPTOR_H_ | 96 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_DESCRIPTOR_H_ |
| OLD | NEW |