device_info_ds.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. #ifndef MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_DS_H_
  11. #define MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_DS_H_
  12. #include <dshow.h>
  13. #include "modules/video_capture/device_info_impl.h"
  14. #include "modules/video_capture/video_capture_impl.h"
  15. namespace webrtc {
  16. namespace videocapturemodule {
  17. struct VideoCaptureCapabilityWindows : public VideoCaptureCapability {
  18. uint32_t directShowCapabilityIndex;
  19. bool supportFrameRateControl;
  20. VideoCaptureCapabilityWindows() {
  21. directShowCapabilityIndex = 0;
  22. supportFrameRateControl = false;
  23. }
  24. };
  25. class DeviceInfoDS : public DeviceInfoImpl {
  26. public:
  27. // Factory function.
  28. static DeviceInfoDS* Create();
  29. DeviceInfoDS();
  30. ~DeviceInfoDS() override;
  31. int32_t Init() override;
  32. uint32_t NumberOfDevices() override;
  33. /*
  34. * Returns the available capture devices.
  35. */
  36. int32_t GetDeviceName(uint32_t deviceNumber,
  37. char* deviceNameUTF8,
  38. uint32_t deviceNameLength,
  39. char* deviceUniqueIdUTF8,
  40. uint32_t deviceUniqueIdUTF8Length,
  41. char* productUniqueIdUTF8,
  42. uint32_t productUniqueIdUTF8Length) override;
  43. /*
  44. * Display OS /capture device specific settings dialog
  45. */
  46. int32_t DisplayCaptureSettingsDialogBox(const char* deviceUniqueIdUTF8,
  47. const char* dialogTitleUTF8,
  48. void* parentWindow,
  49. uint32_t positionX,
  50. uint32_t positionY) override;
  51. // Windows specific
  52. /* Gets a capture device filter
  53. The user of this API is responsible for releasing the filter when it not
  54. needed.
  55. */
  56. IBaseFilter* GetDeviceFilter(const char* deviceUniqueIdUTF8,
  57. char* productUniqueIdUTF8 = NULL,
  58. uint32_t productUniqueIdUTF8Length = 0);
  59. int32_t GetWindowsCapability(
  60. const int32_t capabilityIndex,
  61. VideoCaptureCapabilityWindows& windowsCapability);
  62. static void GetProductId(const char* devicePath,
  63. char* productUniqueIdUTF8,
  64. uint32_t productUniqueIdUTF8Length);
  65. protected:
  66. int32_t GetDeviceInfo(uint32_t deviceNumber,
  67. char* deviceNameUTF8,
  68. uint32_t deviceNameLength,
  69. char* deviceUniqueIdUTF8,
  70. uint32_t deviceUniqueIdUTF8Length,
  71. char* productUniqueIdUTF8,
  72. uint32_t productUniqueIdUTF8Length);
  73. int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8) override;
  74. private:
  75. ICreateDevEnum* _dsDevEnum;
  76. IEnumMoniker* _dsMonikerDevEnum;
  77. bool _CoUninitializeIsRequired;
  78. std::vector<VideoCaptureCapabilityWindows> _captureCapabilitiesWindows;
  79. };
  80. } // namespace videocapturemodule
  81. } // namespace webrtc
  82. #endif // MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_DS_H_