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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/capture/video/video_capture_device_descriptor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/capture/video/video_capture_device_descriptor.cc
diff --git a/media/capture/video/video_capture_device_descriptor.cc b/media/capture/video/video_capture_device_descriptor.cc
index 3a259543979580ebe3b6680c2e9113136d1640db..b26cd2039278d044aba319f71f4e5a154d0f6b09 100644
--- a/media/capture/video/video_capture_device_descriptor.cc
+++ b/media/capture/video/video_capture_device_descriptor.cc
@@ -6,6 +6,12 @@
#include "base/logging.h"
+namespace {
+
+const char* VIDEO_FACING_STRINGS[media::NUM_MEDIA_VIDEO_FACING_MODE] = {
+ "", "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
+}
+
namespace media {
VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor()
@@ -94,4 +100,12 @@ std::string VideoCaptureDeviceDescriptor::GetNameAndModel() const {
return display_name + " (" + model_id + ")";
}
+std::string VideoCaptureDeviceDescriptor::GetHumanReadableName() const {
+ std::string facing_info(VIDEO_FACING_STRINGS[facing]);
+ if (facing_info.empty()) {
+ return GetNameAndModel();
+ }
mcasas 2017/02/22 19:03:59 nit: no {} for one-line bodies.
shenghao 2017/02/24 01:11:39 Done.
+ 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.
+}
+
} // namespace media
« 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