Remove capture source property clamp, cleanup manpage

This commit is contained in:
dec05eba
2026-01-23 01:39:49 +01:00
parent c1af143406
commit a39dad1c02
2 changed files with 4 additions and 24 deletions

View File

@@ -105,18 +105,18 @@ These are the available options for all capture sources (optional):
.RS
.IP \(bu 3
.B x
- The X position in pixels. If the number ends with % and is a number between 0 and 100 then it's a position relative to the video size
- The X position in pixels. If the number ends with % then this sets the X position relative to the video width (integer percentage where 100 = 100%)
.IP \(bu 3
.B y
- The Y position in pixels. If the number ends with % and is a number between 0 and 100 then it's a position relative to the video size
- The Y position in pixels. If the number ends with % then this sets the Y position relative to the video height (integer percentage where 100 = 100%)
.IP \(bu 3
.B width
- The width in pixels. If the number ends with % and is a number between 0 and 100 then it's a size relative to the video size.
- The width in pixels. If the number ends with % then this sets the width relative to the video width (integer percentage where 100 = 100%).
A value of 0 means to not scale the capture source and instead use the original width.
.IP \(bu 3
.B height
- The height in pixels. If the number ends with % and is a number between 0 and 100 then it's a size relative to the video size
- The height in pixels. If the number ends with % then this sets the height relative to the video height (integer percentage where 100 = 100%).
A value of 0 means to not scale the capture source and instead use the original height.
.IP \(bu 3

View File

@@ -2799,15 +2799,6 @@ static bool string_to_bool(const char *str, size_t len, bool *value) {
}
}
static int clamp_scalar(int value) {
if(value < -100)
return -100;
else if(value > 100)
return 100;
else
return value;
}
static void parse_capture_source_options(const std::string &capture_source_str, CaptureSource &capture_source) {
bool is_first_column = true;
@@ -2829,9 +2820,6 @@ static void parse_capture_source_options(const std::string &capture_source_str,
fprintf(stderr, "gsr error: invalid capture target value for option x: \"%.*s\", expected a number\n", (int)size, sub);
_exit(1);
}
if(capture_source.pos.x_type == VVEC2I_TYPE_SCALAR)
capture_source.pos.x = clamp_scalar(capture_source.pos.x);
} else if(string_starts_with(sub, size, "y=")) {
capture_source.pos.y_type = sub[size - 1] == '%' ? VVEC2I_TYPE_SCALAR : VVEC2I_TYPE_PIXELS;
sub += 2;
@@ -2841,8 +2829,6 @@ static void parse_capture_source_options(const std::string &capture_source_str,
_exit(1);
}
if(capture_source.pos.y_type == VVEC2I_TYPE_SCALAR)
capture_source.pos.y = clamp_scalar(capture_source.pos.y);
} else if(string_starts_with(sub, size, "width=")) {
capture_source.size.x_type = sub[size - 1] == '%' ? VVEC2I_TYPE_SCALAR : VVEC2I_TYPE_PIXELS;
sub += 6;
@@ -2851,9 +2837,6 @@ static void parse_capture_source_options(const std::string &capture_source_str,
fprintf(stderr, "gsr error: invalid capture target value for option width: \"%.*s\", expected a number\n", (int)size, sub);
_exit(1);
}
if(capture_source.size.x_type == VVEC2I_TYPE_SCALAR)
capture_source.size.x = clamp_scalar(capture_source.size.x);
} else if(string_starts_with(sub, size, "height=")) {
capture_source.size.y_type = sub[size - 1] == '%' ? VVEC2I_TYPE_SCALAR : VVEC2I_TYPE_PIXELS;
sub += 7;
@@ -2862,9 +2845,6 @@ static void parse_capture_source_options(const std::string &capture_source_str,
fprintf(stderr, "gsr error: invalid capture target value for option height: \"%.*s\", expected a number\n", (int)size, sub);
_exit(1);
}
if(capture_source.size.y_type == VVEC2I_TYPE_SCALAR)
capture_source.size.y = clamp_scalar(capture_source.size.y);
} else if(string_starts_with(sub, size, "halign=")) {
sub += 7;
size -= 7;