1 /* 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_DS_H_ 12 #define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_DS_H_ 13 14 #include "webrtc/modules/video_capture/device_info_impl.h" 15 #include "webrtc/modules/video_capture/video_capture_impl.h" 16 17 #include <Dshow.h> 18 19 namespace webrtc 20 { 21 namespace videocapturemodule 22 { 23 struct VideoCaptureCapabilityWindows: public VideoCaptureCapability 24 { 25 uint32_t directShowCapabilityIndex; 26 bool supportFrameRateControl; VideoCaptureCapabilityWindowsVideoCaptureCapabilityWindows27 VideoCaptureCapabilityWindows() 28 { 29 directShowCapabilityIndex = 0; 30 supportFrameRateControl = false; 31 } 32 }; 33 34 class DeviceInfoDS: public DeviceInfoImpl 35 { 36 public: 37 // Factory function. 38 static DeviceInfoDS* Create(const int32_t id); 39 40 DeviceInfoDS(const int32_t id); 41 virtual ~DeviceInfoDS(); 42 43 int32_t Init(); 44 virtual uint32_t NumberOfDevices(); 45 46 /* 47 * Returns the available capture devices. 48 */ 49 virtual int32_t 50 GetDeviceName(uint32_t deviceNumber, 51 char* deviceNameUTF8, 52 uint32_t deviceNameLength, 53 char* deviceUniqueIdUTF8, 54 uint32_t deviceUniqueIdUTF8Length, 55 char* productUniqueIdUTF8, 56 uint32_t productUniqueIdUTF8Length); 57 58 /* 59 * Display OS /capture device specific settings dialog 60 */ 61 virtual int32_t 62 DisplayCaptureSettingsDialogBox( 63 const char* deviceUniqueIdUTF8, 64 const char* dialogTitleUTF8, 65 void* parentWindow, 66 uint32_t positionX, 67 uint32_t positionY); 68 69 // Windows specific 70 71 /* Gets a capture device filter 72 The user of this API is responsible for releasing the filter when it not needed. 73 */ 74 IBaseFilter * GetDeviceFilter(const char* deviceUniqueIdUTF8, 75 char* productUniqueIdUTF8 = NULL, 76 uint32_t productUniqueIdUTF8Length = 0); 77 78 int32_t 79 GetWindowsCapability(const int32_t capabilityIndex, 80 VideoCaptureCapabilityWindows& windowsCapability); 81 82 static void GetProductId(const char* devicePath, 83 char* productUniqueIdUTF8, 84 uint32_t productUniqueIdUTF8Length); 85 86 protected: 87 int32_t GetDeviceInfo(uint32_t deviceNumber, 88 char* deviceNameUTF8, 89 uint32_t deviceNameLength, 90 char* deviceUniqueIdUTF8, 91 uint32_t deviceUniqueIdUTF8Length, 92 char* productUniqueIdUTF8, 93 uint32_t productUniqueIdUTF8Length); 94 95 virtual int32_t 96 CreateCapabilityMap(const char* deviceUniqueIdUTF8); 97 98 private: 99 ICreateDevEnum* _dsDevEnum; 100 IEnumMoniker* _dsMonikerDevEnum; 101 bool _CoUninitializeIsRequired; 102 std::vector<VideoCaptureCapabilityWindows> _captureCapabilitiesWindows; 103 }; 104 } // namespace videocapturemodule 105 } // namespace webrtc 106 #endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_DS_H_ 107