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

Unified Diff: media/capture/video/win/video_capture_device_mf_win.cc

Issue 2169013002: Change class VideoCaptureDevice::Name to struct VideoCaptureDeviceDescriptor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build errors Created 4 years, 5 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
Index: media/capture/video/win/video_capture_device_mf_win.cc
diff --git a/media/capture/video/win/video_capture_device_mf_win.cc b/media/capture/video/win/video_capture_device_mf_win.cc
index a5e7735ecd8ff3335c4b59465ef829c55de39a25..9965e7c76a3fbd083c5661478d1015034b8a5cd9 100644
--- a/media/capture/video/win/video_capture_device_mf_win.cc
+++ b/media/capture/video/win/video_capture_device_mf_win.cc
@@ -24,12 +24,6 @@ using base::win::ScopedComPtr;
namespace media {
-// In Windows device identifiers, the USB VID and PID are preceded by the string
-// "vid_" or "pid_". The identifiers are each 4 bytes long.
-const char kVidPrefix[] = "vid_"; // Also contains '\0'.
-const char kPidPrefix[] = "pid_"; // Also contains '\0'.
-const size_t kVidPidSize = 4;
-
static bool GetFrameSize(IMFMediaType* type, gfx::Size* frame_size) {
UINT32 width32, height32;
if (FAILED(MFGetAttributeSize(type, MF_MT_FRAME_SIZE, &width32, &height32)))
@@ -188,28 +182,9 @@ bool VideoCaptureDeviceMFWin::FormatFromGuid(const GUID& guid,
return false;
}
-const std::string VideoCaptureDevice::Name::GetModel() const {
- const size_t vid_prefix_size = sizeof(kVidPrefix) - 1;
- const size_t pid_prefix_size = sizeof(kPidPrefix) - 1;
- const size_t vid_location = unique_id_.find(kVidPrefix);
- if (vid_location == std::string::npos ||
- vid_location + vid_prefix_size + kVidPidSize > unique_id_.size()) {
- return std::string();
- }
- const size_t pid_location = unique_id_.find(kPidPrefix);
- if (pid_location == std::string::npos ||
- pid_location + pid_prefix_size + kVidPidSize > unique_id_.size()) {
- return std::string();
- }
- std::string id_vendor =
- unique_id_.substr(vid_location + vid_prefix_size, kVidPidSize);
- std::string id_product =
- unique_id_.substr(pid_location + pid_prefix_size, kVidPidSize);
- return id_vendor + ":" + id_product;
-}
-
-VideoCaptureDeviceMFWin::VideoCaptureDeviceMFWin(const Name& device_name)
- : name_(device_name), capture_(0) {
+VideoCaptureDeviceMFWin::VideoCaptureDeviceMFWin(
+ const VideoCaptureDeviceDescriptor& device_descriptor)
+ : descriptor_(device_descriptor), capture_(0) {
DetachFromThread();
}
« no previous file with comments | « media/capture/video/win/video_capture_device_mf_win.h ('k') | media/capture/video/win/video_capture_device_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698