blob: 0bc4711e108c299a65d54ef8aa030fc526cbed2e [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
mallinath@webrtc.org12984f02012-02-16 18:18:21 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
20namespace webrtc
21{
22namespace videocapturemodule
23{
24class DeviceInfoImpl: public VideoCaptureModule::DeviceInfo
25{
26public:
27 DeviceInfoImpl(const WebRtc_Word32 id);
28 virtual ~DeviceInfoImpl(void);
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000029 virtual WebRtc_Word32 NumberOfCapabilities(const char* deviceUniqueIdUTF8);
30 virtual WebRtc_Word32 GetCapability(
31 const char* deviceUniqueIdUTF8,
32 const WebRtc_UWord32 deviceCapabilityNumber,
33 VideoCaptureCapability& capability);
niklase@google.com470e71d2011-07-07 08:21:25 +000034
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000035 virtual WebRtc_Word32 GetBestMatchedCapability(
leozwang@webrtc.org06892712012-03-01 16:31:00 +000036 const char* deviceUniqueIdUTF8,
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000037 const VideoCaptureCapability& requested,
38 VideoCaptureCapability& resulting);
39 virtual WebRtc_Word32 GetOrientation(
40 const char* deviceUniqueIdUTF8,
41 VideoCaptureRotation& orientation);
niklase@google.com470e71d2011-07-07 08:21:25 +000042
43protected:
44 /* Initialize this object*/
45
46 virtual WebRtc_Word32 Init()=0;
47 /*
48 * Fills the member variable _captureCapabilities with capabilities for the given device name.
49 */
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000050 virtual WebRtc_Word32 CreateCapabilityMap(const char* deviceUniqueIdUTF8)=0;
niklase@google.com470e71d2011-07-07 08:21:25 +000051
52 /* Returns the expected Capture delay*/
53 WebRtc_Word32 GetExpectedCaptureDelay(const DelayValues delayValues[],
54 const WebRtc_UWord32 sizeOfDelayValues,
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000055 const char* productId,
niklase@google.com470e71d2011-07-07 08:21:25 +000056 const WebRtc_UWord32 width,
57 const WebRtc_UWord32 height);
58protected:
59 // Data members
60 WebRtc_Word32 _id;
61 MapWrapper _captureCapabilities;
62 RWLockWrapper& _apiLock;
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000063 char* _lastUsedDeviceName;
niklase@google.com470e71d2011-07-07 08:21:25 +000064 WebRtc_UWord32 _lastUsedDeviceNameLength;
65};
66} //namespace videocapturemodule
67} // namespace webrtc
68#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_