From 5ab25f435ae008057dc2054896629949e50c718f Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 12 Apr 2022 08:59:04 +0200 Subject: [PATCH] Improve how options are handled --- cmd/camera-streamer.c | 14 ++++++++++++++ device/buffer_list.c | 2 +- device/camera/camera.c | 12 ++---------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/cmd/camera-streamer.c b/cmd/camera-streamer.c index 59df7bd..61c3dd6 100644 --- a/cmd/camera-streamer.c +++ b/cmd/camera-streamer.c @@ -38,6 +38,20 @@ camera_options_t camera_options = { .allow_dma = true, .high_res_factor = 1.0, .low_res_factor = 0.0, + .h264 = { + .options = + "video_bitrate_mode=0" OPTION_VALUE_LIST_SEP + "video_bitrate=5000000" OPTION_VALUE_LIST_SEP + "repeat_sequence_header=5000000" OPTION_VALUE_LIST_SEP + "h264_i_frame_period=30" OPTION_VALUE_LIST_SEP + "h264_level=11" OPTION_VALUE_LIST_SEP + "h264_profile=4" OPTION_VALUE_LIST_SEP + "h264_minimum_qp_value=16" OPTION_VALUE_LIST_SEP + "h264_maximum_qp_value=32" + }, + .jpeg = { + .options = "compression_quality=80" + }, }; http_server_options_t http_options = { diff --git a/device/buffer_list.c b/device/buffer_list.c index a5e1998..aab728c 100644 --- a/device/buffer_list.c +++ b/device/buffer_list.c @@ -92,7 +92,7 @@ int buffer_list_set_stream(buffer_list_t *buf_list, bool do_on) buf_list->streaming = do_on; int enqueued = buffer_list_count_enqueued(buf_list); - LOG_VERBOSE(buf_list, "Streaming %s... Was %d of %d enqueud", do_on ? "started" : "stopped", enqueued, buf_list->nbufs); + LOG_INFO(buf_list, "Streaming %s... Was %d of %d enqueud", do_on ? "started" : "stopped", enqueued, buf_list->nbufs); return 0; error: diff --git a/device/camera/camera.c b/device/camera/camera.c index 3a4da7e..a780023 100644 --- a/device/camera/camera.c +++ b/device/camera/camera.c @@ -87,17 +87,9 @@ int camera_set_params(camera_t *camera) // Set some defaults for (int i = 0; i < 2; i++) { - device_set_option_list(camera->legacy_isp[2], camera->options.isp.options); - device_set_option_string(camera->codec_jpeg[i], "compression_quality", "80"); - device_set_option_string(camera->codec_h264[i], "video_bitrate_mode", "0"); - device_set_option_string(camera->codec_h264[i], "video_bitrate", "5000000"); - device_set_option_string(camera->codec_h264[i], "repeat_sequence_header", "1"); - device_set_option_string(camera->codec_h264[i], "h264_i_frame_period", "30"); - device_set_option_string(camera->codec_h264[i], "h264_level", "11"); - device_set_option_string(camera->codec_h264[i], "h264_profile", "4"); - device_set_option_string(camera->codec_h264[i], "h264_minimum_qp_value", "16"); - device_set_option_string(camera->codec_h264[i], "h264_maximum_qp_value", "32"); + device_set_option_list(camera->legacy_isp[i], camera->options.isp.options); device_set_option_list(camera->codec_jpeg[i], camera->options.jpeg.options); + device_set_option_string(camera->codec_h264[i], "repeat_sequence_header", "1"); // required for force key support device_set_option_list(camera->codec_h264[i], camera->options.h264.options); } return 0;