media_stream_options.h revision 58537e28ecd584eab876aee8be7156509866d23a
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 14namespace content { 15 16// MediaStreamConstraint keys for constraints that are passed to getUserMedia. 17CONTENT_EXPORT extern const char kMediaStreamSource[]; 18CONTENT_EXPORT extern const char kMediaStreamSourceId[]; 19CONTENT_EXPORT extern const char kMediaStreamSourceInfoId[]; 20CONTENT_EXPORT extern const char kMediaStreamSourceTab[]; 21CONTENT_EXPORT extern const char kMediaStreamSourceScreen[]; 22CONTENT_EXPORT extern const char kMediaStreamSourceDesktop[]; 23CONTENT_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. 29CONTENT_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. 34struct 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. 48struct 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 bool opened); 56 StreamDeviceInfo(MediaStreamType service_param, 57 const std::string& name_param, 58 const std::string& device_param, 59 int sample_rate, 60 int channel_layout, 61 int frames_per_buffer, 62 bool opened); 63 static bool IsEqual(const StreamDeviceInfo& first, 64 const StreamDeviceInfo& second); 65 66 MediaStreamDevice device; 67 68 // Set to true if the device has been opened, false otherwise. 69 bool in_use; 70 // Id for this capture session. Unique for all sessions of the same type. 71 int session_id; 72}; 73 74typedef std::vector<StreamDeviceInfo> StreamDeviceInfoArray; 75 76} // namespace content 77 78#endif // CONTENT_COMMON_MEDIA_MEDIA_STREAM_OPTIONS_H_ 79