aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/recorder/error.h
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2026-08-01 21:17:53 +0200
committerdec05eba <dec05eba@protonmail.com>2026-08-01 21:17:53 +0200
commitd02955183135dbc72072492cdfcb35f2387e2c00 (patch)
treee12defe454c7a7e3661bd1cabd9e11ef5d68d44e /include/recorder/error.h
parente8fca67df16025598f6ca7bcc31cfdcfb79feb7d (diff)
Move video/audio codec selection from main.cpp into codec_select module
Codec selection returns gsr_error values instead of exiting, and takes gsr_recorder_settings instead of the argument parser.
Diffstat (limited to 'include/recorder/error.h')
-rw-r--r--include/recorder/error.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/recorder/error.h b/include/recorder/error.h
new file mode 100644
index 0000000..75f1416
--- /dev/null
+++ b/include/recorder/error.h
@@ -0,0 +1,31 @@
+#ifndef GSR_RECORDER_ERROR_H
+#define GSR_RECORDER_ERROR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* The negated value of each error is the exit code that gpu-screen-recorder exits with */
+typedef enum {
+ GSR_ERROR_OK = 0,
+ GSR_ERROR_GENERIC = -1,
+ GSR_ERROR_AUDIO_SETUP_FAILED = -2,
+ GSR_ERROR_CAPTURE_FAILED = -3,
+ GSR_ERROR_VIDEO_CODEC_QUERY_FAILED = -11,
+ GSR_ERROR_OPENGL_LOAD_FAILED = -22,
+ GSR_ERROR_AUDIO_DEVICE_NOT_FOUND = -50,
+ GSR_ERROR_MONITOR_NOT_FOUND = -51,
+ GSR_ERROR_NO_VIDEO_CODEC_AVAILABLE = -52,
+ GSR_ERROR_VIDEO_CODEC_RESOLUTION_UNSUPPORTED = -53,
+ GSR_ERROR_VIDEO_CODEC_UNSUPPORTED = -54
+} gsr_error;
+
+static inline int gsr_error_to_exit_code(int error) {
+ return error < 0 ? -error : 0;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GSR_RECORDER_ERROR_H */