aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorGravatar Matthew Wozniak <me@woz.blue> 2024-11-04 11:11:57 -0500
committerGravatar Matthew Wozniak <me@woz.blue> 2024-11-04 11:11:57 -0500
commit3c19c509af38424cd04df53e1af7ef1b20a191ef (patch)
tree7db1fab7aeadab3f74b3ec218861dd78c52c5994 /main.c
parent5296fc43920de4c6548f888a4d026f981b476cf7 (diff)
downloadrt-3c19c509af38424cd04df53e1af7ef1b20a191ef.tar.gz
rt-3c19c509af38424cd04df53e1af7ef1b20a191ef.zip
allow the user to change the quality vs speed setting
Diffstat (limited to 'main.c')
-rw-r--r--main.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/main.c b/main.c
index a8b5725..3d89c08 100644
--- a/main.c
+++ b/main.c
@@ -33,6 +33,7 @@ struct {
int fps;
int quality;
int bitrate;
+ int qvs;
char *out;
char **demo;
bool combine;
@@ -45,7 +46,7 @@ void hook_cbuf_addtext(char *str) {
if (!strcmp(str, "exec modsettings.cfg mod\n")) {
bool use_bitrate = !!args.bitrate;
if (!render_init(args.width, args.height, args.fps, use_bitrate,
- use_bitrate ? args.bitrate : args.quality, args.out))
+ use_bitrate ? args.bitrate : args.quality, args.out, args.qvs))
die("couldn't init render");
// play the demo
demoplayer->vt->start_playback(demoplayer, args.demo[0], false);
@@ -84,11 +85,11 @@ int main(int argc, char **argv) {
SetDllDirectoryA("bin/");
int c;
char *strend;
- while ((c = getopt(argc, argv, "w:h:g:r:q:b:")) != -1) {
+ while ((c = getopt(argc, argv, "w:h:g:r:q:b:s:")) != -1) {
switch (c) {
case 'w':
args.width = strtol(optarg, &strend, 10);
- if (strend == optarg) die("width must be a number!");
+ if (strend == optarg) die("width must be a number");
break;
case 'h':
args.height = strtol(optarg, &strend, 10);
@@ -96,15 +97,21 @@ int main(int argc, char **argv) {
break;
case 'r':
args.fps = strtol(optarg, &strend, 10);
- if (strend == optarg) die("must pass a number to -w!");
+ if (strend == optarg) die("fps must be a number");
break;
case 'q':
args.quality = strtol(optarg, &strend, 10);
- if (strend == optarg) die("must pass a number to -w!");
+ if (strend == optarg || args.quality < 1 || args.quality > 100)
+ die("quality must be a number 1-100");
+ break;
+ case 's':
+ args.qvs = strtol(optarg, &strend, 10);
+ if (strend == optarg || args.qvs < 1 || args.qvs > 100)
+ die("qvs must be a number 1-100");
break;
case 'b':
args.bitrate = strtol(optarg, &strend, 10);
- if (strend == optarg) die("must pass a number to -w!");
+ if (strend == optarg) die("bitrate must be a number");
break;
case 'g':
args.game = optarg;
@@ -120,11 +127,12 @@ int main(int argc, char **argv) {
if (!args.game) args.game = "hl2";
if (!args.fps) args.fps = 30;
if (!args.quality) args.quality = 75;
+ if (!args.qvs) args.qvs = 100;
if (argc - optind < 2) {
printf(
"usage:\n"
- " rt -w <width> -h <height> -g <game> -r <fps> [-q <quality>] [-b <bitrate>]\n"
+ " rt [-w <width>] [-h <height>] [-g <game>] [-r <fps>] [-s <qvs>] [-1] [-q <quality>] OR [-b <bitrate>]\n"
" path/to/video.mp4 path/to/demo1.dem...\n");
exit(1);
}