blob: 0f711965b0e459ea2e44db496992d2c4c5a6877f [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
leozwang@webrtc.org1745e932012-03-01 16:30:40 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
tommi@webrtc.org81878772012-11-20 13:35:33 +000011#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_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
pbos@webrtc.orga9b74ad2013-07-12 10:03:52 +000014#include "webrtc/modules/video_capture/device_info_impl.h"
15#include "webrtc/modules/video_capture/video_capture_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000016
17#include <Dshow.h>
niklase@google.com470e71d2011-07-07 08:21:25 +000018
niklase@google.com470e71d2011-07-07 08:21:25 +000019namespace webrtc
20{
21namespace videocapturemodule
22{
23struct VideoCaptureCapabilityWindows: public VideoCaptureCapability
24{
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000025 uint32_t directShowCapabilityIndex;
niklase@google.com470e71d2011-07-07 08:21:25 +000026 bool supportFrameRateControl;
27 VideoCaptureCapabilityWindows()
28 {
29 directShowCapabilityIndex = 0;
30 supportFrameRateControl = false;
31 }
niklase@google.com470e71d2011-07-07 08:21:25 +000032};
fischman@webrtc.org69fc3152013-09-25 17:01:42 +000033
tommi@webrtc.org81878772012-11-20 13:35:33 +000034class DeviceInfoDS: public DeviceInfoImpl
niklase@google.com470e71d2011-07-07 08:21:25 +000035{
36public:
tommi@webrtc.org81878772012-11-20 13:35:33 +000037 // Factory function.
nisseb29b9c82016-12-12 00:22:56 -080038 static DeviceInfoDS* Create();
tommi@webrtc.org81878772012-11-20 13:35:33 +000039
nisseb29b9c82016-12-12 00:22:56 -080040 DeviceInfoDS();
tommi@webrtc.org81878772012-11-20 13:35:33 +000041 virtual ~DeviceInfoDS();
niklase@google.com470e71d2011-07-07 08:21:25 +000042
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000043 int32_t Init();
44 virtual uint32_t NumberOfDevices();
niklase@google.com470e71d2011-07-07 08:21:25 +000045
46 /*
47 * Returns the available capture devices.
48 */
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000049 virtual int32_t
50 GetDeviceName(uint32_t deviceNumber,
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000051 char* deviceNameUTF8,
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000052 uint32_t deviceNameLength,
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000053 char* deviceUniqueIdUTF8,
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000054 uint32_t deviceUniqueIdUTF8Length,
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000055 char* productUniqueIdUTF8,
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000056 uint32_t productUniqueIdUTF8Length);
niklase@google.com470e71d2011-07-07 08:21:25 +000057
fischman@webrtc.org69fc3152013-09-25 17:01:42 +000058 /*
niklase@google.com470e71d2011-07-07 08:21:25 +000059 * Display OS /capture device specific settings dialog
60 */
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000061 virtual int32_t
niklase@google.com470e71d2011-07-07 08:21:25 +000062 DisplayCaptureSettingsDialogBox(
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000063 const char* deviceUniqueIdUTF8,
64 const char* dialogTitleUTF8,
niklase@google.com470e71d2011-07-07 08:21:25 +000065 void* parentWindow,
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000066 uint32_t positionX,
67 uint32_t positionY);
niklase@google.com470e71d2011-07-07 08:21:25 +000068
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 */
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000074 IBaseFilter * GetDeviceFilter(const char* deviceUniqueIdUTF8,
75 char* productUniqueIdUTF8 = NULL,
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000076 uint32_t productUniqueIdUTF8Length = 0);
niklase@google.com470e71d2011-07-07 08:21:25 +000077
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000078 int32_t
79 GetWindowsCapability(const int32_t capabilityIndex,
niklase@google.com470e71d2011-07-07 08:21:25 +000080 VideoCaptureCapabilityWindows& windowsCapability);
81
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000082 static void GetProductId(const char* devicePath,
83 char* productUniqueIdUTF8,
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000084 uint32_t productUniqueIdUTF8Length);
tommi@webrtc.org951b6c42012-11-20 12:17:05 +000085
tommi@webrtc.org81878772012-11-20 13:35:33 +000086protected:
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000087 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);
niklase@google.com470e71d2011-07-07 08:21:25 +000094
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000095 virtual int32_t
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000096 CreateCapabilityMap(const char* deviceUniqueIdUTF8);
niklase@google.com470e71d2011-07-07 08:21:25 +000097
98private:
99 ICreateDevEnum* _dsDevEnum;
100 IEnumMoniker* _dsMonikerDevEnum;
101 bool _CoUninitializeIsRequired;
fischman@webrtc.org69fc3152013-09-25 17:01:42 +0000102 std::vector<VideoCaptureCapabilityWindows> _captureCapabilitiesWindows;
niklase@google.com470e71d2011-07-07 08:21:25 +0000103};
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +0000104} // namespace videocapturemodule
105} // namespace webrtc
tommi@webrtc.org81878772012-11-20 13:35:33 +0000106#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_DS_H_