Ocean
AVFDevices.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_MEDIA_AVF_DEVICES_H
9 #define META_OCEAN_MEDIA_AVF_DEVICES_H
10 
12 
13 #include <vector>
14 
15 namespace Ocean
16 {
17 
18 namespace Media
19 {
20 
21 namespace AVFoundation
22 {
23 
24 /**
25  * This class implements a simple enumerator for devices available via the AVFoundation library.
26  * @ingroup mediaavf
27  */
29 {
30  public:
31 
32  /**
33  * Definition of a simple class combining device name and unique device id.
34  */
35  class Device
36  {
37  friend class AVFDevices;
38 
39  public:
40 
41  /**
42  * Returns the user-friendly name of this device.
43  * @return The device's readable name
44  */
45  inline const std::wstring& friendlyName() const;
46 
47  /**
48  * Returns the unique id of this device.
49  * @return The device's unique id
50  */
51  inline const std::wstring& uniqueId() const;
52 
53  protected:
54 
55  /**
56  * Creates a new device object.
57  * @param friendlyName The user-friendly name of the device
58  * @param uniqueId The unique id of the device
59  */
60  inline Device(const std::wstring& friendlyName, const std::wstring& uniqueId);
61 
62  protected:
63 
64  /// The user-friendly name of this device.
65  std::wstring deviceFriendlyName;
66 
67  /// The unique id of this device.
68  std::wstring deviceUniqueId;
69  };
70 
71  /**
72  * Definition of a vector holding devices.
73  */
74  typedef std::vector<Device> Devices;
75 
76  public:
77 
78  /**
79  * Returns the list of currently available video devices.
80  * @return The currently available video devices
81  */
83 };
84 
85 inline AVFDevices::Device::Device(const std::wstring& friendlyName, const std::wstring& uniqueId) :
86  deviceFriendlyName(friendlyName),
87  deviceUniqueId(uniqueId)
88 {
89  // nothing to do here
90 }
91 
92 inline const std::wstring& AVFDevices::Device::friendlyName() const
93 {
94  return deviceFriendlyName;
95 }
96 
97 inline const std::wstring& AVFDevices::Device::uniqueId() const
98 {
99  return deviceUniqueId;
100 }
101 
102 }
103 
104 }
105 
106 }
107 
108 #endif // META_OCEAN_MEDIA_AVF_DEVICES_H
Definition of a simple class combining device name and unique device id.
Definition: AVFDevices.h:36
const std::wstring & friendlyName() const
Returns the user-friendly name of this device.
Definition: AVFDevices.h:92
Device(const std::wstring &friendlyName, const std::wstring &uniqueId)
Creates a new device object.
Definition: AVFDevices.h:85
std::wstring deviceUniqueId
The unique id of this device.
Definition: AVFDevices.h:68
std::wstring deviceFriendlyName
The user-friendly name of this device.
Definition: AVFDevices.h:65
const std::wstring & uniqueId() const
Returns the unique id of this device.
Definition: AVFDevices.h:97
This class implements a simple enumerator for devices available via the AVFoundation library.
Definition: AVFDevices.h:29
std::vector< Device > Devices
Definition of a vector holding devices.
Definition: AVFDevices.h:74
static Devices videoDevices()
Returns the list of currently available video devices.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15