mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
feat: SchemaChecker & V4L2 enhancement (#734)
* libjpeg-turbo, QJsonSchemaChecker, V4L2 width/height/fps Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com> * Implement hyperion-v4l cli args * Apply v4l2 settings during runtime * feat: Provide minimum values for input restriction * fix: merge mess Co-authored-by: brindosch <edeltraud70@gmx.de>
This commit is contained in:
@@ -187,6 +187,14 @@ private:
|
||||
///
|
||||
void checkEnum(const QJsonValue & value, const QJsonValue & schema, const QJsonValue & defaultValue);
|
||||
|
||||
///
|
||||
/// @brief Return the "default" value as string. If not found, an empty string is output
|
||||
///
|
||||
/// @param value The JSON value to search
|
||||
/// @return The "default" value as string
|
||||
///
|
||||
QString getDefaultValue(const QJsonValue & value);
|
||||
|
||||
private:
|
||||
/// The schema of the entire json-configuration
|
||||
QJsonObject _qSchema;
|
||||
|
@@ -41,6 +41,37 @@ public:
|
||||
return createValue(schema, ignoreRequired);
|
||||
}
|
||||
|
||||
static QString getDefaultValue(const QJsonValue & value)
|
||||
{
|
||||
QString ret;
|
||||
switch (value.type())
|
||||
{
|
||||
case QJsonValue::Array:
|
||||
{
|
||||
for (const QJsonValue &v : value.toArray())
|
||||
{
|
||||
ret = getDefaultValue(v);
|
||||
if (!ret.isEmpty())
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QJsonValue::Object:
|
||||
ret = getDefaultValue(value.toObject().find("default").value());
|
||||
break;
|
||||
case QJsonValue::Bool:
|
||||
return value.toBool() ? "True" : "False";
|
||||
case QJsonValue::Double:
|
||||
return QString::number(value.toDouble());
|
||||
case QJsonValue::String:
|
||||
return value.toString();
|
||||
case QJsonValue::Null:
|
||||
case QJsonValue::Undefined:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static QJsonValue createValue(QJsonValue schema, bool ignoreRequired)
|
||||
|
Reference in New Issue
Block a user