mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 12:40:31 +00:00
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:
@@ -82,6 +82,7 @@
|
|||||||
#include "utils/color_out.h"
|
#include "utils/color_out.h"
|
||||||
#include "utils/macros.h"
|
#include "utils/macros.h"
|
||||||
#include "utils/math.h"
|
#include "utils/math.h"
|
||||||
|
#include "utils/string.h" // for replace_all, DELDEL, ESCAPED_COLON
|
||||||
#include "utils/windows.h"
|
#include "utils/windows.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "video_capture.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) {
|
} else if (strstr(opt, "keep-settings") == opt) {
|
||||||
s->keep_device_defaults = true;
|
s->keep_device_defaults = true;
|
||||||
} else if ((strchr(opt, '=') != nullptr && strchr(opt, '=') - opt == 4) || strlen(opt) == 4) {
|
} 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
|
ret = s
|
||||||
->device_options[(
|
->device_options[(
|
||||||
BMDDeckLinkConfigurationID) bmd_read_fourcc(opt)]
|
BMDDeckLinkConfigurationID) bmd_read_fourcc(opt)]
|
||||||
.parse(strchr(opt, '=') + 1);
|
.parse(val);
|
||||||
} else {
|
} else {
|
||||||
log_msg(LOG_LEVEL_ERROR, MOD_NAME "unknown option in init string: %s\n", opt);
|
log_msg(LOG_LEVEL_ERROR, MOD_NAME "unknown option in init string: %s\n", opt);
|
||||||
return false;
|
return false;
|
||||||
@@ -814,6 +818,8 @@ static bool settings_init_key_val(struct vidcap_decklink_state *s, char **save_p
|
|||||||
static bool
|
static bool
|
||||||
settings_init(struct vidcap_decklink_state *s, char *fmt)
|
settings_init(struct vidcap_decklink_state *s, char *fmt)
|
||||||
{
|
{
|
||||||
|
replace_all(fmt, ESCAPED_COLON, DELDEL); // replace all '\:' with 2xDEL
|
||||||
|
|
||||||
char *tmp;
|
char *tmp;
|
||||||
char *save_ptr = NULL;
|
char *save_ptr = NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -1208,6 +1208,7 @@ static bool settings_init(struct state_decklink *s, const char *fmt,
|
|||||||
char tmp[STR_LEN];
|
char tmp[STR_LEN];
|
||||||
snprintf_ch(tmp, "%s", fmt);
|
snprintf_ch(tmp, "%s", fmt);
|
||||||
strcpy(tmp, fmt);
|
strcpy(tmp, fmt);
|
||||||
|
replace_all(tmp, ESCAPED_COLON, DELDEL); // replace all '\:' with 2xDEL
|
||||||
char *save_ptr = nullptr;
|
char *save_ptr = nullptr;
|
||||||
char *ptr = strtok_r(tmp, ":", &save_ptr);
|
char *ptr = strtok_r(tmp, ":", &save_ptr);
|
||||||
assert(ptr != nullptr);
|
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) {
|
} else if (strncasecmp(ptr, "targetbuffer=", strlen("targetbuffer=")) == 0) {
|
||||||
s->audio_drift_fixer.set_target_buffer(parse_uint32(strchr(ptr, '=') + 1));
|
s->audio_drift_fixer.set_target_buffer(parse_uint32(strchr(ptr, '=') + 1));
|
||||||
} else if ((strchr(ptr, '=') != nullptr && strchr(ptr, '=') - ptr == 4) || strlen(ptr) == 4) {
|
} 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)
|
ret &= s->device_options[(BMDDeckLinkConfigurationID)
|
||||||
bmd_read_fourcc(ptr)]
|
bmd_read_fourcc(ptr)]
|
||||||
.parse(strchr(ptr, '=') + 1);
|
.parse(val);
|
||||||
} else {
|
} else {
|
||||||
log_msg(LOG_LEVEL_ERROR, MOD_NAME "unknown option in config string: %s\n", ptr);
|
log_msg(LOG_LEVEL_ERROR, MOD_NAME "unknown option in config string: %s\n", ptr);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user