JsonConfig: support "logo": null and "logo": "/path/to/logo"

This commit is contained in:
李通洲
2023-06-25 21:22:44 +08:00
parent 9021c6ee82
commit f0844d7636
5 changed files with 175 additions and 145 deletions
+6
View File
@@ -410,6 +410,12 @@ void ffLogoPrint(void)
const FFLogoOptions* options = &instance.config.logo;
if (options->type == FF_LOGO_TYPE_NONE)
{
logoPrintNone();
return;
}
//If the source is not set, we can directly print the detected logo.
if(options->source.length == 0)
{
+16
View File
@@ -201,6 +201,22 @@ const char* ffParseLogoJsonConfig(void)
yyjson_val* object = yyjson_obj_get(root, "logo");
if (!object) return NULL;
if (yyjson_is_null(object))
{
options->type = FF_LOGO_TYPE_NONE;
options->paddingTop = 0;
options->paddingRight = 0;
options->paddingLeft = 0;
return NULL;
}
if (yyjson_is_str(object))
{
const char* value = yyjson_get_str(object);
ffStrbufSetS(&options->source, value);
return NULL;
}
if (!yyjson_is_obj(object)) return "Property 'logo' must be an object";
yyjson_val *key_, *val;