blob: f6e197007b290ef472da9d493f6b5ae3d148ddd5 [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();
24 virtual ~DeviceInfoImpl(void);
25 virtual int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8);
26 virtual int32_t GetCapability(const char* deviceUniqueIdUTF8,
27 const uint32_t deviceCapabilityNumber,
28 VideoCaptureCapability& capability);
niklase@google.com470e71d2011-07-07 08:21:25 +000029
Yves Gerey665174f2018-06-19 15:03:05 +020030 virtual int32_t GetBestMatchedCapability(
31 const char* deviceUniqueIdUTF8,
32 const VideoCaptureCapability& requested,
33 VideoCaptureCapability& resulting);
34 virtual int32_t GetOrientation(const char* deviceUniqueIdUTF8,
35 VideoRotation& orientation);
niklase@google.com470e71d2011-07-07 08:21:25 +000036
Yves Gerey665174f2018-06-19 15:03:05 +020037 protected:
38 /* Initialize this object*/
niklase@google.com470e71d2011-07-07 08:21:25 +000039
Yves Gerey665174f2018-06-19 15:03:05 +020040 virtual int32_t Init() = 0;
41 /*
42 * Fills the member variable _captureCapabilities with capabilities for the
43 * given device name.
44 */
45 virtual int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000046
Yves Gerey665174f2018-06-19 15:03:05 +020047 protected:
48 // Data members
49 typedef std::vector<VideoCaptureCapability> VideoCaptureCapabilities;
50 VideoCaptureCapabilities _captureCapabilities;
51 RWLockWrapper& _apiLock;
52 char* _lastUsedDeviceName;
53 uint32_t _lastUsedDeviceNameLength;
niklase@google.com470e71d2011-07-07 08:21:25 +000054};
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000055} // namespace videocapturemodule
56} // namespace webrtc
Yves Gerey665174f2018-06-19 15:03:05 +020057#endif // MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_