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 #include "media/capture/video/video_capture_device_descriptor.h" | 5 #include "media/capture/video/video_capture_device_descriptor.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace { | |
| 10 | |
| 11 const char* VIDEO_FACING_STRINGS[media::NUM_MEDIA_VIDEO_FACING_MODE] = { | |
| 12 "", "user-facing", "world-facing"}; | |
|
mcasas
2017/02/22 19:03:59
nit: move the anonymous namespace inside media,
shenghao
2017/02/24 01:11:39
Deleted
| |
| 13 } | |
| 14 | |
| 9 namespace media { | 15 namespace media { |
| 10 | 16 |
| 11 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor() | 17 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor() |
| 12 : facing(VideoFacingMode::MEDIA_VIDEO_FACING_NONE), | 18 : facing(VideoFacingMode::MEDIA_VIDEO_FACING_NONE), |
| 13 capture_api(VideoCaptureApi::UNKNOWN), | 19 capture_api(VideoCaptureApi::UNKNOWN), |
| 14 transport_type(VideoCaptureTransportType::OTHER_TRANSPORT) {} | 20 transport_type(VideoCaptureTransportType::OTHER_TRANSPORT) {} |
| 15 | 21 |
| 16 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor( | 22 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor( |
| 17 const std::string& display_name, | 23 const std::string& display_name, |
| 18 const std::string& device_id, | 24 const std::string& device_id, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 return "Unknown API"; | 93 return "Unknown API"; |
| 88 } | 94 } |
| 89 } | 95 } |
| 90 | 96 |
| 91 std::string VideoCaptureDeviceDescriptor::GetNameAndModel() const { | 97 std::string VideoCaptureDeviceDescriptor::GetNameAndModel() const { |
| 92 if (model_id.empty()) | 98 if (model_id.empty()) |
| 93 return display_name; | 99 return display_name; |
| 94 return display_name + " (" + model_id + ")"; | 100 return display_name + " (" + model_id + ")"; |
| 95 } | 101 } |
| 96 | 102 |
| 103 std::string VideoCaptureDeviceDescriptor::GetHumanReadableName() const { | |
| 104 std::string facing_info(VIDEO_FACING_STRINGS[facing]); | |
| 105 if (facing_info.empty()) { | |
| 106 return GetNameAndModel(); | |
| 107 } | |
|
mcasas
2017/02/22 19:03:59
nit: no {} for one-line bodies.
shenghao
2017/02/24 01:11:39
Done.
| |
| 108 return GetNameAndModel() + " (" + facing_info + ")"; | |
|
mtomasz
2017/02/22 03:20:37
If human readable, then should we localize? If har
tommi (sloooow) - chröme
2017/02/22 10:41:04
I don't think we have a way of knowing what langua
shenghao
2017/02/24 01:11:39
Replied in previous comment.
| |
| 109 } | |
| 110 | |
| 97 } // namespace media | 111 } // namespace media |
| OLD | NEW |