diff options
Diffstat (limited to 'include/args_parser.h')
| -rw-r--r-- | include/args_parser.h | 72 |
1 files changed, 19 insertions, 53 deletions
diff --git a/include/args_parser.h b/include/args_parser.h index e8c68d8..2954dde 100644 --- a/include/args_parser.h +++ b/include/args_parser.h @@ -5,10 +5,11 @@ #include <stdint.h> #include "defs.h" #include "vec2.h" +#include "recorder/settings.h" typedef struct gsr_egl gsr_egl; -#define NUM_ARGS 38 +#define NUM_ARGS 39 typedef enum { GSR_CAPTURE_SOURCE_TYPE_WINDOW, @@ -56,66 +57,31 @@ typedef struct { } typed_value; } Arg; +/* These return the exit code that gpu-screen-recorder should exit with */ typedef struct { - void (*version)(void *userdata); - void (*info)(void *userdata); - void (*list_audio_devices)(void *userdata); - void (*list_application_audio)(void *userdata); - void (*list_v4l2_devices)(void *userdata); - void (*list_capture_options)(const char *card_path, void *userdata); - void (*list_monitors)(void *userdata); + int (*version)(void *userdata); + int (*info)(void *userdata); + int (*list_audio_devices)(void *userdata); + int (*list_application_audio)(void *userdata); + int (*list_v4l2_devices)(void *userdata); + int (*list_capture_options)(const char *card_path, void *userdata); + int (*list_monitors)(void *userdata); } args_handlers; +typedef enum { + ARGS_PARSE_RESULT_ERROR, + ARGS_PARSE_RESULT_OK, + /* One of the |args_handlers| ran and |command_exit_code| is set */ + ARGS_PARSE_RESULT_COMMAND_HANDLED +} args_parse_result; + typedef struct { Arg args[NUM_ARGS]; - - gsr_video_encoder_hardware video_encoder; - gsr_pixel_format pixel_format; - gsr_framerate_mode framerate_mode; - gsr_color_range color_range; - gsr_tune tune; - gsr_video_codec video_codec; - gsr_audio_codec audio_codec; - gsr_bitrate_mode bitrate_mode; - gsr_video_quality video_quality; - gsr_replay_storage replay_storage; - - const char *capture_source; - const char *container_format; - const char *filename; - const char *replay_recording_directory; - const char *portal_session_token_filepath; - const char *recording_saved_script; - const char *ffmpeg_opts; - const char *ffmpeg_video_opts; - const char *ffmpeg_audio_opts; - bool verbose; - bool gl_debug; - bool fallback_cpu_encoding; - bool low_power; - bool exclude_metadata; - bool record_cursor; - bool date_folders; - bool restore_portal_session; - bool restart_replay_on_save; - bool write_first_frame_ts; - bool is_replaying; - bool is_livestream; - bool is_output_piped; - bool low_latency_recording; - bool very_old_gpu; - int64_t video_bitrate; - int64_t audio_bitrate; - int64_t fps; - int64_t replay_buffer_size_secs; - double keyint; - vec2i output_resolution; - vec2i region_size; - vec2i region_position; + gsr_recorder_settings settings; } args_parser; /* |argv| is stored as a reference */ -bool args_parser_parse(args_parser *self, int argc, char **argv, const args_handlers *args_handlers, void *userdata); +args_parse_result args_parser_parse(args_parser *self, int argc, char **argv, const args_handlers *args_handlers, void *userdata, int *command_exit_code); void args_parser_deinit(args_parser *self); bool args_parser_validate_with_gl_info(args_parser *self, gsr_egl *egl); |
