niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
mallinath@webrtc.org | 12984f0 | 2012-02-16 18:18:21 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_ |
| 12 | #define MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 14 | #include <stdint.h> |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 15 | |
fischman@webrtc.org | 69fc315 | 2013-09-25 17:01:42 +0000 | [diff] [blame] | 16 | #include <vector> |
pbos@webrtc.org | 4ca7d3f | 2013-08-12 19:51:57 +0000 | [diff] [blame] | 17 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 18 | #include "api/video/video_rotation.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 19 | #include "modules/video_capture/video_capture.h" |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 20 | #include "modules/video_capture/video_capture_defines.h" |
Niels Möller | 5b5de21 | 2020-10-28 17:18:56 +0100 | [diff] [blame] | 21 | #include "rtc_base/synchronization/mutex.h" |
| 22 | #include "rtc_base/thread_annotations.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 23 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 24 | namespace webrtc { |
| 25 | namespace videocapturemodule { |
| 26 | class DeviceInfoImpl : public VideoCaptureModule::DeviceInfo { |
| 27 | public: |
| 28 | DeviceInfoImpl(); |
Mirko Bonadei | 5aec1f6 | 2018-08-29 13:27:15 +0200 | [diff] [blame] | 29 | ~DeviceInfoImpl(void) override; |
| 30 | int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8) override; |
| 31 | int32_t GetCapability(const char* deviceUniqueIdUTF8, |
Ali Tofigh | 6223809 | 2022-01-25 13:27:19 +0100 | [diff] [blame] | 32 | uint32_t deviceCapabilityNumber, |
Mirko Bonadei | 5aec1f6 | 2018-08-29 13:27:15 +0200 | [diff] [blame] | 33 | VideoCaptureCapability& capability) override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 34 | |
Mirko Bonadei | 5aec1f6 | 2018-08-29 13:27:15 +0200 | [diff] [blame] | 35 | int32_t GetBestMatchedCapability(const char* deviceUniqueIdUTF8, |
| 36 | const VideoCaptureCapability& requested, |
| 37 | VideoCaptureCapability& resulting) override; |
| 38 | int32_t GetOrientation(const char* deviceUniqueIdUTF8, |
| 39 | VideoRotation& orientation) override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 40 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 41 | protected: |
| 42 | /* Initialize this object*/ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 43 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 44 | virtual int32_t Init() = 0; |
| 45 | /* |
| 46 | * Fills the member variable _captureCapabilities with capabilities for the |
| 47 | * given device name. |
| 48 | */ |
Niels Möller | 5b5de21 | 2020-10-28 17:18:56 +0100 | [diff] [blame] | 49 | virtual int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8) |
| 50 | RTC_EXCLUSIVE_LOCKS_REQUIRED(_apiLock) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 51 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 52 | protected: |
| 53 | // Data members |
| 54 | typedef std::vector<VideoCaptureCapability> VideoCaptureCapabilities; |
Niels Möller | 5b5de21 | 2020-10-28 17:18:56 +0100 | [diff] [blame] | 55 | VideoCaptureCapabilities _captureCapabilities RTC_GUARDED_BY(_apiLock); |
| 56 | Mutex _apiLock; |
| 57 | char* _lastUsedDeviceName RTC_GUARDED_BY(_apiLock); |
| 58 | uint32_t _lastUsedDeviceNameLength RTC_GUARDED_BY(_apiLock); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 59 | }; |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 60 | } // namespace videocapturemodule |
| 61 | } // namespace webrtc |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 62 | #endif // MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_ |