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 | |
| 11 | #ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_ |
| 12 | #define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_ |
| 13 | |
fischman@webrtc.org | 69fc315 | 2013-09-25 17:01:42 +0000 | [diff] [blame] | 14 | #include <vector> |
pbos@webrtc.org | 4ca7d3f | 2013-08-12 19:51:57 +0000 | [diff] [blame] | 15 | |
Henrik Kjellander | 5dda80a | 2015-11-12 12:46:09 +0100 | [diff] [blame] | 16 | #include "webrtc/modules/video_capture/video_capture.h" |
Henrik Kjellander | 98f5351 | 2015-10-28 18:17:40 +0100 | [diff] [blame] | 17 | #include "webrtc/system_wrappers/include/rw_lock_wrapper.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 18 | |
| 19 | namespace webrtc |
| 20 | { |
| 21 | namespace videocapturemodule |
| 22 | { |
| 23 | class DeviceInfoImpl: public VideoCaptureModule::DeviceInfo |
| 24 | { |
| 25 | public: |
nisse | b29b9c8 | 2016-12-12 00:22:56 -0800 | [diff] [blame] | 26 | DeviceInfoImpl(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | virtual ~DeviceInfoImpl(void); |
pbos@webrtc.org | dfc5bb9 | 2013-04-10 08:23:13 +0000 | [diff] [blame] | 28 | virtual int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8); |
| 29 | virtual int32_t GetCapability( |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 30 | const char* deviceUniqueIdUTF8, |
pbos@webrtc.org | dfc5bb9 | 2013-04-10 08:23:13 +0000 | [diff] [blame] | 31 | const uint32_t deviceCapabilityNumber, |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 32 | VideoCaptureCapability& capability); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 33 | |
pbos@webrtc.org | dfc5bb9 | 2013-04-10 08:23:13 +0000 | [diff] [blame] | 34 | virtual int32_t GetBestMatchedCapability( |
leozwang@webrtc.org | 0689271 | 2012-03-01 16:31:00 +0000 | [diff] [blame] | 35 | const char* deviceUniqueIdUTF8, |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 36 | const VideoCaptureCapability& requested, |
| 37 | VideoCaptureCapability& resulting); |
guoweis@webrtc.org | 5a7dc39 | 2015-02-13 14:31:26 +0000 | [diff] [blame] | 38 | virtual int32_t GetOrientation(const char* deviceUniqueIdUTF8, |
| 39 | VideoRotation& orientation); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 40 | |
| 41 | protected: |
| 42 | /* Initialize this object*/ |
| 43 | |
pbos@webrtc.org | dfc5bb9 | 2013-04-10 08:23:13 +0000 | [diff] [blame] | 44 | virtual int32_t Init()=0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 45 | /* |
| 46 | * Fills the member variable _captureCapabilities with capabilities for the given device name. |
| 47 | */ |
pbos@webrtc.org | dfc5bb9 | 2013-04-10 08:23:13 +0000 | [diff] [blame] | 48 | virtual int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8)=0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 49 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 50 | protected: |
| 51 | // Data members |
fischman@webrtc.org | 69fc315 | 2013-09-25 17:01:42 +0000 | [diff] [blame] | 52 | typedef std::vector<VideoCaptureCapability> VideoCaptureCapabilities; |
| 53 | VideoCaptureCapabilities _captureCapabilities; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 54 | RWLockWrapper& _apiLock; |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 55 | char* _lastUsedDeviceName; |
pbos@webrtc.org | dfc5bb9 | 2013-04-10 08:23:13 +0000 | [diff] [blame] | 56 | uint32_t _lastUsedDeviceNameLength; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 57 | }; |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 58 | } // namespace videocapturemodule |
| 59 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 60 | #endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_ |