aboutsummaryrefslogtreecommitdiff
path: root/src/args_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/args_parser.c')
-rw-r--r--src/args_parser.c112
1 files changed, 62 insertions, 50 deletions
diff --git a/src/args_parser.c b/src/args_parser.c
index 546d397..0e05557 100644
--- a/src/args_parser.c
+++ b/src/args_parser.c
@@ -69,6 +69,11 @@ static const ArgEnum tune_enums[] = {
{ .name = "quality", .value = GSR_TUNE_QUALITY },
};
+static const ArgEnum replay_storage_enums[] = {
+ { .name = "ram", .value = GSR_REPLAY_STORAGE_RAM },
+ { .name = "disk", .value = GSR_REPLAY_STORAGE_DISK },
+};
+
static void arg_deinit(Arg *arg) {
if(arg->values) {
free(arg->values);
@@ -185,11 +190,10 @@ static double args_get_double_by_key(Arg *args, int num_args, const char *key, d
static void usage_header() {
const bool inside_flatpak = getenv("FLATPAK_ID") != NULL;
const char *program_name = inside_flatpak ? "flatpak run --command=gpu-screen-recorder com.dec05eba.gpu_screen_recorder" : "gpu-screen-recorder";
- printf("usage: %s -w <window_id|monitor|focused|portal|region> [-c <container_format>] [-s WxH] [-region WxH+X+Y] [-f <fps>] [-a <audio_input>] [-q <quality>] [-r <replay_buffer_size_sec>] [-restart-replay-on-save yes|no] [-k h264|hevc|av1|vp8|vp9|hevc_hdr|av1_hdr|hevc_10bit|av1_10bit] [-ac aac|opus|flac] [-ab <bitrate>] [-oc yes|no] [-fm cfr|vfr|content] [-bm auto|qp|vbr|cbr] [-cr limited|full] [-tune performance|quality] [-df yes|no] [-sc <script_path>] [-cursor yes|no] [-keyint <value>] [-restore-portal-session yes|no] [-portal-session-token-filepath filepath] [-encoder gpu|cpu] [-o <output_file>] [-ro <output_directory>] [--list-capture-options [card_path]] [--list-audio-devices] [--list-application-audio] [-v yes|no] [-gl-debug yes|no] [--version] [-h|--help]\n", program_name);
+ printf("usage: %s -w <window_id|monitor|focused|portal|region> [-c <container_format>] [-s WxH] [-region WxH+X+Y] [-f <fps>] [-a <audio_input>] [-q <quality>] [-r <replay_buffer_size_sec>] [-replay-storage ram|disk] [-restart-replay-on-save yes|no] [-k h264|hevc|av1|vp8|vp9|hevc_hdr|av1_hdr|hevc_10bit|av1_10bit] [-ac aac|opus|flac] [-ab <bitrate>] [-oc yes|no] [-fm cfr|vfr|content] [-bm auto|qp|vbr|cbr] [-cr limited|full] [-tune performance|quality] [-df yes|no] [-sc <script_path>] [-cursor yes|no] [-keyint <value>] [-restore-portal-session yes|no] [-portal-session-token-filepath filepath] [-encoder gpu|cpu] [-o <output_file>] [-ro <output_directory>] [--list-capture-options [card_path]] [--list-audio-devices] [--list-application-audio] [-v yes|no] [-gl-debug yes|no] [--version] [-h|--help]\n", program_name);
fflush(stdout);
}
-// TODO: Update with portal info
static void usage_full() {
const bool inside_flatpak = getenv("FLATPAK_ID") != NULL;
const char *program_name = inside_flatpak ? "flatpak run --command=gpu-screen-recorder com.dec05eba.gpu_screen_recorder" : "gpu-screen-recorder";
@@ -229,7 +233,6 @@ static void usage_full() {
printf(" -a Audio device or application to record from (pulse audio device). Can be specified multiple times. Each time this is specified a new audio track is added for the specified audio device or application.\n");
printf(" The audio device can also be \"default_output\" in which case the default output device is used, or \"default_input\" in which case the default input device is used.\n");
printf(" Multiple audio sources can be merged into one audio track by using \"|\" as a separator into one -a argument, for example: -a \"default_output|default_input\".\n");
- printf(" A name can be given to the audio track by prefixing the audio with <name>/, for example \"track name/default_output\" or \"track name/default_output|default_input\".\n");
printf(" The audio name can also be prefixed with \"device:\", for example: -a \"device:default_output\".\n");
printf(" To record audio from an application then prefix the audio name with \"app:\", for example: -a \"app:Brave\". The application name is case-insensitive.\n");
printf(" To record audio from all applications except the provided ones prefix the audio name with \"app-inverse:\", for example: -a \"app-inverse:Brave\".\n");
@@ -250,9 +253,14 @@ static void usage_full() {
printf("\n");
printf(" -r Replay buffer time in seconds. If this is set, then only the last seconds as set by this option will be stored\n");
printf(" and the video will only be saved when the gpu-screen-recorder is closed. This feature is similar to Nvidia's instant replay feature This option has be between 5 and 1200.\n");
- printf(" Note that the video data is stored in RAM, so don't use too long replay buffer time and use constant bitrate option (-bm cbr) to prevent RAM usage from going too high in busy scenes.\n");
+ printf(" Note that the video data is stored in RAM (unless -replay-storage disk is used), so don't use too long replay buffer time and use constant bitrate option (-bm cbr) to prevent RAM usage from going too high in busy scenes.\n");
printf(" Optional, disabled by default.\n");
printf("\n");
+ printf(" -replay-storage\n");
+ printf(" Specify where temporary replay is stored. Should be either 'ram' or 'disk'. If set to 'disk' then replay data is stored in temporary files in the same directory as -o.\n");
+ printf(" Preferably avoid setting this to 'disk' unless -o is set to a HDD, as constant writes to a SSD can reduce the life-time of the SSD.\n");
+ printf(" Optional, set to 'ram' by default.\n");
+ printf("\n");
printf(" -restart-replay-on-save\n");
printf(" Restart replay on save. For example if this is set to 'no' and replay time (-r) is set to 60 seconds and a replay is saved once then the first replay video is 60 seconds long\n");
printf(" and if a replay is saved 10 seconds later then the second replay video will also be 60 seconds long and contain 50 seconds of the previous video as well.\n");
@@ -388,8 +396,10 @@ static void usage_full() {
printf("EXAMPLES:\n");
printf(" %s -w screen -f 60 -a default_output -o video.mp4\n", program_name);
printf(" %s -w screen -f 60 -a default_output -a default_input -o video.mp4\n", program_name);
+ printf(" %s -w $(xdotool selectwindow) -f 60 -a default_output -o video.mp4\n", program_name);
printf(" %s -w screen -f 60 -a \"default_output|default_input\" -o video.mp4\n", program_name);
printf(" %s -w screen -f 60 -a default_output -c mkv -r 60 -o \"$HOME/Videos\"\n", program_name);
+ printf(" %s -w screen -f 60 -a default_output -c mkv -r 1800 -replay-storage disk -bm cbr -q 40000 -o \"$HOME/Videos\"\n", program_name);
printf(" %s -w screen -f 60 -a default_output -c mkv -sc script.sh -r 60 -o \"$HOME/Videos\"\n", program_name);
printf(" %s -w portal -f 60 -a default_output -restore-portal-session yes -o video.mp4\n", program_name);
printf(" %s -w screen -f 60 -a default_output -bm cbr -q 15000 -o video.mp4\n", program_name);
@@ -437,6 +447,7 @@ static bool args_parser_set_values(args_parser *self) {
self->video_codec = (gsr_video_codec)args_get_enum_by_key(self->args, NUM_ARGS, "-k", GSR_VIDEO_CODEC_AUTO);
self->audio_codec = (gsr_audio_codec)args_get_enum_by_key(self->args, NUM_ARGS, "-ac", GSR_AUDIO_CODEC_OPUS);
self->bitrate_mode = (gsr_bitrate_mode)args_get_enum_by_key(self->args, NUM_ARGS, "-bm", GSR_BITRATE_MODE_AUTO);
+ self->replay_storage = (gsr_replay_storage)args_get_enum_by_key(self->args, NUM_ARGS, "-replay-storage", GSR_REPLAY_STORAGE_RAM);
const char *window = args_get_value_by_key(self->args, NUM_ARGS, "-w");
snprintf(self->window, sizeof(self->window), "%s", window);
@@ -454,7 +465,7 @@ static bool args_parser_set_values(args_parser *self) {
self->keyint = args_get_double_by_key(self->args, NUM_ARGS, "-keyint", 2.0);
if(self->audio_codec == GSR_AUDIO_CODEC_FLAC) {
- fprintf(stderr, "Warning: flac audio codec is temporary disabled, using opus audio codec instead\n");
+ fprintf(stderr, "gsr warning: flac audio codec is temporary disabled, using opus audio codec instead\n");
self->audio_codec = GSR_AUDIO_CODEC_OPUS;
}
@@ -462,7 +473,7 @@ static bool args_parser_set_values(args_parser *self) {
if(self->portal_session_token_filepath) {
int len = strlen(self->portal_session_token_filepath);
if(len > 0 && self->portal_session_token_filepath[len - 1] == '/') {
- fprintf(stderr, "Error: -portal-session-token-filepath should be a path to a file but it ends with a /: %s\n", self->portal_session_token_filepath);
+ fprintf(stderr, "gsr error: -portal-session-token-filepath should be a path to a file but it ends with a /: %s\n", self->portal_session_token_filepath);
return false;
}
}
@@ -471,13 +482,13 @@ static bool args_parser_set_values(args_parser *self) {
if(self->recording_saved_script) {
struct stat buf;
if(stat(self->recording_saved_script, &buf) == -1 || !S_ISREG(buf.st_mode)) {
- fprintf(stderr, "Error: Script \"%s\" either doesn't exist or it's not a file\n", self->recording_saved_script);
+ fprintf(stderr, "gsr error: Script \"%s\" either doesn't exist or it's not a file\n", self->recording_saved_script);
usage();
return false;
}
if(!(buf.st_mode & S_IXUSR)) {
- fprintf(stderr, "Error: Script \"%s\" is not executable\n", self->recording_saved_script);
+ fprintf(stderr, "gsr error: Script \"%s\" is not executable\n", self->recording_saved_script);
usage();
return false;
}
@@ -489,19 +500,19 @@ static bool args_parser_set_values(args_parser *self) {
if(self->bitrate_mode == GSR_BITRATE_MODE_CBR) {
if(!quality_str) {
- fprintf(stderr, "Error: option '-q' is required when using '-bm cbr' option\n");
+ fprintf(stderr, "gsr error: option '-q' is required when using '-bm cbr' option\n");
usage();
return false;
}
if(sscanf(quality_str, "%" PRIi64, &self->video_bitrate) != 1) {
- fprintf(stderr, "Error: -q argument \"%s\" is not an integer value. When using '-bm cbr' option '-q' is expected to be an integer value\n", quality_str);
+ fprintf(stderr, "gsr error: -q argument \"%s\" is not an integer value. When using '-bm cbr' option '-q' is expected to be an integer value\n", quality_str);
usage();
return false;
}
if(self->video_bitrate < 0) {
- fprintf(stderr, "Error: -q is expected to be 0 or larger, got %" PRIi64 "\n", self->video_bitrate);
+ fprintf(stderr, "gsr error: -q is expected to be 0 or larger, got %" PRIi64 "\n", self->video_bitrate);
usage();
return false;
}
@@ -520,7 +531,7 @@ static bool args_parser_set_values(args_parser *self) {
} else if(strcmp(quality_str, "ultra") == 0) {
self->video_quality = GSR_VIDEO_QUALITY_ULTRA;
} else {
- fprintf(stderr, "Error: -q should either be 'medium', 'high', 'very_high' or 'ultra', got: '%s'\n", quality_str);
+ fprintf(stderr, "gsr error: -q should either be 'medium', 'high', 'very_high' or 'ultra', got: '%s'\n", quality_str);
usage();
return false;
}
@@ -528,7 +539,7 @@ static bool args_parser_set_values(args_parser *self) {
const char *output_resolution_str = args_get_value_by_key(self->args, NUM_ARGS, "-s");
if(!output_resolution_str && strcmp(self->window, "focused") == 0) {
- fprintf(stderr, "Error: option -s is required when using '-w focused' option\n");
+ fprintf(stderr, "gsr error: option -s is required when using '-w focused' option\n");
usage();
return false;
}
@@ -536,13 +547,13 @@ static bool args_parser_set_values(args_parser *self) {
self->output_resolution = (vec2i){0, 0};
if(output_resolution_str) {
if(sscanf(output_resolution_str, "%dx%d", &self->output_resolution.x, &self->output_resolution.y) != 2) {
- fprintf(stderr, "Error: invalid value for option -s '%s', expected a value in format WxH\n", output_resolution_str);
+ fprintf(stderr, "gsr error: invalid value for option -s '%s', expected a value in format WxH\n", output_resolution_str);
usage();
return false;
}
if(self->output_resolution.x < 0 || self->output_resolution.y < 0) {
- fprintf(stderr, "Error: invalid value for option -s '%s', expected width and height to be greater or equal to 0\n", output_resolution_str);
+ fprintf(stderr, "gsr error: invalid value for option -s '%s', expected width and height to be greater or equal to 0\n", output_resolution_str);
usage();
return false;
}
@@ -553,25 +564,25 @@ static bool args_parser_set_values(args_parser *self) {
const char *region_str = args_get_value_by_key(self->args, NUM_ARGS, "-region");
if(region_str) {
if(strcmp(self->window, "region") != 0) {
- fprintf(stderr, "Error: option -region can only be used when option '-w region' is used\n");
+ fprintf(stderr, "gsr error: option -region can only be used when option '-w region' is used\n");
usage();
return false;
}
if(sscanf(region_str, "%dx%d+%d+%d", &self->region_size.x, &self->region_size.y, &self->region_position.x, &self->region_position.y) != 4) {
- fprintf(stderr, "Error: invalid value for option -region '%s', expected a value in format WxH+X+Y\n", region_str);
+ fprintf(stderr, "gsr error: invalid value for option -region '%s', expected a value in format WxH+X+Y\n", region_str);
usage();
return false;
}
if(self->region_size.x < 0 || self->region_size.y < 0 || self->region_position.x < 0 || self->region_position.y < 0) {
- fprintf(stderr, "Error: invalid value for option -region '%s', expected width, height, x and y to be greater or equal to 0\n", region_str);
+ fprintf(stderr, "gsr error: invalid value for option -region '%s', expected width, height, x and y to be greater or equal to 0\n", region_str);
usage();
return false;
}
} else {
if(strcmp(self->window, "region") == 0) {
- fprintf(stderr, "Error: option -region is required when '-w region' is used\n");
+ fprintf(stderr, "gsr error: option -region is required when '-w region' is used\n");
usage();
return false;
}
@@ -593,7 +604,7 @@ static bool args_parser_set_values(args_parser *self) {
self->is_livestream = is_livestream_path(self->filename);
if(self->is_livestream) {
if(is_replaying) {
- fprintf(stderr, "Error: replay mode is not applicable to live streaming\n");
+ fprintf(stderr, "gsr error: replay mode is not applicable to live streaming\n");
return false;
}
} else {
@@ -603,20 +614,20 @@ static bool args_parser_set_values(args_parser *self) {
char *directory = dirname(directory_buf);
if(strcmp(directory, ".") != 0 && strcmp(directory, "/") != 0) {
if(create_directory_recursive(directory) != 0) {
- fprintf(stderr, "Error: failed to create directory for output file: %s\n", self->filename);
+ fprintf(stderr, "gsr error: failed to create directory for output file: %s\n", self->filename);
return false;
}
}
} else {
if(!self->container_format) {
- fprintf(stderr, "Error: option -c is required when using option -r\n");
+ fprintf(stderr, "gsr error: option -c is required when using option -r\n");
usage();
return false;
}
struct stat buf;
if(stat(self->filename, &buf) != -1 && !S_ISDIR(buf.st_mode)) {
- fprintf(stderr, "Error: File \"%s\" exists but it's not a directory\n", self->filename);
+ fprintf(stderr, "gsr error: File \"%s\" exists but it's not a directory\n", self->filename);
usage();
return false;
}
@@ -626,13 +637,13 @@ static bool args_parser_set_values(args_parser *self) {
if(!is_replaying) {
self->filename = "/dev/stdout";
} else {
- fprintf(stderr, "Error: Option -o is required when using option -r\n");
+ fprintf(stderr, "gsr error: Option -o is required when using option -r\n");
usage();
return false;
}
if(!self->container_format) {
- fprintf(stderr, "Error: option -c is required when not using option -o\n");
+ fprintf(stderr, "gsr error: option -c is required when not using option -o\n");
usage();
return false;
}
@@ -645,10 +656,10 @@ static bool args_parser_set_values(args_parser *self) {
const bool is_portal_capture = strcmp(self->window, "portal") == 0;
if(!self->restore_portal_session && is_portal_capture)
- fprintf(stderr, "Info: option '-w portal' was used without '-restore-portal-session yes'. The previous screencast session will be ignored\n");
+ fprintf(stderr, "gsr info: option '-w portal' was used without '-restore-portal-session yes'. The previous screencast session will be ignored\n");
if(self->is_livestream && self->recording_saved_script) {
- fprintf(stderr, "Warning: live stream detected, -sc script is ignored\n");
+ fprintf(stderr, "gsr warning: live stream detected, -sc script is ignored\n");
self->recording_saved_script = NULL;
}
@@ -693,7 +704,7 @@ bool args_parser_parse(args_parser *self, int argc, char **argv, const args_hand
arg_handlers->list_capture_options(card_path, userdata);
return true;
} else {
- fprintf(stderr, "Error: expected --list-capture-options to be called with either no extra arguments or 1 extra argument (card path)\n");
+ fprintf(stderr, "gsr error: expected --list-capture-options to be called with either no extra arguments or 1 extra argument (card path)\n");
return false;
}
}
@@ -713,7 +724,7 @@ bool args_parser_parse(args_parser *self, int argc, char **argv, const args_hand
self->args[arg_index++] = (Arg){ .key = "-q", .optional = true, .list = false, .type = ARG_TYPE_STRING };
self->args[arg_index++] = (Arg){ .key = "-o", .optional = true, .list = false, .type = ARG_TYPE_STRING };
self->args[arg_index++] = (Arg){ .key = "-ro", .optional = true, .list = false, .type = ARG_TYPE_STRING };
- self->args[arg_index++] = (Arg){ .key = "-r", .optional = true, .list = false, .type = ARG_TYPE_I64, .integer_value_min = 2, .integer_value_max = 10800 };
+ self->args[arg_index++] = (Arg){ .key = "-r", .optional = true, .list = false, .type = ARG_TYPE_I64, .integer_value_min = 2, .integer_value_max = 86400 };
self->args[arg_index++] = (Arg){ .key = "-restart-replay-on-save", .optional = true, .list = false, .type = ARG_TYPE_BOOLEAN };
self->args[arg_index++] = (Arg){ .key = "-k", .optional = true, .list = false, .type = ARG_TYPE_ENUM, .enum_values = video_codec_enums, .num_enum_values = sizeof(video_codec_enums)/sizeof(ArgEnum) };
self->args[arg_index++] = (Arg){ .key = "-ac", .optional = true, .list = false, .type = ARG_TYPE_ENUM, .enum_values = audio_codec_enums, .num_enum_values = sizeof(audio_codec_enums)/sizeof(ArgEnum) };
@@ -733,25 +744,26 @@ bool args_parser_parse(args_parser *self, int argc, char **argv, const args_hand
self->args[arg_index++] = (Arg){ .key = "-restore-portal-session", .optional = true, .list = false, .type = ARG_TYPE_BOOLEAN };
self->args[arg_index++] = (Arg){ .key = "-portal-session-token-filepath", .optional = true, .list = false, .type = ARG_TYPE_STRING };
self->args[arg_index++] = (Arg){ .key = "-encoder", .optional = true, .list = false, .type = ARG_TYPE_ENUM, .enum_values = video_encoder_enums, .num_enum_values = sizeof(video_encoder_enums)/sizeof(ArgEnum) };
+ self->args[arg_index++] = (Arg){ .key = "-replay-storage", .optional = true, .list = false, .type = ARG_TYPE_ENUM, .enum_values = replay_storage_enums, .num_enum_values = sizeof(replay_storage_enums)/sizeof(ArgEnum) };
assert(arg_index == NUM_ARGS);
for(int i = 1; i < argc; i += 2) {
const char *arg_name = argv[i];
Arg *arg = args_get_by_key(self->args, NUM_ARGS, arg_name);
if(!arg) {
- fprintf(stderr, "Error: invalid argument '%s'\n", arg_name);
+ fprintf(stderr, "gsr error: invalid argument '%s'\n", arg_name);
usage();
return false;
}
if(arg->num_values > 0 && !arg->list) {
- fprintf(stderr, "Error: expected argument '%s' to only be specified once\n", arg_name);
+ fprintf(stderr, "gsr error: expected argument '%s' to only be specified once\n", arg_name);
usage();
return false;
}
if(i + 1 >= argc) {
- fprintf(stderr, "Error: missing value for argument '%s'\n", arg_name);
+ fprintf(stderr, "gsr error: missing value for argument '%s'\n", arg_name);
usage();
return false;
}
@@ -767,7 +779,7 @@ bool args_parser_parse(args_parser *self, int argc, char **argv, const args_hand
} else if(strcmp(arg_value, "no") == 0) {
arg->typed_value.boolean = false;
} else {
- fprintf(stderr, "Error: %s should either be 'yes' or 'no', got: '%s'\n", arg_name, arg_value);
+ fprintf(stderr, "gsr error: %s should either be 'yes' or 'no', got: '%s'\n", arg_name, arg_value);
usage();
return false;
}
@@ -775,7 +787,7 @@ bool args_parser_parse(args_parser *self, int argc, char **argv, const args_hand
}
case ARG_TYPE_ENUM: {
if(!arg_get_enum_value_by_name(arg, arg_value, &arg->typed_value.enum_value)) {
- fprintf(stderr, "Error: %s should either be ", arg_name);
+ fprintf(stderr, "gsr error: %s should either be ", arg_name);
arg_print_expected_enum_names(arg);
fprintf(stderr, ", got: '%s'\n", arg_value);
usage();
@@ -785,19 +797,19 @@ bool args_parser_parse(args_parser *self, int argc, char **argv, const args_hand
}
case ARG_TYPE_I64: {
if(sscanf(arg_value, "%" PRIi64, &arg->typed_value.i64_value) != 1) {
- fprintf(stderr, "Error: %s argument \"%s\" is not an integer\n", arg_name, arg_value);
+ fprintf(stderr, "gsr error: %s argument \"%s\" is not an integer\n", arg_name, arg_value);
usage();
return false;
}
if(arg->typed_value.i64_value < arg->integer_value_min) {
- fprintf(stderr, "Error: %s argument is expected to be larger than %" PRIi64 ", got %" PRIi64 "\n", arg_name, arg->integer_value_min, arg->typed_value.i64_value);
+ fprintf(stderr, "gsr error: %s argument is expected to be larger than %" PRIi64 ", got %" PRIi64 "\n", arg_name, arg->integer_value_min, arg->typed_value.i64_value);
usage();
return false;
}
if(arg->typed_value.i64_value > arg->integer_value_max) {
- fprintf(stderr, "Error: %s argument is expected to be less than %" PRIi64 ", got %" PRIi64 "\n", arg_name, arg->integer_value_max, arg->typed_value.i64_value);
+ fprintf(stderr, "gsr error: %s argument is expected to be less than %" PRIi64 ", got %" PRIi64 "\n", arg_name, arg->integer_value_max, arg->typed_value.i64_value);
usage();
return false;
}
@@ -805,19 +817,19 @@ bool args_parser_parse(args_parser *self, int argc, char **argv, const args_hand
}
case ARG_TYPE_DOUBLE: {
if(sscanf(arg_value, "%lf", &arg->typed_value.d_value) != 1) {
- fprintf(stderr, "Error: %s argument \"%s\" is not an floating-point number\n", arg_name, arg_value);
+ fprintf(stderr, "gsr error: %s argument \"%s\" is not an floating-point number\n", arg_name, arg_value);
usage();
return false;
}
if(arg->typed_value.d_value < arg->integer_value_min) {
- fprintf(stderr, "Error: %s argument is expected to be larger than %" PRIi64 ", got %lf\n", arg_name, arg->integer_value_min, arg->typed_value.d_value);
+ fprintf(stderr, "gsr error: %s argument is expected to be larger than %" PRIi64 ", got %lf\n", arg_name, arg->integer_value_min, arg->typed_value.d_value);
usage();
return false;
}
if(arg->typed_value.d_value > arg->integer_value_max) {
- fprintf(stderr, "Error: %s argument is expected to be less than %" PRIi64 ", got %lf\n", arg_name, arg->integer_value_max, arg->typed_value.d_value);
+ fprintf(stderr, "gsr error: %s argument is expected to be less than %" PRIi64 ", got %lf\n", arg_name, arg->integer_value_max, arg->typed_value.d_value);
usage();
return false;
}
@@ -826,7 +838,7 @@ bool args_parser_parse(args_parser *self, int argc, char **argv, const args_hand
}
if(!arg_append_value(arg, arg_value)) {
- fprintf(stderr, "Error: failed to append argument, out of memory\n");
+ fprintf(stderr, "gsr error: failed to append argument, out of memory\n");
return false;
}
}
@@ -834,7 +846,7 @@ bool args_parser_parse(args_parser *self, int argc, char **argv, const args_hand
for(int i = 0; i < NUM_ARGS; ++i) {
const Arg *arg = &self->args[i];
if(!arg->optional && arg->num_values == 0) {
- fprintf(stderr, "Error: missing argument '%s'\n", arg->key);
+ fprintf(stderr, "gsr error: missing argument '%s'\n", arg->key);
usage();
return false;
}
@@ -858,45 +870,45 @@ bool args_parser_validate_with_gl_info(args_parser *self, gsr_egl *egl) {
}
if(egl->gpu_info.is_steam_deck && self->bitrate_mode == GSR_BITRATE_MODE_QP) {
- fprintf(stderr, "Warning: qp bitrate mode is not supported on Steam Deck because of Steam Deck driver bugs. Using vbr instead\n");
+ fprintf(stderr, "gsr warning: qp bitrate mode is not supported on Steam Deck because of Steam Deck driver bugs. Using vbr instead\n");
self->bitrate_mode = GSR_BITRATE_MODE_VBR;
}
if(self->video_encoder == GSR_VIDEO_ENCODER_HW_CPU && self->bitrate_mode == GSR_BITRATE_MODE_VBR) {
- fprintf(stderr, "Warning: bitrate mode has been forcefully set to qp because software encoding option doesn't support vbr option\n");
+ fprintf(stderr, "gsr warning: bitrate mode has been forcefully set to qp because software encoding option doesn't support vbr option\n");
self->bitrate_mode = GSR_BITRATE_MODE_QP;
}
if(egl->gpu_info.vendor != GSR_GPU_VENDOR_NVIDIA && self->overclock) {
- fprintf(stderr, "Info: overclock option has no effect on amd/intel, ignoring option\n");
+ fprintf(stderr, "gsr info: overclock option has no effect on amd/intel, ignoring option\n");
self->overclock = false;
}
if(egl->gpu_info.vendor == GSR_GPU_VENDOR_NVIDIA && self->overclock && wayland) {
- fprintf(stderr, "Info: overclocking is not possible on nvidia on wayland, ignoring option\n");
+ fprintf(stderr, "gsr info: overclocking is not possible on nvidia on wayland, ignoring option\n");
self->overclock = false;
}
if(egl->gpu_info.is_steam_deck) {
- fprintf(stderr, "Warning: steam deck has multiple driver issues. One of them has been reported here: https://github.com/ValveSoftware/SteamOS/issues/1609\n"
+ fprintf(stderr, "gsr warning: steam deck has multiple driver issues. One of them has been reported here: https://github.com/ValveSoftware/SteamOS/issues/1609\n"
"If you have issues with GPU Screen Recorder on steam deck that you don't have on a desktop computer then report the issue to Valve and/or AMD.\n");
}
self->very_old_gpu = false;
if(egl->gpu_info.vendor == GSR_GPU_VENDOR_NVIDIA && egl->gpu_info.gpu_version != 0 && egl->gpu_info.gpu_version < 900) {
- fprintf(stderr, "Info: your gpu appears to be very old (older than maxwell architecture). Switching to lower preset\n");
+ fprintf(stderr, "gsr info: your gpu appears to be very old (older than maxwell architecture). Switching to lower preset\n");
self->very_old_gpu = true;
}
if(video_codec_is_hdr(self->video_codec) && !wayland) {
- fprintf(stderr, "Error: hdr video codec option %s is not available on X11\n", video_codec_to_string(self->video_codec));
+ fprintf(stderr, "gsr error: hdr video codec option %s is not available on X11\n", video_codec_to_string(self->video_codec));
usage();
return false;
}
const bool is_portal_capture = strcmp(self->window, "portal") == 0;
if(video_codec_is_hdr(self->video_codec) && is_portal_capture) {
- fprintf(stderr, "Warning: portal capture option doesn't support hdr yet (PipeWire doesn't support hdr), the video will be tonemapped from hdr to sdr\n");
+ fprintf(stderr, "gsr warning: portal capture option doesn't support hdr yet (PipeWire doesn't support hdr), the video will be tonemapped from hdr to sdr\n");
self->video_codec = hdr_video_codec_to_sdr_video_codec(self->video_codec);
}