From c2ed8457ca38718bb44663e6b3cc08cb390bc363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20B=C3=A9rub=C3=A9?= Date: Tue, 21 May 2024 15:20:31 -0400 Subject: [PATCH] (Continued) --- src/hal/sstar/i6_hal.h | 4 ---- src/hal/sstar/i6c_hal.h | 4 ---- src/hal/sstar/i6f_hal.h | 4 ---- src/server.c | 18 +++++++----------- src/video.c | 4 ++-- 5 files changed, 9 insertions(+), 25 deletions(-) diff --git a/src/hal/sstar/i6_hal.h b/src/hal/sstar/i6_hal.h index d4f8d76..f06c336 100644 --- a/src/hal/sstar/i6_hal.h +++ b/src/hal/sstar/i6_hal.h @@ -22,11 +22,7 @@ int i6_audio_init(void); int i6_channel_bind(char index, char framerate, char jpeg); int i6_channel_create(char index, short width, short height, char mirror, char flip, char jpeg); -void i6_channel_disable(char index); -int i6_channel_enabled(char index); int i6_channel_grayscale(char enable); -int i6_channel_in_mainloop(char index); -int i6_channel_next(char mainLoop); int i6_channel_unbind(char index); int i6_config_load(char *path); diff --git a/src/hal/sstar/i6c_hal.h b/src/hal/sstar/i6c_hal.h index 56b0a37..28155ad 100644 --- a/src/hal/sstar/i6c_hal.h +++ b/src/hal/sstar/i6c_hal.h @@ -22,11 +22,7 @@ int i6c_audio_init(void); int i6c_channel_bind(char index, char framerate, char jpeg); int i6c_channel_create(char index, short width, short height, char mirror, char flip, char jpeg); -void i6c_channel_disable(char index); -int i6c_channel_enabled(char index); int i6c_channel_grayscale(char enable); -int i6c_channel_in_mainloop(char index); -int i6c_channel_next(char mainLoop); int i6c_channel_unbind(char index, char jpeg); int i6c_config_load(char *path); diff --git a/src/hal/sstar/i6f_hal.h b/src/hal/sstar/i6f_hal.h index 19b297c..623f5d0 100644 --- a/src/hal/sstar/i6f_hal.h +++ b/src/hal/sstar/i6f_hal.h @@ -20,11 +20,7 @@ int i6f_audio_init(void); int i6f_channel_bind(char index, char framerate, char jpeg); int i6f_channel_create(char index, short width, short height, char mirror, char flip, char jpeg); -void i6f_channel_disable(char index); -int i6f_channel_enabled(char index); int i6f_channel_grayscale(char enable); -int i6f_channel_in_mainloop(char index); -int i6f_channel_next(char mainLoop); int i6f_channel_unbind(char index, char jpeg); int i6f_config_load(char *path); diff --git a/src/server.c b/src/server.c index 4fe58bf..ba45db7 100644 --- a/src/server.c +++ b/src/server.c @@ -734,6 +734,7 @@ void *server_thread(void *vargp) { void sig_handler(int signo) { printf("Graceful shutdown...\n"); keepRunning = 0; + stop_schedule = 1; } void epipe_handler(int signo) { printf("EPIPE\n"); } void spipe_handler(int signo) { printf("SIGPIPE\n"); } @@ -742,17 +743,12 @@ int server_fd = -1; pthread_t server_thread_id; int start_server() { - if (signal(SIGINT, sig_handler) == SIG_ERR) - printf("Error: can't catch SIGINT\n"); - if (signal(SIGQUIT, sig_handler) == SIG_ERR) - printf("Error: can't catch SIGQUIT\n"); - if (signal(SIGTERM, sig_handler) == SIG_ERR) - printf("Error: can't catch SIGTERM\n"); - - if (signal(SIGPIPE, spipe_handler) == SIG_ERR) - printf("Error: can't catch SIGPIPE\n"); - if (signal(EPIPE, epipe_handler) == SIG_ERR) - printf("Error: can't catch EPIPE\n"); + signal(SIGINT, sig_handler); + signal(SIGQUIT, sig_handler); + signal(SIGTERM, sig_handler); + + signal(SIGPIPE, spipe_handler); + signal(EPIPE, epipe_handler); for (uint32_t i = 0; i < MAX_CLIENTS; ++i) { client_fds[i].socket_fd = -1; diff --git a/src/video.c b/src/video.c index 084c7e5..89656c6 100644 --- a/src/video.c +++ b/src/video.c @@ -253,7 +253,8 @@ int start_sdk() { hal_vidconfig config; config.width = app_config.mp4_width; config.height = app_config.mp4_height; - config.codec = app_config.mp4_codecH265; + config.codec = app_config.mp4_codecH265 ? + HAL_VIDCODEC_H265 : HAL_VIDCODEC_H264; config.mode = HAL_VIDMODE_CBR; config.profile = HAL_VIDPROFILE_BASELINE; config.gop = app_config.mp4_fps * 2; @@ -408,7 +409,6 @@ int stop_sdk() { case HAL_PLATFORM_I6C: i6c_system_deinit(); break; case HAL_PLATFORM_I6F: i6f_system_deinit(); break; case HAL_PLATFORM_V3: v3_system_deinit(); break; - } switch (plat) {