tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

device_info_impl.h (2371B)


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