tor-browser

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

device_info_fake.h (2383B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef DOM_MEDIA_SYSTEMSERVICES_FAKE_VIDEO_CAPTURE_DEVICE_INFO_FAKE_H_
      8 #define DOM_MEDIA_SYSTEMSERVICES_FAKE_VIDEO_CAPTURE_DEVICE_INFO_FAKE_H_
      9 
     10 #include "modules/video_capture/device_info_impl.h"
     11 
     12 namespace webrtc::videocapturemodule {
     13 
     14 /**
     15 * DeviceInfo implementation for the MediaEngineFakeVideoSource, so it can be
     16 * used in place of a real backend, allowing to exercise
     17 * PCameras/VideoEngine/CaptureCapabilities code without needing a real device
     18 * on a given platform.
     19 */
     20 class DeviceInfoFake : public DeviceInfoImpl {
     21 public:
     22  ~DeviceInfoFake() override = default;
     23 
     24  // Implementation of DeviceInfoImpl.
     25  int32_t Init() override { return 0; }
     26  uint32_t NumberOfDevices() override { return 1; }
     27  int32_t GetDeviceName(uint32_t aDeviceNumber, char* aDeviceNameUTF8,
     28                        uint32_t aDeviceNameLength, char* aDeviceUniqueIdUTF8,
     29                        uint32_t aDeviceUniqueIdUTF8Length,
     30                        char* aProductUniqueIdUTF8 = nullptr,
     31                        uint32_t aProductUniqueIdUTF8Length = 0,
     32                        pid_t* aPid = nullptr,
     33                        bool* deviceIsPlaceholder = 0) override;
     34  int32_t NumberOfCapabilities(const char* aDeviceUniqueIdUTF8) override;
     35  int32_t GetCapability(const char* aDeviceUniqueIdUTF8,
     36                        const uint32_t aDeviceCapabilityNumber,
     37                        VideoCaptureCapability& aCapability) override;
     38  int32_t DisplayCaptureSettingsDialogBox(const char* aDeviceUniqueIdUTF8,
     39                                          const char* aDialogTitleUTF8,
     40                                          void* aParentWindow,
     41                                          uint32_t aPositionX,
     42                                          uint32_t aPositionY) override {
     43    return -1;
     44  }
     45  int32_t CreateCapabilityMap(const char* aDeviceUniqueIdUTF8) override {
     46    return -1;
     47  }
     48 
     49  static constexpr const char* kName = "Fake Video Source";
     50  static constexpr const char* kId = "fake-video-source-0";
     51 };
     52 
     53 }  // namespace webrtc::videocapturemodule
     54 
     55 #endif