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

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

Issue 2703393007: Show meaningful name for cameras (Closed)
Patch Set: Created 3 years, 10 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/video_capture_device_descriptor.h ('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 #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
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
OLDNEW
« no previous file with comments | « media/capture/video/video_capture_device_descriptor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698