decklink_set_profile: handle help

This commit is contained in:
Martin Pulec
2024-06-06 09:35:13 +02:00
parent 2ee702e15e
commit ba2d634c2d
2 changed files with 16 additions and 0 deletions

View File

@@ -399,6 +399,12 @@ bool decklink_set_profile(IDeckLink *deckLink, bmd_option const &req_profile, bo
return true;
}
if (req_profile.is_help()) {
printf("Available profiles:\n");
print_bmd_device_profiles("\t");
return false;
}
bool ret = true;
IDeckLinkProfileManager *manager = nullptr;
IDeckLinkProfileIterator *it = nullptr;
@@ -695,6 +701,10 @@ const char *bmd_option::get_string() const {
bool bmd_option::is_default() const {
return m_type == type_tag::t_default;
}
bool bmd_option::is_help() const {
return m_type == type_tag::t_string &&
strcmp(get_string(), "help") == 0;
}
bool bmd_option::is_user_set() const {
return m_user_specified;
}
@@ -727,6 +737,11 @@ void bmd_option::parse(const char *val)
return;
}
if (strcmp(val, "help") == 0) {
set_string(val);
return;
}
// explicitly typed (either "str" or 'fcc')
if ((val[0] == '"' && val[strlen(val) - 1] == '"') || (val[0] == '\'' && val[strlen(val) - 1] == '\'')) {
string raw_val(val + 1);

View File

@@ -98,6 +98,7 @@ public:
explicit bmd_option(int64_t val, bool user_spec = true);
explicit bmd_option(bool val, bool user_spec = true);
bool is_default() const;
[[nodiscard]] bool is_help() const;
bool is_user_set() const;
void set_keep();
bool keep() const;