blob: f0e66f44dec2c4f5efcbc4b6d0ded0c295bbca60 [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
fischman@webrtc.org69fc3152013-09-25 17:01:42 +000014#include <vector>
pbos@webrtc.org4ca7d3f2013-08-12 19:51:57 +000015
pbos@webrtc.orga9b74ad2013-07-12 10:03:52 +000016#include "webrtc/modules/video_capture/include/video_capture.h"
17#include "webrtc/modules/video_capture/video_capture_delay.h"
pbos@webrtc.orga9b74ad2013-07-12 10:03:52 +000018#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000019
20namespace webrtc
21{
22namespace videocapturemodule
23{
24class DeviceInfoImpl: public VideoCaptureModule::DeviceInfo
25{
26public:
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000027 DeviceInfoImpl(const int32_t id);
niklase@google.com470e71d2011-07-07 08:21:25 +000028 virtual ~DeviceInfoImpl(void);
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000029 virtual int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8);
30 virtual int32_t GetCapability(
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000031 const char* deviceUniqueIdUTF8,
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000032 const uint32_t deviceCapabilityNumber,
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000033 VideoCaptureCapability& capability);
niklase@google.com470e71d2011-07-07 08:21:25 +000034
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000035 virtual int32_t 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);
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000039 virtual int32_t GetOrientation(
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000040 const char* deviceUniqueIdUTF8,
41 VideoCaptureRotation& orientation);
niklase@google.com470e71d2011-07-07 08:21:25 +000042
43protected:
44 /* Initialize this object*/
45
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000046 virtual int32_t Init()=0;
niklase@google.com470e71d2011-07-07 08:21:25 +000047 /*
48 * Fills the member variable _captureCapabilities with capabilities for the given device name.
49 */
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000050 virtual int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8)=0;
niklase@google.com470e71d2011-07-07 08:21:25 +000051
52 /* Returns the expected Capture delay*/
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000053 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.com470e71d2011-07-07 08:21:25 +000058protected:
59 // Data members
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000060 int32_t _id;
fischman@webrtc.org69fc3152013-09-25 17:01:42 +000061 typedef std::vector<VideoCaptureCapability> VideoCaptureCapabilities;
62 VideoCaptureCapabilities _captureCapabilities;
niklase@google.com470e71d2011-07-07 08:21:25 +000063 RWLockWrapper& _apiLock;
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000064 char* _lastUsedDeviceName;
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000065 uint32_t _lastUsedDeviceNameLength;
niklase@google.com470e71d2011-07-07 08:21:25 +000066};
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000067} // namespace videocapturemodule
68} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000069#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_