1 /* 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 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 <vector> 15 16 #include "webrtc/modules/video_capture/include/video_capture.h" 17 #include "webrtc/modules/video_capture/video_capture_delay.h" 18 #include "webrtc/system_wrappers/interface/rw_lock_wrapper.h" 19 20 namespace webrtc 21 { 22 namespace videocapturemodule 23 { 24 class DeviceInfoImpl: public VideoCaptureModule::DeviceInfo 25 { 26 public: 27 DeviceInfoImpl(const int32_t id); 28 virtual ~DeviceInfoImpl(void); 29 virtual int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8); 30 virtual int32_t GetCapability( 31 const char* deviceUniqueIdUTF8, 32 const uint32_t deviceCapabilityNumber, 33 VideoCaptureCapability& capability); 34 35 virtual int32_t GetBestMatchedCapability( 36 const char* deviceUniqueIdUTF8, 37 const VideoCaptureCapability& requested, 38 VideoCaptureCapability& resulting); 39 virtual int32_t GetOrientation( 40 const char* deviceUniqueIdUTF8, 41 VideoCaptureRotation& orientation); 42 43 protected: 44 /* Initialize this object*/ 45 46 virtual int32_t Init()=0; 47 /* 48 * Fills the member variable _captureCapabilities with capabilities for the given device name. 49 */ 50 virtual int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8)=0; 51 52 /* Returns the expected Capture delay*/ 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); 58 protected: 59 // Data members 60 int32_t _id; 61 typedef std::vector<VideoCaptureCapability> VideoCaptureCapabilities; 62 VideoCaptureCapabilities _captureCapabilities; 63 RWLockWrapper& _apiLock; 64 char* _lastUsedDeviceName; 65 uint32_t _lastUsedDeviceNameLength; 66 }; 67 } // namespace videocapturemodule 68 } // namespace webrtc 69 #endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_ 70