Display: allow "compactType": null; improve json schema

This commit is contained in:
李通洲
2025-08-03 09:22:47 +08:00
parent 4a141c3f57
commit 980e552eba
2 changed files with 32 additions and 8 deletions
+27 -8
View File
@@ -2031,15 +2031,34 @@
"const": "display"
},
"compactType": {
"enum": [
"none",
"original",
"scaled",
"original-with-refresh-rate",
"scaled-with-refresh-rate"
],
"description": "Set if all displays should be printed in one line",
"default": "none"
"oneOf": [
{
"const": null,
"description": "Disable compact mode"
},
{
"const": "none",
"description": "Disable compact mode (kept for compatibility)"
},
{
"const": "original",
"description": "Print original resolutions"
},
{
"const": "scaled",
"description": "Print scaled resolutions"
},
{
"const": "original-with-refresh-rate",
"description": "Print original resolutions with refresh rates"
},
{
"const": "scaled-with-refresh-rate",
"description": "Print scaled resolutions with refresh rates"
}
],
"default": null
},
"preciseRefreshRate": {
"description": "Set if decimal refresh rates should not be rounded into integers when printing",
+5
View File
@@ -267,6 +267,10 @@ void ffParseDisplayJsonObject(FFDisplayOptions* options, yyjson_val* module)
continue;
if (unsafe_yyjson_equals_str(key, "compactType"))
{
if (yyjson_is_null(val))
options->compactType = FF_DISPLAY_COMPACT_TYPE_NONE;
else
{
int value;
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
@@ -281,6 +285,7 @@ void ffParseDisplayJsonObject(FFDisplayOptions* options, yyjson_val* module)
ffPrintError(FF_DISPLAY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Invalid %s value: %s", unsafe_yyjson_get_str(key), error);
else
options->compactType = (FFDisplayCompactType) value;
}
continue;
}