blob: 37a457ce8a4ff836971e02f38342a6a2f3adbcf4 [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
Yves Gerey3e707812018-11-28 16:47:49 +010014#include <stdint.h>
Jonas Olssona4d87372019-07-05 19:08:33 +020015
fischman@webrtc.org69fc3152013-09-25 17:01:42 +000016#include <vector>
pbos@webrtc.org4ca7d3f2013-08-12 19:51:57 +000017
Yves Gerey3e707812018-11-28 16:47:49 +010018#include "api/video/video_rotation.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020019#include "modules/video_capture/video_capture.h"
Yves Gerey3e707812018-11-28 16:47:49 +010020#include "modules/video_capture/video_capture_defines.h"
Karl Wiberg2b857922018-03-23 14:53:54 +010021#include "rtc_base/synchronization/rw_lock_wrapper.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000022
Yves Gerey665174f2018-06-19 15:03:05 +020023namespace webrtc {
24namespace videocapturemodule {
25class DeviceInfoImpl : public VideoCaptureModule::DeviceInfo {
26 public:
27 DeviceInfoImpl();
Mirko Bonadei5aec1f62018-08-29 13:27:15 +020028 ~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;
niklase@google.com470e71d2011-07-07 08:21:25 +000033
Mirko Bonadei5aec1f62018-08-29 13:27:15 +020034 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;
niklase@google.com470e71d2011-07-07 08:21:25 +000039
Yves Gerey665174f2018-06-19 15:03:05 +020040 protected:
41 /* Initialize this object*/
niklase@google.com470e71d2011-07-07 08:21:25 +000042
Yves Gerey665174f2018-06-19 15:03:05 +020043 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;
niklase@google.com470e71d2011-07-07 08:21:25 +000049
Yves Gerey665174f2018-06-19 15:03:05 +020050 protected:
51 // Data members
52 typedef std::vector<VideoCaptureCapability> VideoCaptureCapabilities;
53 VideoCaptureCapabilities _captureCapabilities;
54 RWLockWrapper& _apiLock;
55 char* _lastUsedDeviceName;
56 uint32_t _lastUsedDeviceNameLength;
niklase@google.com470e71d2011-07-07 08:21:25 +000057};
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000058} // namespace videocapturemodule
59} // namespace webrtc
Yves Gerey665174f2018-06-19 15:03:05 +020060#endif // MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_