• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <stdint.h>
15 
16 #include <vector>
17 
18 #include "api/video/video_rotation.h"
19 #include "modules/video_capture/video_capture.h"
20 #include "modules/video_capture/video_capture_defines.h"
21 #include "rtc_base/synchronization/rw_lock_wrapper.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                         const 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   /*
45    * Fills the member variable _captureCapabilities with capabilities for the
46    * given device name.
47    */
48   virtual int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8) = 0;
49 
50  protected:
51   // Data members
52   typedef std::vector<VideoCaptureCapability> VideoCaptureCapabilities;
53   VideoCaptureCapabilities _captureCapabilities;
54   RWLockWrapper& _apiLock;
55   char* _lastUsedDeviceName;
56   uint32_t _lastUsedDeviceNameLength;
57 };
58 }  // namespace videocapturemodule
59 }  // namespace webrtc
60 #endif  // MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_
61