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

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

Issue 2648973003: Sort camera device list to use front camera first (Closed)
Patch Set: add bug number Created 3 years, 11 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
« no previous file with comments | « media/capture/video/linux/video_capture_device_factory_linux.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « media/capture/video/linux/video_capture_device_factory_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698