JsonConfig: write all flags when generating config file

This commit is contained in:
李通洲
2025-08-04 16:46:28 +08:00
parent e753d4d3a4
commit fa4e11c73b
83 changed files with 700 additions and 932 deletions
+31 -25
View File
@@ -282,35 +282,41 @@ void ffParseDisplayJsonObject(FFDisplayOptions* options, yyjson_val* module)
void ffGenerateDisplayJsonConfig(FFDisplayOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
{
__attribute__((__cleanup__(ffDestroyDisplayOptions))) FFDisplayOptions defaultOptions;
ffInitDisplayOptions(&defaultOptions);
ffJsonConfigGenerateModuleArgsConfig(doc, module, &options->moduleArgs);
ffJsonConfigGenerateModuleArgsConfig(doc, module, &defaultOptions.moduleArgs, &options->moduleArgs);
if (options->compactType != defaultOptions.compactType)
switch ((int) options->compactType)
{
switch ((int) options->compactType)
{
case FF_DISPLAY_COMPACT_TYPE_NONE:
yyjson_mut_obj_add_str(doc, module, "compactType", "none");
break;
case FF_DISPLAY_COMPACT_TYPE_ORIGINAL_BIT:
yyjson_mut_obj_add_str(doc, module, "compactType", "original");
break;
case FF_DISPLAY_COMPACT_TYPE_SCALED_BIT:
yyjson_mut_obj_add_str(doc, module, "compactType", "scaled");
break;
case FF_DISPLAY_COMPACT_TYPE_ORIGINAL_BIT | FF_DISPLAY_COMPACT_TYPE_REFRESH_RATE_BIT:
yyjson_mut_obj_add_str(doc, module, "compactType", "original-with-refresh-rate");
break;
case FF_DISPLAY_COMPACT_TYPE_SCALED_BIT | FF_DISPLAY_COMPACT_TYPE_REFRESH_RATE_BIT:
yyjson_mut_obj_add_str(doc, module, "compactType", "scaled-with-refresh-rate");
break;
}
case FF_DISPLAY_COMPACT_TYPE_NONE:
yyjson_mut_obj_add_str(doc, module, "compactType", "none");
break;
case FF_DISPLAY_COMPACT_TYPE_ORIGINAL_BIT:
yyjson_mut_obj_add_str(doc, module, "compactType", "original");
break;
case FF_DISPLAY_COMPACT_TYPE_SCALED_BIT:
yyjson_mut_obj_add_str(doc, module, "compactType", "scaled");
break;
case FF_DISPLAY_COMPACT_TYPE_ORIGINAL_BIT | FF_DISPLAY_COMPACT_TYPE_REFRESH_RATE_BIT:
yyjson_mut_obj_add_str(doc, module, "compactType", "original-with-refresh-rate");
break;
case FF_DISPLAY_COMPACT_TYPE_SCALED_BIT | FF_DISPLAY_COMPACT_TYPE_REFRESH_RATE_BIT:
yyjson_mut_obj_add_str(doc, module, "compactType", "scaled-with-refresh-rate");
break;
}
if (options->preciseRefreshRate != defaultOptions.preciseRefreshRate)
yyjson_mut_obj_add_bool(doc, module, "preciseRefreshRate", options->preciseRefreshRate);
yyjson_mut_obj_add_bool(doc, module, "preciseRefreshRate", options->preciseRefreshRate);
switch (options->order)
{
case FF_DISPLAY_ORDER_NONE:
yyjson_mut_obj_add_null(doc, module, "order");
break;
case FF_DISPLAY_ORDER_ASC:
yyjson_mut_obj_add_str(doc, module, "order", "asc");
break;
case FF_DISPLAY_ORDER_DESC:
yyjson_mut_obj_add_str(doc, module, "order", "desc");
break;
}
}
void ffGenerateDisplayJsonResult(FF_MAYBE_UNUSED FFDisplayOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)