summaryrefslogtreecommitdiffstats
path: root/content/public/common/media_stream_request.h
blob: df9ce4e29d6ee293a9bf2c53f0832c04beb5244e (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (c) 2012 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_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_
#define CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_

#include <map>
#include <string>
#include <vector>

#include "base/basictypes.h"
#include "content/common/content_export.h"

namespace content {

// Types of media streams.
enum MediaStreamDeviceType {
  MEDIA_STREAM_DEVICE_TYPE_NO_SERVICE = 0,
  MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
  MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE,
  NUM_MEDIA_STREAM_DEVICE_TYPES
};

// Represents one device in a request for media stream(s).
struct CONTENT_EXPORT MediaStreamDevice {
  MediaStreamDevice(
      MediaStreamDeviceType type,
      const std::string& device_id,
      const std::string& name);

  // The device's type.
  MediaStreamDeviceType type;

  // The device's unique ID.
  std::string device_id;

  // The device's "friendly" name. Not guaranteed to be unique.
  std::string name;
};

typedef std::vector<MediaStreamDevice> MediaStreamDevices;

typedef std::map<MediaStreamDeviceType, MediaStreamDevices>
    MediaStreamDeviceMap;

// Represents a request for media streams (audio/video).
struct CONTENT_EXPORT MediaStreamRequest {
  MediaStreamRequest(
      int render_process_id,
      int render_view_id,
      const std::string& security_origin);

  ~MediaStreamRequest();

  // The render process id generating this request.
  int render_process_id;

  // The render view id generating this request.
  int render_view_id;

  // The WebKit security origin for the current request (e.g. "html5rocks.com").
  std::string security_origin;

  // A list of devices present on the user's computer, for each device type
  // requested.
  MediaStreamDeviceMap devices;
};

}  // namespace content

#endif  // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_