1 // Copyright (c) 2012 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.
5 #ifndef CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_
6 #define CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_
12 #include "base/basictypes.h"
13 #include "content/common/content_export.h"
14 #include "googleurl/src/gurl.h"
18 // Types of media streams.
19 enum MediaStreamDeviceType
{
22 // A device provided by the operating system (e.g., webcam input).
23 MEDIA_DEVICE_AUDIO_CAPTURE
,
24 MEDIA_DEVICE_VIDEO_CAPTURE
,
26 // Mirroring of a browser tab.
27 MEDIA_TAB_AUDIO_CAPTURE
,
28 MEDIA_TAB_VIDEO_CAPTURE
,
33 // Convenience predicates to determine whether the given type represents some
34 // audio or some video device.
35 CONTENT_EXPORT
bool IsAudioMediaType(MediaStreamDeviceType type
);
36 CONTENT_EXPORT
bool IsVideoMediaType(MediaStreamDeviceType type
);
38 // TODO(xians): Change the structs to classes.
39 // Represents one device in a request for media stream(s).
40 struct CONTENT_EXPORT MediaStreamDevice
{
42 MediaStreamDeviceType type
,
43 const std::string
& device_id
,
44 const std::string
& name
);
49 MediaStreamDeviceType type
;
51 // The device's unique ID.
52 std::string device_id
;
54 // The device's "friendly" name. Not guaranteed to be unique.
58 typedef std::vector
<MediaStreamDevice
> MediaStreamDevices
;
60 typedef std::map
<MediaStreamDeviceType
, MediaStreamDevices
>
63 // Represents a request for media streams (audio/video).
64 struct CONTENT_EXPORT MediaStreamRequest
{
66 int render_process_id
,
68 const GURL
& security_origin
);
70 ~MediaStreamRequest();
72 // The render process id generating this request.
73 int render_process_id
;
75 // The render view id generating this request.
78 // The WebKit security origin for the current request (e.g. "html5rocks.com").
81 // A list of devices present on the user's computer, for each device type
83 // All the elements in this map will be deleted in ~MediaStreamRequest().
84 MediaStreamDeviceMap devices
;
87 } // namespace content
89 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_