blob: 2bae6b30a41de0acce7c32a7d3f3394226c88e42 [file] [log] [blame]
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +00001/*
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_WINDOWS_H_
12#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_WINDOWS_H_
13
14#include "../video_capture_impl.h"
15#include "../device_info_impl.h"
16
17#include <Dshow.h>
18#include "map_wrapper.h"
19
20// forward declarations
21namespace webrtc
22{
23namespace videocapturemodule
24{
25struct VideoCaptureCapabilityWindows: public VideoCaptureCapability
26{
27 WebRtc_UWord32 directShowCapabilityIndex;
28 bool supportFrameRateControl;
29 VideoCaptureCapabilityWindows()
30 {
31 directShowCapabilityIndex = 0;
32 supportFrameRateControl = false;
33 }
34
35};
36class DeviceInfoWindows: public DeviceInfoImpl
37{
38public:
39 DeviceInfoWindows(const WebRtc_Word32 id);
40 virtual ~DeviceInfoWindows();
41
42 WebRtc_Word32 Init();
43 virtual WebRtc_UWord32 NumberOfDevices();
44
45 /*
46 * Returns the available capture devices.
47 */
48 virtual WebRtc_Word32
49 GetDeviceName(WebRtc_UWord32 deviceNumber,
50 char* deviceNameUTF8,
51 WebRtc_UWord32 deviceNameLength,
52 char* deviceUniqueIdUTF8,
53 WebRtc_UWord32 deviceUniqueIdUTF8Length,
54 char* productUniqueIdUTF8,
55 WebRtc_UWord32 productUniqueIdUTF8Length);
56
57 /*
58 * Display OS /capture device specific settings dialog
59 */
60 virtual WebRtc_Word32
61 DisplayCaptureSettingsDialogBox(
62 const char* deviceUniqueIdUTF8,
63 const char* dialogTitleUTF8,
64 void* parentWindow,
65 WebRtc_UWord32 positionX,
66 WebRtc_UWord32 positionY);
67
68 // Windows specific
69
70 /* Gets a capture device filter
71 The user of this API is responsible for releasing the filter when it not needed.
72 */
73 IBaseFilter * GetDeviceFilter(const char* deviceUniqueIdUTF8,
74 char* productUniqueIdUTF8 = NULL,
75 WebRtc_UWord32 productUniqueIdUTF8Length = 0);
76
77 WebRtc_Word32
78 GetWindowsCapability(const WebRtc_Word32 capabilityIndex,
79 VideoCaptureCapabilityWindows& windowsCapability);
80
81 static void GetProductId(const char* devicePath,
82 char* productUniqueIdUTF8,
83 WebRtc_UWord32 productUniqueIdUTF8Length);
84protected:
85
86 WebRtc_Word32 GetDeviceInfo(WebRtc_UWord32 deviceNumber,
87 char* deviceNameUTF8,
88 WebRtc_UWord32 deviceNameLength,
89 char* deviceUniqueIdUTF8,
90 WebRtc_UWord32 deviceUniqueIdUTF8Length,
91 char* productUniqueIdUTF8,
92 WebRtc_UWord32 productUniqueIdUTF8Length);
93
94 virtual WebRtc_Word32
95 CreateCapabilityMap(const char* deviceUniqueIdUTF8);
96
97private:
98 ICreateDevEnum* _dsDevEnum;
99 IEnumMoniker* _dsMonikerDevEnum;
100 bool _CoUninitializeIsRequired;
101
102};
103} // namespace videocapturemodule
104} // namespace webrtc
105#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_WINDOWS_H_