Skip to content

Commit

Permalink
dshow: fail on unknown opt + opt prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinPulec committed Jan 12, 2024
1 parent 72c0354 commit d4f80ef
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/video_capture/DirectShowGrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ static bool process_args(struct vidcap_dshow_state *s, char *init_fmt) {
} else {
while ((token = strtok_s(init_fmt, ":", &strtok_context)) != NULL) {
init_fmt = NULL;
if (strncmp(token, "device=", strlen("device=")) == 0) {
if (IS_KEY_PREFIX(token, "device")) {
token = strchr(token, '=') + 1;
if (isdigit(token[0])) { // device specified by number
s->deviceNumber = atoi(token);
Expand All @@ -623,13 +623,14 @@ static bool process_args(struct vidcap_dshow_state *s, char *init_fmt) {
strcpy_s(s->deviceName, strlen(token) + 1, token);
s->deviceNumber = -1;
}
} else if (strncmp(token, "mode=", strlen("mode=")) == 0) {
} else if (IS_KEY_PREFIX(token, "mode")) {
token = strchr(token, '=') + 1;
s->modeNumber = atoi(token);
} else if (strcmp(token, "RGB") == 0) {
s->desc.color_spec = BGR;
} else {
log_msg(LOG_LEVEL_WARNING, "[dshow] Unknown argument: %s, ignoring.\n", token);
MSG(ERROR, "Unknown argument: %s\n", token);
return false;
}
}
}
Expand Down

0 comments on commit d4f80ef

Please sign in to comment.