Chromium Code Reviews| 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 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 VideoCaptureDeviceDescriptor(const VideoCaptureDeviceDescriptor& other); | 60 VideoCaptureDeviceDescriptor(const VideoCaptureDeviceDescriptor& other); |
| 61 ~VideoCaptureDeviceDescriptor(); | 61 ~VideoCaptureDeviceDescriptor(); |
| 62 | 62 |
| 63 // 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. |
| 64 // 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 |
| 65 // 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. |
| 66 bool operator==(const VideoCaptureDeviceDescriptor& other) const { | 66 bool operator==(const VideoCaptureDeviceDescriptor& other) const { |
| 67 return (other.device_id == device_id) && (other.capture_api == capture_api); | 67 return (other.device_id == device_id) && (other.capture_api == capture_api); |
| 68 } | 68 } |
| 69 bool operator<(const VideoCaptureDeviceDescriptor& other) const { | 69 bool operator<(const VideoCaptureDeviceDescriptor& other) const { |
| 70 // Front camera first | |
|
wuchengli
2017/01/24 04:25:09
We should prefer on-device cameras over external c
henryhsu
2017/01/24 04:55:45
Done.
| |
| 71 if (facing < other.facing) | |
| 72 return true; | |
| 70 if (device_id < other.device_id) | 73 if (device_id < other.device_id) |
| 71 return true; | 74 return true; |
| 72 return capture_api < other.capture_api; | 75 return capture_api < other.capture_api; |
| 73 } | 76 } |
| 74 | 77 |
| 75 const char* GetCaptureApiTypeString() const; | 78 const char* GetCaptureApiTypeString() const; |
| 76 // Friendly name of a device, plus the model identifier in parentheses. | 79 // Friendly name of a device, plus the model identifier in parentheses. |
| 77 std::string GetNameAndModel() const; | 80 std::string GetNameAndModel() const; |
| 78 | 81 |
| 79 std::string display_name; // Name that is intended for display in the UI | 82 std::string display_name; // Name that is intended for display in the UI |
| 80 std::string device_id; | 83 std::string device_id; |
| 81 // A unique hardware identifier of the capture device. | 84 // A unique hardware identifier of the capture device. |
| 82 // It is of the form "[vid]:[pid]" when a USB device is detected, and empty | 85 // It is of the form "[vid]:[pid]" when a USB device is detected, and empty |
| 83 // otherwise. | 86 // otherwise. |
| 84 std::string model_id; | 87 std::string model_id; |
| 85 | 88 |
| 86 VideoFacingMode facing; | 89 VideoFacingMode facing; |
| 87 | 90 |
| 88 VideoCaptureApi capture_api; | 91 VideoCaptureApi capture_api; |
| 89 VideoCaptureTransportType transport_type; | 92 VideoCaptureTransportType transport_type; |
| 90 }; | 93 }; |
| 91 | 94 |
| 92 using VideoCaptureDeviceDescriptors = std::vector<VideoCaptureDeviceDescriptor>; | 95 using VideoCaptureDeviceDescriptors = std::vector<VideoCaptureDeviceDescriptor>; |
| 93 | 96 |
| 94 } // namespace media | 97 } // namespace media |
| 95 | 98 |
| 96 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_DESCRIPTOR_H_ | 99 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_DESCRIPTOR_H_ |
| OLD | NEW |