blob: 089c700701ddd86b1fa55d5b2fb66f01c5787588 [file] [log] [blame]
Eddie James9d7ff842018-12-11 12:54:35 -06001#pragma once
2
3#include <string>
4
5namespace ikvm
6{
Eddie James9d7ff842018-12-11 12:54:35 -06007/*
8 * @class Args
9 * @brief Command line argument parser and storage
10 */
11class Args
12{
13 public:
14 /*
15 * @struct CommandLine
16 * @brief Stores the original command line arguments for later use
17 */
18 struct CommandLine
19 {
20 /*
21 * @brief Constructs CommandLine object
22 *
23 * @param[in] c - Number of arguments
24 * @param[in] v - Array of arguments
25 */
Patrick Williams3c110332023-05-10 07:51:28 -050026 CommandLine(int c, char** v) : argc(c), argv(v) {}
Eddie James9d7ff842018-12-11 12:54:35 -060027 ~CommandLine() = default;
28 CommandLine(const CommandLine&) = default;
29 CommandLine& operator=(const CommandLine&) = default;
30 CommandLine(CommandLine&&) = default;
31 CommandLine& operator=(CommandLine&&) = default;
32
33 int argc;
34 char** argv;
35 };
36
37 /*
38 * @brief Constructs Args object
39 *
40 * @param[in] argc - The number of arguments in the command line call
41 * @param[in] argv - The array of arguments from the command line
42 */
43 Args(int argc, char* argv[]);
44 ~Args() = default;
45 Args(const Args&) = default;
46 Args& operator=(const Args&) = default;
47 Args(Args&&) = default;
48 Args& operator=(Args&&) = default;
49
50 /*
51 * @brief Get the original command line arguments
52 *
53 * @return Reference to the CommandLine structure storing the original
54 * command line arguments
55 */
56 inline const CommandLine& getCommandLine() const
57 {
58 return commandLine;
59 }
60
61 /*
62 * @brief Get the desired video frame rate
63 *
64 * @return Value of the desired frame rate in frames per second
65 */
66 inline int getFrameRate() const
67 {
68 return frameRate;
69 }
70
71 /*
Jammy Huanga4f63b32022-02-14 14:43:21 +080072 * @brief Get the video subsampling
73 *
74 * @return Value of the video subsampling
75 */
76 inline int getSubsampling() const
77 {
78 return subsampling;
79 }
80
81 /*
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -080082 * @brief Get the path to the USB keyboard device
Eddie James9d7ff842018-12-11 12:54:35 -060083 *
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -080084 * @return Reference to the string storing the path to the keyboard device
Eddie James9d7ff842018-12-11 12:54:35 -060085 */
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -080086 inline const std::string& getKeyboardPath() const
Eddie James9d7ff842018-12-11 12:54:35 -060087 {
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -080088 return keyboardPath;
89 }
90
91 /*
92 * @brief Get the path to the USB mouse device
93 *
94 * @return Reference to the string storing the path to the mouse device
95 */
96 inline const std::string& getPointerPath() const
97 {
98 return pointerPath;
Eddie James9d7ff842018-12-11 12:54:35 -060099 }
100
101 /*
Marvin Linfe685fb2022-10-25 16:20:08 +0800102 * @brief Get the name of UDC
103 *
104 * @return Reference to the string storing the name of UDC
105 */
106 inline const std::string& getUdcName() const
107 {
108 return udcName;
109 }
110
111 /*
Eddie James9d7ff842018-12-11 12:54:35 -0600112 * @brief Get the path to the V4L2 video device
113 *
114 * @return Reference to the string storing the path to the video device
115 */
116 inline const std::string& getVideoPath() const
117 {
118 return videoPath;
119 }
120
Paul Fertser2d2f3da2021-06-18 11:16:43 +0000121 /*
122 * @brief Get the identical frames detection setting
123 *
124 * @return True if identical frames detection is enabled
125 */
126 inline bool getCalcFrameCRC() const
127 {
128 return calcFrameCRC;
129 }
130
Eddie James9d7ff842018-12-11 12:54:35 -0600131 private:
132 /* @brief Prints the application usage to stderr */
133 void printUsage();
134
135 /*
136 * @brief Desired frame rate (in frames per second) of the video
137 * stream
138 */
139 int frameRate;
Jammy Huanga4f63b32022-02-14 14:43:21 +0800140 /* @brief Desired subsampling (0: 444, 1: 420) */
141 int subsampling;
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -0800142 /* @brief Path to the USB keyboard device */
143 std::string keyboardPath;
144 /* @brief Path to the USB mouse device */
145 std::string pointerPath;
Marvin Linfe685fb2022-10-25 16:20:08 +0800146 /* @brief Name of UDC */
147 std::string udcName;
Eddie James9d7ff842018-12-11 12:54:35 -0600148 /* @brief Path to the V4L2 video device */
149 std::string videoPath;
Paul Fertser2d2f3da2021-06-18 11:16:43 +0000150 /* @brief Identical frames detection */
151 bool calcFrameCRC;
Eddie James9d7ff842018-12-11 12:54:35 -0600152 /* @brief Original command line arguments passed to the application */
153 CommandLine commandLine;
154};
155
156} // namespace ikvm