summaryrefslogtreecommitdiff
path: root/chromium/content/common/media/media_devices.h
blob: c0cd354d258aef7d09e3b149bd997ba21987f671 (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
51
52
53
54
55
56
57
58
// Copyright 2016 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.

#ifndef CONTENT_COMMON_MEDIA_MEDIA_DEVICES_H_
#define CONTENT_COMMON_MEDIA_MEDIA_DEVICES_H_

#include <string>
#include <vector>

#include "content/common/content_export.h"
#include "media/base/video_facing.h"

namespace media {
struct AudioDeviceDescription;
struct VideoCaptureDeviceDescriptor;
}

namespace content {

enum MediaDeviceType {
  MEDIA_DEVICE_TYPE_AUDIO_INPUT,
  MEDIA_DEVICE_TYPE_VIDEO_INPUT,
  MEDIA_DEVICE_TYPE_AUDIO_OUTPUT,
  NUM_MEDIA_DEVICE_TYPES,
};

struct CONTENT_EXPORT MediaDeviceInfo {
  MediaDeviceInfo();
  MediaDeviceInfo(const MediaDeviceInfo& other);
  MediaDeviceInfo(MediaDeviceInfo&& other);
  MediaDeviceInfo(const std::string& device_id,
                  const std::string& label,
                  const std::string& group_id);
  explicit MediaDeviceInfo(const media::AudioDeviceDescription& description);
  explicit MediaDeviceInfo(
      const media::VideoCaptureDeviceDescriptor& descriptor);
  ~MediaDeviceInfo();
  MediaDeviceInfo& operator=(const MediaDeviceInfo& other);
  MediaDeviceInfo& operator=(MediaDeviceInfo&& other);

  std::string device_id;
  std::string label;
  std::string group_id;
  media::VideoFacingMode video_facing;
};

using MediaDeviceInfoArray = std::vector<MediaDeviceInfo>;

bool operator==(const MediaDeviceInfo& first, const MediaDeviceInfo& second);

inline bool IsValidMediaDeviceType(MediaDeviceType type) {
  return type >= 0 && type < NUM_MEDIA_DEVICE_TYPES;
}

}  // namespace content

#endif  // CONTENT_COMMON_MEDIA_MEDIA_DEVICES_H_