Skip to content

Commit

Permalink
Adding the HEVC configuration flag
Browse files Browse the repository at this point in the history
  • Loading branch information
wberube committed May 21, 2024
1 parent 934b974 commit f9b1c95
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions divinus.ini
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ enable = false

[mp4]
enable = false
codec = H265 # H264, H.264, AVC, etc.
width = 3840
height = 2160
fps = 20
Expand Down
18 changes: 15 additions & 3 deletions src/app_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/app_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f9b1c95

Please sign in to comment.