blob: 82b446bd8ffb3fd6d3a30bf9d492f7fc6040b388 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
mallinath@webrtc.org12984f02012-02-16 18:18:21 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_
12#define MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
fischman@webrtc.org69fc3152013-09-25 17:01:42 +000014#include <vector>
pbos@webrtc.org4ca7d3f2013-08-12 19:51:57 +000015
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "modules/video_capture/video_capture.h"
Karl Wiberg2b857922018-03-23 14:53:54 +010017#include "rtc_base/synchronization/rw_lock_wrapper.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000018
Yves Gerey665174f2018-06-19 15:03:05 +020019namespace webrtc {
20namespace videocapturemodule {
21class DeviceInfoImpl : public VideoCaptureModule::DeviceInfo {
22 public:
23 DeviceInfoImpl();
Mirko Bonadei5aec1f62018-08-29 13:27:15 +020024 ~DeviceInfoImpl(void) override;
25 int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8) override;
26 int32_t GetCapability(const char* deviceUniqueIdUTF8,
27 const uint32_t deviceCapabilityNumber,
28 VideoCaptureCapability& capability) override;
niklase@google.com470e71d2011-07-07 08:21:25 +000029
Mirko Bonadei5aec1f62018-08-29 13:27:15 +020030 int32_t GetBestMatchedCapability(const char* deviceUniqueIdUTF8,
31 const VideoCaptureCapability& requested,
32 VideoCaptureCapability& resulting) override;
33 int32_t GetOrientation(const char* deviceUniqueIdUTF8,
34 VideoRotation& orientation) override;
niklase@google.com470e71d2011-07-07 08:21:25 +000035
Yves Gerey665174f2018-06-19 15:03:05 +020036 protected:
37 /* Initialize this object*/
niklase@google.com470e71d2011-07-07 08:21:25 +000038
Yves Gerey665174f2018-06-19 15:03:05 +020039 virtual int32_t Init() = 0;
40 /*
41 * Fills the member variable _captureCapabilities with capabilities for the
42 * given device name.
43 */
44 virtual int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000045
Yves Gerey665174f2018-06-19 15:03:05 +020046 protected:
47 // Data members
48 typedef std::vector<VideoCaptureCapability> VideoCaptureCapabilities;
49 VideoCaptureCapabilities _captureCapabilities;
50 RWLockWrapper& _apiLock;
51 char* _lastUsedDeviceName;
52 uint32_t _lastUsedDeviceNameLength;
niklase@google.com470e71d2011-07-07 08:21:25 +000053};
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000054} // namespace videocapturemodule
55} // namespace webrtc
Yves Gerey665174f2018-06-19 15:03:05 +020056#endif // MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_