UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
available_settings.hpp
Go to the documentation of this file.
1#ifndef AVAILABLE_SETTINGS_HPP
2#define AVAILABLE_SETTINGS_HPP
3
4#include <string>
5#include <string_view>
6#include <vector>
7#include <map>
8
9#define SETTING_TYPE_LIST \
10 X(VIDEO_SRC, "capture") \
11 X(VIDEO_DISPLAY, "display") \
12 X(VIDEO_COMPRESS, "compress") \
13 X(VIDEO_CAPTURE_FILTER, "capture_filter") \
14 X(AUDIO_SRC, "audio_cap") \
15 X(AUDIO_PLAYBACK, "audio_play") \
16 X(AUDIO_COMPRESS, "audio_compress") \
17 X(AUDIO_FILTER, "audio_filter") \
18 X(SETTING_TYPE_UNKNOWN, "unknown")
19
20
21#define X(type, str) type,
26#undef X
27
29SettingType strToSettingType(std::string_view sv);
30
32 std::string opt;
33 std::string val;
34};
35
37 std::string name;
38 std::vector<SettingVal> opts;
39};
40
41struct CapabOpt{
42 std::string displayName; //Name displayed to user
43 std::string displayDesc; //Description displayed to user
44 std::string placeholder; //Displayed placeholder if opt is a line edit
45
46 /* internal name of option, options that are used in the same way should
47 * have the same key (e.g. both bitrate for libavcodec and quality for jpeg
48 * should have the same key). This allows using different labels displayed
49 * to user */
50 std::string key;
51 std::string optStr; //Option string to pass to ug (e.g. ":bitrate=")
52
53 bool booleanOpt; //If true, GUI shows a checkbox instead of text edit
54};
55
56struct Device{
57 std::string name;
58 std::string type; //UltraGrid module name (e.g. v4l2)
59 std::string deviceOpt; //Specific device (e.g. ":device=/dev/video0")
60 SettingType settingType = SETTING_TYPE_UNKNOWN;
61
62 std::map<std::string, std::string> extra;
63
64 std::vector<DeviceMode> modes;
65 std::vector<CapabOpt> opts;
66};
67
68struct Encoder{
69 std::string name;
70 std::string optStr;
71};
72
73struct Codec{
74 std::string name;
75 std::string module_name;
76 std::vector<Encoder> encoders;
78};
79
81 std::string name;
82 std::vector<CapabOpt> opts;
83};
84
86public:
87 void queryBegin();
88 void queryBeginPass();
89 void queryLine(std::string_view line);
90 void queryEnd();
91
92 bool isAvailable(const std::string &name, SettingType type) const;
93 const std::vector<std::string>& getAvailableSettings(SettingType type) const;
94
95 const std::vector<Device>& getDevices(SettingType type) const;
96
97 const std::vector<CompressModule>& getVideoCompressModules() const {
99 }
100
101 const std::vector<Codec>& getVideoCompressCodecs() const {
102 return videoCompressCodecs;
103 }
104
105private:
106
107 void queryProcessLine(std::string_view line);
108 void queryDevice(std::string_view line);
109 void queryVideoCompress(std::string_view line);
110
111 void parseStateVersion(std::string_view line);
112
113 void (AvailableSettings::*parseFunc)(std::string_view str) = nullptr;
114
115 std::vector<std::string> available[SETTING_TYPE_COUNT];
116 std::vector<Device> devices[SETTING_TYPE_COUNT];
117 std::vector<CompressModule> videoCompressModules;
118 std::vector<Codec> videoCompressCodecs;
119
120 bool endMarkerFound = false;
121
122};
123
124#endif
#define SETTING_TYPE_LIST
const char * settingTypeToStr(SettingType type)
SettingType strToSettingType(std::string_view sv)
@ SETTING_TYPE_COUNT
const std::vector< CompressModule > & getVideoCompressModules() const
void parseStateVersion(std::string_view line)
void queryLine(std::string_view line)
void queryVideoCompress(std::string_view line)
const std::vector< Codec > & getVideoCompressCodecs() const
std::vector< CompressModule > videoCompressModules
bool isAvailable(const std::string &name, SettingType type) const
std::vector< Codec > videoCompressCodecs
std::vector< std::string > available[SETTING_TYPE_COUNT]
const std::vector< Device > & getDevices(SettingType type) const
std::vector< Device > devices[SETTING_TYPE_COUNT]
const std::vector< std::string > & getAvailableSettings(SettingType type) const
void(AvailableSettings::* parseFunc)(std::string_view str)
void queryDevice(std::string_view line)
void queryProcessLine(std::string_view line)
Option::OptType type
Definition settings.cpp:194
const char * name
Definition settings.cpp:193
std::string optStr
std::string displayName
std::string displayDesc
std::string key
std::string placeholder
std::string name
std::vector< Encoder > encoders
std::string module_name
std::vector< CapabOpt > opts
std::string type
std::map< std::string, std::string > extra
std::vector< CapabOpt > opts
SettingType settingType
std::vector< DeviceMode > modes
std::string name
std::string deviceOpt
std::vector< SettingVal > opts
std::string name
std::string optStr