1 // Copyright 2016 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 THIRD_PARTY_BLINK_PUBLIC_COMMON_MEDIASTREAM_MEDIA_DEVICES_H_ 6 #define THIRD_PARTY_BLINK_PUBLIC_COMMON_MEDIASTREAM_MEDIA_DEVICES_H_ 7 8 #include <string> 9 #include <vector> 10 11 #include "media/base/video_facing.h" 12 #include "third_party/blink/public/common/common_export.h" 13 14 namespace media { 15 struct VideoCaptureDeviceDescriptor; 16 } // namespace media 17 18 namespace blink { 19 20 enum MediaDeviceType { 21 MEDIA_DEVICE_TYPE_AUDIO_INPUT, 22 MEDIA_DEVICE_TYPE_VIDEO_INPUT, 23 MEDIA_DEVICE_TYPE_AUDIO_OUTPUT, 24 NUM_MEDIA_DEVICE_TYPES, 25 }; 26 27 struct BLINK_COMMON_EXPORT WebMediaDeviceInfo { 28 WebMediaDeviceInfo(); 29 WebMediaDeviceInfo(const WebMediaDeviceInfo& other); 30 WebMediaDeviceInfo(WebMediaDeviceInfo&& other); 31 WebMediaDeviceInfo( 32 const std::string& device_id, 33 const std::string& label, 34 const std::string& group_id, 35 media::VideoFacingMode video_facing = media::MEDIA_VIDEO_FACING_NONE); 36 explicit WebMediaDeviceInfo( 37 const media::VideoCaptureDeviceDescriptor& descriptor); 38 ~WebMediaDeviceInfo(); 39 WebMediaDeviceInfo& operator=(const WebMediaDeviceInfo& other); 40 WebMediaDeviceInfo& operator=(WebMediaDeviceInfo&& other); 41 42 std::string device_id; 43 std::string label; 44 std::string group_id; 45 media::VideoFacingMode video_facing; 46 }; 47 48 using WebMediaDeviceInfoArray = std::vector<WebMediaDeviceInfo>; 49 50 BLINK_COMMON_EXPORT bool operator==(const WebMediaDeviceInfo& first, 51 const WebMediaDeviceInfo& second); 52 IsValidMediaDeviceType(MediaDeviceType type)53inline bool IsValidMediaDeviceType(MediaDeviceType type) { 54 return type >= 0 && type < NUM_MEDIA_DEVICE_TYPES; 55 } 56 57 } // namespace blink 58 59 #endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_MEDIASTREAM_MEDIA_DEVICES_H_ 60