vcap,disp/decklink: allow \: in fourcc opts

this now allows specifying the IP address including port:

    uv -d 'decklink:d=DeckLink IP/SDI HD (1):noav=239.255.194.25\:16666'
This commit is contained in:
Martin Pulec
2024-11-18 15:09:50 +01:00
parent b9ca43e295
commit d71c28eef0
2 changed files with 12 additions and 2 deletions

View File

@@ -82,6 +82,7 @@
#include "utils/color_out.h"
#include "utils/macros.h"
#include "utils/math.h"
#include "utils/string.h" // for replace_all, DELDEL, ESCAPED_COLON
#include "utils/windows.h"
#include "video.h"
#include "video_capture.h"
@@ -786,10 +787,13 @@ static bool parse_option(struct vidcap_decklink_state *s, const char *opt)
} else if (strstr(opt, "keep-settings") == opt) {
s->keep_device_defaults = true;
} else if ((strchr(opt, '=') != nullptr && strchr(opt, '=') - opt == 4) || strlen(opt) == 4) {
char val[STR_LEN];
snprintf_ch(val, "%s", strchr(opt, '=') + 1);
replace_all(val, DELDEL, ":");
ret = s
->device_options[(
BMDDeckLinkConfigurationID) bmd_read_fourcc(opt)]
.parse(strchr(opt, '=') + 1);
.parse(val);
} else {
log_msg(LOG_LEVEL_ERROR, MOD_NAME "unknown option in init string: %s\n", opt);
return false;
@@ -814,6 +818,8 @@ static bool settings_init_key_val(struct vidcap_decklink_state *s, char **save_p
static bool
settings_init(struct vidcap_decklink_state *s, char *fmt)
{
replace_all(fmt, ESCAPED_COLON, DELDEL); // replace all '\:' with 2xDEL
char *tmp;
char *save_ptr = NULL;

View File

@@ -1208,6 +1208,7 @@ static bool settings_init(struct state_decklink *s, const char *fmt,
char tmp[STR_LEN];
snprintf_ch(tmp, "%s", fmt);
strcpy(tmp, fmt);
replace_all(tmp, ESCAPED_COLON, DELDEL); // replace all '\:' with 2xDEL
char *save_ptr = nullptr;
char *ptr = strtok_r(tmp, ":", &save_ptr);
assert(ptr != nullptr);
@@ -1312,9 +1313,12 @@ static bool settings_init(struct state_decklink *s, const char *fmt,
} else if (strncasecmp(ptr, "targetbuffer=", strlen("targetbuffer=")) == 0) {
s->audio_drift_fixer.set_target_buffer(parse_uint32(strchr(ptr, '=') + 1));
} else if ((strchr(ptr, '=') != nullptr && strchr(ptr, '=') - ptr == 4) || strlen(ptr) == 4) {
char val[STR_LEN];
snprintf_ch(val, "%s", strchr(ptr, '=') + 1);
replace_all(val, DELDEL, ":");
ret &= s->device_options[(BMDDeckLinkConfigurationID)
bmd_read_fourcc(ptr)]
.parse(strchr(ptr, '=') + 1);
.parse(val);
} else {
log_msg(LOG_LEVEL_ERROR, MOD_NAME "unknown option in config string: %s\n", ptr);
return false;