Skip to content

Commit 26794a1

Browse files
committed
decklink: fix FourCC opts without val
fixes the regression by commit d71c28e (2024-11-18)
1 parent 5325a2b commit 26794a1

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/video_capture/decklink.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -791,9 +791,13 @@ static bool parse_option(struct vidcap_decklink_state *s, const char *opt)
791791
} else if (strstr(opt, "keep-settings") == opt) {
792792
s->keep_device_defaults = true;
793793
} else if ((strchr(opt, '=') != nullptr && strchr(opt, '=') - opt == 4) || strlen(opt) == 4) {
794-
char val[STR_LEN];
795-
snprintf_ch(val, "%s", strchr(opt, '=') + 1);
796-
replace_all(val, DELDEL, ":");
794+
char *val = nullptr;
795+
char tmp[STR_LEN];
796+
if (strchr(opt, '=') != nullptr) {
797+
snprintf_ch(tmp, "%s", strchr(opt, '=') + 1);
798+
replace_all(tmp, DELDEL, ":");
799+
val = tmp;
800+
}
797801
ret = s
798802
->device_options[(
799803
BMDDeckLinkConfigurationID) bmd_read_fourcc(opt)]

src/video_display/decklink.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,9 +1328,13 @@ static bool settings_init(struct state_decklink *s, const char *fmt,
13281328
} else if (strncasecmp(ptr, "targetbuffer=", strlen("targetbuffer=")) == 0) {
13291329
s->audio_drift_fixer.set_target_buffer(parse_uint32(strchr(ptr, '=') + 1));
13301330
} else if ((strchr(ptr, '=') != nullptr && strchr(ptr, '=') - ptr == 4) || strlen(ptr) == 4) {
1331-
char val[STR_LEN];
1332-
snprintf_ch(val, "%s", strchr(ptr, '=') + 1);
1333-
replace_all(val, DELDEL, ":");
1331+
char *val = nullptr;
1332+
char tmp[STR_LEN];
1333+
if (strchr(ptr, '=') != nullptr) {
1334+
snprintf_ch(tmp, "%s", strchr(ptr, '=') + 1);
1335+
replace_all(tmp, DELDEL, ":");
1336+
val = tmp;
1337+
}
13341338
ret &= s->device_options[(BMDDeckLinkConfigurationID)
13351339
bmd_read_fourcc(ptr)]
13361340
.parse(val);

0 commit comments

Comments
 (0)