Call -sc script on screenshot as well, only save screenshot if no error

This commit is contained in:
dec05eba
2025-08-24 21:07:58 +02:00
parent 48932dfdfb
commit 5a93d292ea
5 changed files with 16 additions and 8 deletions

View File

@@ -311,7 +311,7 @@ static void usage_full() {
printf("\n");
printf(" -df Organise replays in folders based on the current date.\n");
printf("\n");
printf(" -sc Run a script on the saved video file (asynchronously). The first argument to the script is the filepath to the saved video file and the second argument is the recording type (either \"regular\" or \"replay\").\n");
printf(" -sc Run a script on the saved video file (asynchronously). The first argument to the script is the filepath to the saved video/screenshot file and the second argument is the recording type (either \"regular\", \"replay\" or \"screenshot\").\n");
printf(" Not applicable for live streams.\n");
printf(" Note: the script has to be executable.\n");
printf("\n");

View File

@@ -65,6 +65,7 @@ bool gsr_cuda_load(gsr_cuda *self, Display *display, bool do_overclock) {
goto fail;
}
// TODO: Use the device associated with the opengl graphics context
CUdevice cu_dev;
res = self->cuDeviceGet(&cu_dev, 0);
if(res != CUDA_SUCCESS) {

View File

@@ -2347,11 +2347,16 @@ static void capture_image_to_file(args_parser &arg_parser, gsr_egl *egl, gsr_ima
}
gsr_egl_swap_buffers(egl);
const int image_quality = video_quality_to_image_quality_value(arg_parser.video_quality);
if(!gsr_image_writer_write_to_file(&image_writer, arg_parser.filename, image_format, image_quality)) {
fprintf(stderr, "gsr error: capture_image_to_file_wayland: failed to write opengl texture to image output file %s\n", arg_parser.filename);
_exit(1);
if(!should_stop_error) {
const int image_quality = video_quality_to_image_quality_value(arg_parser.video_quality);
if(!gsr_image_writer_write_to_file(&image_writer, arg_parser.filename, image_format, image_quality)) {
fprintf(stderr, "gsr error: capture_image_to_file_wayland: failed to write opengl texture to image output file %s\n", arg_parser.filename);
_exit(1);
}
if(arg_parser.recording_saved_script)
run_recording_saved_script_async(arg_parser.recording_saved_script, arg_parser.filename, "screenshot");
}
gsr_image_writer_deinit(&image_writer);