diff --git a/divinus.ini b/divinus.ini index e5145f4..c1d3cc5 100644 --- a/divinus.ini +++ b/divinus.ini @@ -54,6 +54,7 @@ enable = false [mp4] enable = false +codec = H265 # H264, H.264, AVC, etc. width = 3840 height = 2160 fps = 20 diff --git a/src/app_config.c b/src/app_config.c index d0866b3..1d24915 100644 --- a/src/app_config.c +++ b/src/app_config.c @@ -194,6 +194,18 @@ enum ConfigError parse_app_config(const char *path) { if (err != CONFIG_OK) goto RET_ERR; if (app_config.mp4_enable) { + { + const char *possible_values[] = {"H.264", "H.265", "H264", "H265", "AVC", "HEVC"}; + const int count = sizeof(possible_values) / sizeof(const char *); + int val = 0; + parse_enum( + &ini, "mp4", "codec", (void *)&val, + possible_values, count, 0); + if (val % 2) + app_config.mp4_codecH265 = true; + else + app_config.mp4_codecH265 = false; + } err = parse_int( &ini, "mp4", "width", 160, INT_MAX, &app_config.mp4_width); if (err != CONFIG_OK) @@ -205,9 +217,9 @@ enum ConfigError parse_app_config(const char *path) { err = parse_int(&ini, "mp4", "fps", 1, INT_MAX, &app_config.mp4_fps); if (err != CONFIG_OK) goto RET_ERR; - err = parse_int(&ini, "mp4", "profile", 0, 2, &app_config.mp4_profile); - if (err != CONFIG_OK) - goto RET_ERR; + + parse_int(&ini, "mp4", "profile", 0, 2, &app_config.mp4_profile); + err = parse_int( &ini, "mp4", "bitrate", 32, INT_MAX, &app_config.mp4_bitrate); if (err != CONFIG_OK) diff --git a/src/app_config.h b/src/app_config.h index 0b91149..b08b8ff 100644 --- a/src/app_config.h +++ b/src/app_config.h @@ -10,6 +10,7 @@ struct AppConfig { // [video_0] bool mp4_enable; + bool mp4_codecH265; unsigned int mp4_fps; unsigned int mp4_width; unsigned int mp4_height; diff --git a/src/video.c b/src/video.c index 919b501..711451d 100644 --- a/src/video.c +++ b/src/video.c @@ -255,7 +255,7 @@ int start_sdk() { hal_vidconfig config; config.width = app_config.mp4_width; config.height = app_config.mp4_height; - config.codec = HAL_VIDCODEC_H264; + config.codec = app_config.mp4_codecH265; config.mode = HAL_VIDMODE_CBR; config.profile = HAL_VIDPROFILE_BASELINE; config.gop = app_config.mp4_fps * 2;