- add sources.
[platform/framework/web/crosswalk.git] / src / content / common / media / media_stream_options.h
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.
4
5 #ifndef CONTENT_COMMON_MEDIA_MEDIA_STREAM_OPTIONS_H_
6 #define CONTENT_COMMON_MEDIA_MEDIA_STREAM_OPTIONS_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "content/common/content_export.h"
12 #include "content/public/common/media_stream_request.h"
13
14 namespace content {
15
16 // MediaStreamConstraint keys for constraints that are passed to getUserMedia.
17 CONTENT_EXPORT extern const char kMediaStreamSource[];
18 CONTENT_EXPORT extern const char kMediaStreamSourceId[];
19 CONTENT_EXPORT extern const char kMediaStreamSourceInfoId[];
20 CONTENT_EXPORT extern const char kMediaStreamSourceTab[];
21 CONTENT_EXPORT extern const char kMediaStreamSourceScreen[];
22 CONTENT_EXPORT extern const char kMediaStreamSourceDesktop[];
23 CONTENT_EXPORT extern const char kMediaStreamSourceSystem[];
24
25 // Experimental constraint to do device matching.  When this optional constraint
26 // is set, WebRTC audio renderer will render audio from media streams to an
27 // output device that belongs to the same hardware as the requested source
28 // device belongs to.
29 CONTENT_EXPORT extern const char kMediaStreamRenderToAssociatedSink[];
30
31 // StreamOptions is a Chromium representation of WebKit's
32 // WebUserMediaRequest Options. It describes the components
33 // in a request for a new media stream.
34 struct CONTENT_EXPORT StreamOptions {
35   StreamOptions();
36   StreamOptions(MediaStreamType audio_type, MediaStreamType video_type);
37
38   // If not NO_SERVICE, the stream shall contain an audio input stream.
39   MediaStreamType audio_type;
40   std::string audio_device_id;
41
42   // If not NO_SERVICE, the stream shall contain a video input stream.
43   MediaStreamType video_type;
44   std::string video_device_id;
45 };
46
47 // StreamDeviceInfo describes information about a device.
48 struct CONTENT_EXPORT StreamDeviceInfo {
49   static const int kNoId;
50
51   StreamDeviceInfo();
52   StreamDeviceInfo(MediaStreamType service_param,
53                    const std::string& name_param,
54                    const std::string& device_param);
55   StreamDeviceInfo(MediaStreamType service_param,
56                    const std::string& name_param,
57                    const std::string& device_param,
58                    int sample_rate,
59                    int channel_layout,
60                    int frames_per_buffer);
61   static bool IsEqual(const StreamDeviceInfo& first,
62                       const StreamDeviceInfo& second);
63
64   MediaStreamDevice device;
65
66   // Id for this capture session. Unique for all sessions of the same type.
67   int session_id;
68 };
69
70 typedef std::vector<StreamDeviceInfo> StreamDeviceInfoArray;
71
72 }  // namespace content
73
74 #endif  // CONTENT_COMMON_MEDIA_MEDIA_STREAM_OPTIONS_H_