video_capture_device.cc revision 4e180b6a0b4720a9b8e9e959a882386f690f08ff
1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "media/video/capture/video_capture_device.h"
6#include "base/strings/string_util.h"
7
8namespace media {
9
10const std::string VideoCaptureDevice::Name::GetNameAndModel() const {
11  const std::string model_id = GetModel();
12  if (model_id.empty())
13    return device_name_;
14  const std::string suffix = " (" + model_id + ")";
15  if (EndsWith(device_name_, suffix, true))  // |true| means case-sensitive.
16    return device_name_;
17  return device_name_ + suffix;
18}
19
20VideoCaptureDevice::Name*
21VideoCaptureDevice::Names::FindById(const std::string& id) {
22  for (iterator it = begin(); it != end(); ++it) {
23    if (it->id() == id)
24      return &(*it);
25  }
26  return NULL;
27}
28
29VideoCaptureDevice::~VideoCaptureDevice() {}
30
31}  // namespace media
32