summaryrefslogtreecommitdiff
path: root/chromium/media/video/capture/video_capture_device.cc
blob: 4175412138f00470ea8628775e2acbdcbef3f0fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "media/video/capture/video_capture_device.h"
#include "base/strings/string_util.h"

namespace media {

const std::string VideoCaptureDevice::Name::GetNameAndModel() const {
  const std::string model_id = GetModel();
  if (model_id.empty())
    return device_name_;
  const std::string suffix = " (" + model_id + ")";
  if (EndsWith(device_name_, suffix, true))  // |true| means case-sensitive.
    return device_name_;
  return device_name_ + suffix;
}

VideoCaptureDevice::Name*
VideoCaptureDevice::Names::FindById(const std::string& id) {
  for (iterator it = begin(); it != end(); ++it) {
    if (it->id() == id)
      return &(*it);
  }
  return NULL;
}

VideoCaptureDevice::~VideoCaptureDevice() {}

VideoCaptureDevice1::VideoCaptureDevice1() {}

VideoCaptureDevice1::~VideoCaptureDevice1() {}

void VideoCaptureDevice1::AllocateAndStart(
    const VideoCaptureCapability& capture_format,
    scoped_ptr<EventHandler> client) {
  client_ = client.Pass();
  Allocate(capture_format, client_.get());
  Start();
}

void VideoCaptureDevice1::StopAndDeAllocate() {
  Stop();
  DeAllocate();
  client_.reset();
};


}  // namespace media