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 | |
| 14 | #include "video_capture.h" |
| 15 | |
| 16 | #include "map_wrapper.h" |
| 17 | #include "rw_lock_wrapper.h" |
| 18 | #include "video_capture_delay.h" |
| 19 | |
| 20 | namespace webrtc |
| 21 | { |
| 22 | namespace videocapturemodule |
| 23 | { |
| 24 | class DeviceInfoImpl: public VideoCaptureModule::DeviceInfo |
| 25 | { |
| 26 | public: |
pbos@webrtc.org | dfc5bb9 | 2013-04-10 08:23:13 +0000 | [diff] [blame^] | 27 | DeviceInfoImpl(const int32_t id); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 28 | virtual ~DeviceInfoImpl(void); |
pbos@webrtc.org | dfc5bb9 | 2013-04-10 08:23:13 +0000 | [diff] [blame^] | 29 | virtual int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8); |
| 30 | virtual int32_t GetCapability( |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 31 | const char* deviceUniqueIdUTF8, |
pbos@webrtc.org | dfc5bb9 | 2013-04-10 08:23:13 +0000 | [diff] [blame^] | 32 | const uint32_t deviceCapabilityNumber, |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 33 | VideoCaptureCapability& capability); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 34 | |
pbos@webrtc.org | dfc5bb9 | 2013-04-10 08:23:13 +0000 | [diff] [blame^] | 35 | virtual int32_t GetBestMatchedCapability( |
leozwang@webrtc.org | 0689271 | 2012-03-01 16:31:00 +0000 | [diff] [blame] | 36 | const char* deviceUniqueIdUTF8, |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 37 | const VideoCaptureCapability& requested, |
| 38 | VideoCaptureCapability& resulting); |
pbos@webrtc.org | dfc5bb9 | 2013-04-10 08:23:13 +0000 | [diff] [blame^] | 39 | virtual int32_t GetOrientation( |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 40 | const char* deviceUniqueIdUTF8, |
| 41 | VideoCaptureRotation& orientation); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 42 | |
| 43 | protected: |
| 44 | /* Initialize this object*/ |
| 45 | |
pbos@webrtc.org | dfc5bb9 | 2013-04-10 08:23:13 +0000 | [diff] [blame^] | 46 | virtual int32_t Init()=0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 47 | /* |
| 48 | * Fills the member variable _captureCapabilities with capabilities for the given device name. |
| 49 | */ |
pbos@webrtc.org | dfc5bb9 | 2013-04-10 08:23:13 +0000 | [diff] [blame^] | 50 | virtual int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8)=0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 51 | |
| 52 | /* Returns the expected Capture delay*/ |
pbos@webrtc.org | dfc5bb9 | 2013-04-10 08:23:13 +0000 | [diff] [blame^] | 53 | int32_t GetExpectedCaptureDelay(const DelayValues delayValues[], |
| 54 | const uint32_t sizeOfDelayValues, |
| 55 | const char* productId, |
| 56 | const uint32_t width, |
| 57 | const uint32_t height); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 58 | protected: |
| 59 | // Data members |
pbos@webrtc.org | dfc5bb9 | 2013-04-10 08:23:13 +0000 | [diff] [blame^] | 60 | int32_t _id; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 61 | MapWrapper _captureCapabilities; |
| 62 | RWLockWrapper& _apiLock; |
leozwang@webrtc.org | 1745e93 | 2012-03-01 16:30:40 +0000 | [diff] [blame] | 63 | char* _lastUsedDeviceName; |
pbos@webrtc.org | dfc5bb9 | 2013-04-10 08:23:13 +0000 | [diff] [blame^] | 64 | uint32_t _lastUsedDeviceNameLength; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 65 | }; |
| 66 | } //namespace videocapturemodule |
| 67 | } // namespace webrtc |
| 68 | #endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_ |