mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-03-31 09:07:13 +09:00
Remove capture source property clamp, cleanup manpage
This commit is contained in:
@@ -105,18 +105,18 @@ These are the available options for all capture sources (optional):
|
|||||||
.RS
|
.RS
|
||||||
.IP \(bu 3
|
.IP \(bu 3
|
||||||
.B x
|
.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
|
.IP \(bu 3
|
||||||
.B y
|
.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
|
.IP \(bu 3
|
||||||
.B width
|
.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.
|
A value of 0 means to not scale the capture source and instead use the original width.
|
||||||
.IP \(bu 3
|
.IP \(bu 3
|
||||||
.B height
|
.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.
|
A value of 0 means to not scale the capture source and instead use the original height.
|
||||||
.IP \(bu 3
|
.IP \(bu 3
|
||||||
|
|||||||
20
src/main.cpp
20
src/main.cpp
@@ -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) {
|
static void parse_capture_source_options(const std::string &capture_source_str, CaptureSource &capture_source) {
|
||||||
bool is_first_column = true;
|
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);
|
fprintf(stderr, "gsr error: invalid capture target value for option x: \"%.*s\", expected a number\n", (int)size, sub);
|
||||||
_exit(1);
|
_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=")) {
|
} else if(string_starts_with(sub, size, "y=")) {
|
||||||
capture_source.pos.y_type = sub[size - 1] == '%' ? VVEC2I_TYPE_SCALAR : VVEC2I_TYPE_PIXELS;
|
capture_source.pos.y_type = sub[size - 1] == '%' ? VVEC2I_TYPE_SCALAR : VVEC2I_TYPE_PIXELS;
|
||||||
sub += 2;
|
sub += 2;
|
||||||
@@ -2841,8 +2829,6 @@ static void parse_capture_source_options(const std::string &capture_source_str,
|
|||||||
_exit(1);
|
_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=")) {
|
} else if(string_starts_with(sub, size, "width=")) {
|
||||||
capture_source.size.x_type = sub[size - 1] == '%' ? VVEC2I_TYPE_SCALAR : VVEC2I_TYPE_PIXELS;
|
capture_source.size.x_type = sub[size - 1] == '%' ? VVEC2I_TYPE_SCALAR : VVEC2I_TYPE_PIXELS;
|
||||||
sub += 6;
|
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);
|
fprintf(stderr, "gsr error: invalid capture target value for option width: \"%.*s\", expected a number\n", (int)size, sub);
|
||||||
_exit(1);
|
_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=")) {
|
} else if(string_starts_with(sub, size, "height=")) {
|
||||||
capture_source.size.y_type = sub[size - 1] == '%' ? VVEC2I_TYPE_SCALAR : VVEC2I_TYPE_PIXELS;
|
capture_source.size.y_type = sub[size - 1] == '%' ? VVEC2I_TYPE_SCALAR : VVEC2I_TYPE_PIXELS;
|
||||||
sub += 7;
|
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);
|
fprintf(stderr, "gsr error: invalid capture target value for option height: \"%.*s\", expected a number\n", (int)size, sub);
|
||||||
_exit(1);
|
_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=")) {
|
} else if(string_starts_with(sub, size, "halign=")) {
|
||||||
sub += 7;
|
sub += 7;
|
||||||
size -= 7;
|
size -= 7;
|
||||||
|
|||||||
Reference in New Issue
Block a user