aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image_writer.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2026-08-01 18:51:59 +0200
committerdec05eba <dec05eba@protonmail.com>2026-08-01 18:51:59 +0200
commitc150d0e6ba0ab1f9ecd6a1c933a58050187e0c81 (patch)
tree3cae92f93009e87aeb2487afce569d6a20a8586c /src/image_writer.c
parent9c2c0e1d0de9b3968415b08830a45f64091d3b98 (diff)
Add gsr_log logging module with log level and overridable log handler
Diffstat (limited to 'src/image_writer.c')
-rw-r--r--src/image_writer.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/image_writer.c b/src/image_writer.c
index adc88a7..5f3fe9e 100644
--- a/src/image_writer.c
+++ b/src/image_writer.c
@@ -1,4 +1,5 @@
#include "../include/image_writer.h"
+#include "../include/log.h"
#include "../include/egl.h"
#include "../include/utils.h"
@@ -83,7 +84,7 @@ bool gsr_image_writer_init_opengl(gsr_image_writer *self, gsr_egl *egl, int widt
self->height = height;
self->texture = gl_create_texture(self->egl, self->width, self->height, GL_RGBA8, GL_RGBA, GL_NEAREST); /* TODO: use GL_RGB16 instead of GL_RGB8 for hdr/10-bit */
if(self->texture == 0) {
- fprintf(stderr, "gsr error: gsr_image_writer_init: failed to create texture\n");
+ gsr_log(GSR_LOG_LEVEL_ERROR, "gsr_image_writer_init: failed to create texture");
return false;
}
@@ -128,7 +129,7 @@ static bool gsr_image_writer_write_memory_to_file(gsr_image_writer *self, const
}
if(!success)
- fprintf(stderr, "gsr error: gsr_image_writer_write_to_file: failed to write image data to output file %s\n", filepath);
+ gsr_log(GSR_LOG_LEVEL_ERROR, "gsr_image_writer_write_to_file: failed to write image data to output file %s", filepath);
return success;
}
@@ -136,7 +137,7 @@ static bool gsr_image_writer_write_memory_to_file(gsr_image_writer *self, const
static bool gsr_image_writer_write_opengl_texture_to_file(gsr_image_writer *self, const char *filepath, gsr_image_format image_format, int quality) {
uint8_t *frame_data = malloc(self->width * self->height * 4);
if(!frame_data) {
- fprintf(stderr, "gsr error: gsr_image_writer_write_to_file: failed to allocate memory for image frame\n");
+ gsr_log(GSR_LOG_LEVEL_ERROR, "gsr_image_writer_write_to_file: failed to allocate memory for image frame");
return false;
}