blob: 463e10d07e1511fcfcc5e28c1db0761d5af82d12 [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
Henrik Kjellander5dda80a2015-11-12 12:46:09 +010016#include "webrtc/modules/video_capture/video_capture.h"
Henrik Kjellander98f53512015-10-28 18:17:40 +010017#include "webrtc/system_wrappers/include/rw_lock_wrapper.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000018
19namespace webrtc
20{
21namespace videocapturemodule
22{
23class DeviceInfoImpl: public VideoCaptureModule::DeviceInfo
24{
25public:
nisseb29b9c82016-12-12 00:22:56 -080026 DeviceInfoImpl();
niklase@google.com470e71d2011-07-07 08:21:25 +000027 virtual ~DeviceInfoImpl(void);
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000028 virtual int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8);
29 virtual int32_t GetCapability(
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000030 const char* deviceUniqueIdUTF8,
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000031 const uint32_t deviceCapabilityNumber,
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000032 VideoCaptureCapability& capability);
niklase@google.com470e71d2011-07-07 08:21:25 +000033
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000034 virtual int32_t GetBestMatchedCapability(
leozwang@webrtc.org06892712012-03-01 16:31:00 +000035 const char* deviceUniqueIdUTF8,
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000036 const VideoCaptureCapability& requested,
37 VideoCaptureCapability& resulting);
guoweis@webrtc.org5a7dc392015-02-13 14:31:26 +000038 virtual int32_t GetOrientation(const char* deviceUniqueIdUTF8,
39 VideoRotation& orientation);
niklase@google.com470e71d2011-07-07 08:21:25 +000040
41protected:
42 /* Initialize this object*/
43
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000044 virtual int32_t Init()=0;
niklase@google.com470e71d2011-07-07 08:21:25 +000045 /*
46 * Fills the member variable _captureCapabilities with capabilities for the given device name.
47 */
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000048 virtual int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8)=0;
niklase@google.com470e71d2011-07-07 08:21:25 +000049
niklase@google.com470e71d2011-07-07 08:21:25 +000050protected:
51 // Data members
fischman@webrtc.org69fc3152013-09-25 17:01:42 +000052 typedef std::vector<VideoCaptureCapability> VideoCaptureCapabilities;
53 VideoCaptureCapabilities _captureCapabilities;
niklase@google.com470e71d2011-07-07 08:21:25 +000054 RWLockWrapper& _apiLock;
leozwang@webrtc.org1745e932012-03-01 16:30:40 +000055 char* _lastUsedDeviceName;
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000056 uint32_t _lastUsedDeviceNameLength;
niklase@google.com470e71d2011-07-07 08:21:25 +000057};
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000058} // namespace videocapturemodule
59} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000060#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_DEVICE_INFO_IMPL_H_