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> |
fischman@webrtc.org | 69fc315 | 2013-09-25 17:01:42 +0000 | [diff] [blame] | 15 | #include <vector> |
pbos@webrtc.org | 4ca7d3f | 2013-08-12 19:51:57 +0000 | [diff] [blame] | 16 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame^] | 17 | #include "api/video/video_rotation.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 18 | #include "modules/video_capture/video_capture.h" |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame^] | 19 | #include "modules/video_capture/video_capture_defines.h" |
Karl Wiberg | 2b85792 | 2018-03-23 14:53:54 +0100 | [diff] [blame] | 20 | #include "rtc_base/synchronization/rw_lock_wrapper.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 21 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 22 | namespace webrtc { |
| 23 | namespace videocapturemodule { |
| 24 | class DeviceInfoImpl : public VideoCaptureModule::DeviceInfo { |
| 25 | public: |
| 26 | DeviceInfoImpl(); |
Mirko Bonadei | 5aec1f6 | 2018-08-29 13:27:15 +0200 | [diff] [blame] | 27 | ~DeviceInfoImpl(void) override; |
| 28 | int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8) override; |
| 29 | int32_t GetCapability(const char* deviceUniqueIdUTF8, |
| 30 | const uint32_t deviceCapabilityNumber, |
| 31 | VideoCaptureCapability& capability) override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 32 | |
Mirko Bonadei | 5aec1f6 | 2018-08-29 13:27:15 +0200 | [diff] [blame] | 33 | int32_t GetBestMatchedCapability(const char* deviceUniqueIdUTF8, |
| 34 | const VideoCaptureCapability& requested, |
| 35 | VideoCaptureCapability& resulting) override; |
| 36 | int32_t GetOrientation(const char* deviceUniqueIdUTF8, |
| 37 | VideoRotation& orientation) override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 38 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 39 | protected: |
| 40 | /* Initialize this object*/ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 41 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 42 | virtual int32_t Init() = 0; |
| 43 | /* |
| 44 | * Fills the member variable _captureCapabilities with capabilities for the |
| 45 | * given device name. |
| 46 | */ |
| 47 | virtual int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 48 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 49 | protected: |
| 50 | // Data members |
| 51 | typedef std::vector<VideoCaptureCapability> VideoCaptureCapabilities; |
| 52 | VideoCaptureCapabilities _captureCapabilities; |
| 53 | RWLockWrapper& _apiLock; |
| 54 | char* _lastUsedDeviceName; |
| 55 | uint32_t _lastUsedDeviceNameLength; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 56 | }; |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 57 | } // namespace videocapturemodule |
| 58 | } // namespace webrtc |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 59 | #endif // MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_ |