device_info_impl.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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_DEVICE_INFO_IMPL_H_
  11. #define MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_
  12. #include <stdint.h>
  13. #include <vector>
  14. #include "api/video/video_rotation.h"
  15. #include "modules/video_capture/video_capture.h"
  16. #include "modules/video_capture/video_capture_defines.h"
  17. #include "rtc_base/synchronization/rw_lock_wrapper.h"
  18. namespace webrtc {
  19. namespace videocapturemodule {
  20. class DeviceInfoImpl : public VideoCaptureModule::DeviceInfo {
  21. public:
  22. DeviceInfoImpl();
  23. ~DeviceInfoImpl(void) override;
  24. int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8) override;
  25. int32_t GetCapability(const char* deviceUniqueIdUTF8,
  26. const uint32_t deviceCapabilityNumber,
  27. VideoCaptureCapability& capability) override;
  28. int32_t GetBestMatchedCapability(const char* deviceUniqueIdUTF8,
  29. const VideoCaptureCapability& requested,
  30. VideoCaptureCapability& resulting) override;
  31. int32_t GetOrientation(const char* deviceUniqueIdUTF8,
  32. VideoRotation& orientation) override;
  33. protected:
  34. /* Initialize this object*/
  35. virtual int32_t Init() = 0;
  36. /*
  37. * Fills the member variable _captureCapabilities with capabilities for the
  38. * given device name.
  39. */
  40. virtual int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8) = 0;
  41. protected:
  42. // Data members
  43. typedef std::vector<VideoCaptureCapability> VideoCaptureCapabilities;
  44. VideoCaptureCapabilities _captureCapabilities;
  45. RWLockWrapper& _apiLock;
  46. char* _lastUsedDeviceName;
  47. uint32_t _lastUsedDeviceNameLength;
  48. };
  49. } // namespace videocapturemodule
  50. } // namespace webrtc
  51. #endif // MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_