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 kMediaStreamSourceSystem[]; 23 24 // StreamOptions is a Chromium representation of WebKit's 25 // WebUserMediaRequest Options. It describes the components 26 // in a request for a new media stream. 27 struct CONTENT_EXPORT StreamOptions { 28 StreamOptions(); 29 StreamOptions(MediaStreamType audio_type, MediaStreamType video_type); 30 31 // If not NO_SERVICE, the stream shall contain an audio input stream. 32 MediaStreamType audio_type; 33 std::string audio_device_id; 34 35 // If not NO_SERVICE, the stream shall contain a video input stream. 36 MediaStreamType video_type; 37 std::string video_device_id; 38 }; 39 40 // StreamDeviceInfo describes information about a device. 41 struct CONTENT_EXPORT StreamDeviceInfo { 42 static const int kNoId; 43 44 StreamDeviceInfo(); 45 StreamDeviceInfo(MediaStreamType service_param, 46 const std::string& name_param, 47 const std::string& device_param, 48 bool opened); 49 StreamDeviceInfo(MediaStreamType service_param, 50 const std::string& name_param, 51 const std::string& device_param, 52 int sample_rate, 53 int channel_layout, 54 bool opened); 55 static bool IsEqual(const StreamDeviceInfo& first, 56 const StreamDeviceInfo& second); 57 58 MediaStreamDevice device; 59 // Set to true if the device has been opened, false otherwise. 60 bool in_use; 61 // Id for this capture session. Unique for all sessions of the same type. 62 int session_id; 63 }; 64 65 typedef std::vector<StreamDeviceInfo> StreamDeviceInfoArray; 66 67 } // namespace content 68 69 #endif // CONTENT_COMMON_MEDIA_MEDIA_STREAM_OPTIONS_H_ 70