xref: /aosp_15_r20/external/webrtc/modules/video_capture/linux/device_info_v4l2.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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 MODULES_VIDEO_CAPTURE_LINUX_DEVICE_INFO_V4L2_H_
12 #define MODULES_VIDEO_CAPTURE_LINUX_DEVICE_INFO_V4L2_H_
13 
14 #include <stdint.h>
15 
16 #include "modules/video_capture/device_info_impl.h"
17 
18 namespace webrtc {
19 namespace videocapturemodule {
20 class DeviceInfoV4l2 : public DeviceInfoImpl {
21  public:
22   DeviceInfoV4l2();
23   ~DeviceInfoV4l2() override;
24   uint32_t NumberOfDevices() override;
25   int32_t GetDeviceName(uint32_t deviceNumber,
26                         char* deviceNameUTF8,
27                         uint32_t deviceNameLength,
28                         char* deviceUniqueIdUTF8,
29                         uint32_t deviceUniqueIdUTF8Length,
30                         char* productUniqueIdUTF8 = 0,
31                         uint32_t productUniqueIdUTF8Length = 0) override;
32   /*
33    * Fills the membervariable _captureCapabilities with capabilites for the
34    * given device name.
35    */
36   int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8) override
37       RTC_EXCLUSIVE_LOCKS_REQUIRED(_apiLock);
38   int32_t DisplayCaptureSettingsDialogBox(const char* /*deviceUniqueIdUTF8*/,
39                                           const char* /*dialogTitleUTF8*/,
40                                           void* /*parentWindow*/,
41                                           uint32_t /*positionX*/,
42                                           uint32_t /*positionY*/) override;
43   int32_t FillCapabilities(int fd) RTC_EXCLUSIVE_LOCKS_REQUIRED(_apiLock);
44   int32_t Init() override;
45 
46  private:
47   bool IsDeviceNameMatches(const char* name, const char* deviceUniqueIdUTF8);
48 };
49 }  // namespace videocapturemodule
50 }  // namespace webrtc
51 #endif  // MODULES_VIDEO_CAPTURE_LINUX_DEVICE_INFO_V4L2_H_
52