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

Side by Side Diff: media/capture/video/linux/video_capture_device_linux.cc

Issue 1360523002: Cleanup: Pass std::string as const reference from media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | media/cast/common/transport_encryption_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/linux/video_capture_device_linux.h" 5 #include "media/capture/video/linux/video_capture_device_linux.h"
6 6
7 #if defined(OS_OPENBSD) 7 #if defined(OS_OPENBSD)
8 #include <sys/videoio.h> 8 #include <sys/videoio.h>
9 #else 9 #else
10 #include <linux/videodev2.h> 10 #include <linux/videodev2.h>
(...skipping 10 matching lines...) Expand all
21 // USB VID and PID are both 4 bytes long. 21 // USB VID and PID are both 4 bytes long.
22 static const size_t kVidPidSize = 4; 22 static const size_t kVidPidSize = 4;
23 23
24 // /sys/class/video4linux/video{N}/device is a symlink to the corresponding 24 // /sys/class/video4linux/video{N}/device is a symlink to the corresponding
25 // USB device info directory. 25 // USB device info directory.
26 static const char kVidPathTemplate[] = 26 static const char kVidPathTemplate[] =
27 "/sys/class/video4linux/%s/device/../idVendor"; 27 "/sys/class/video4linux/%s/device/../idVendor";
28 static const char kPidPathTemplate[] = 28 static const char kPidPathTemplate[] =
29 "/sys/class/video4linux/%s/device/../idProduct"; 29 "/sys/class/video4linux/%s/device/../idProduct";
30 30
31 static bool ReadIdFile(const std::string path, std::string* id) { 31 static bool ReadIdFile(const std::string& path, std::string* id) {
32 char id_buf[kVidPidSize]; 32 char id_buf[kVidPidSize];
33 FILE* file = fopen(path.c_str(), "rb"); 33 FILE* file = fopen(path.c_str(), "rb");
34 if (!file) 34 if (!file)
35 return false; 35 return false;
36 const bool success = fread(id_buf, kVidPidSize, 1, file) == 1; 36 const bool success = fread(id_buf, kVidPidSize, 1, file) == 1;
37 fclose(file); 37 fclose(file);
38 if (!success) 38 if (!success)
39 return false; 39 return false;
40 id->append(id_buf, kVidPidSize); 40 id->append(id_buf, kVidPidSize);
41 return true; 41 return true;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 return V4L2_CID_POWER_LINE_FREQUENCY_50HZ; 138 return V4L2_CID_POWER_LINE_FREQUENCY_50HZ;
139 case static_cast<int>(media::PowerLineFrequency::FREQUENCY_60HZ): 139 case static_cast<int>(media::PowerLineFrequency::FREQUENCY_60HZ):
140 return V4L2_CID_POWER_LINE_FREQUENCY_60HZ; 140 return V4L2_CID_POWER_LINE_FREQUENCY_60HZ;
141 default: 141 default:
142 // If we have no idea of the frequency, at least try and set it to AUTO. 142 // If we have no idea of the frequency, at least try and set it to AUTO.
143 return V4L2_CID_POWER_LINE_FREQUENCY_AUTO; 143 return V4L2_CID_POWER_LINE_FREQUENCY_AUTO;
144 } 144 }
145 } 145 }
146 146
147 } // namespace media 147 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/cast/common/transport_encryption_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698