Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ add_executable(shotcut WIN32 MACOSX_BUNDLE
commands/subtitlecommands.cpp commands/subtitlecommands.h
commands/timelinecommands.cpp commands/timelinecommands.h
commands/undohelper.cpp commands/undohelper.h
controllers/addonmetadataparser.cpp controllers/addonmetadataparser.h
controllers/addonqmlgenerator.cpp controllers/addonqmlgenerator.h
controllers/filtercontroller.cpp controllers/filtercontroller.h
controllers/scopecontroller.cpp controllers/scopecontroller.h
database.cpp database.h
Expand All @@ -18,6 +20,8 @@ add_executable(shotcut WIN32 MACOSX_BUNDLE
dialogs/addencodepresetdialog.ui
dialogs/alignaudiodialog.cpp dialogs/alignaudiodialog.h
dialogs/alignmentarray.cpp dialogs/alignmentarray.h
dialogs/addonfiltersdialog.cpp dialogs/addonfiltersdialog.h
dialogs/addonmetadatahelpdialog.cpp dialogs/addonmetadatahelpdialog.h
dialogs/bitratedialog.h dialogs/bitratedialog.cpp
dialogs/customprofiledialog.cpp dialogs/customprofiledialog.h
dialogs/customprofiledialog.ui
Expand Down Expand Up @@ -85,6 +89,7 @@ add_executable(shotcut WIN32 MACOSX_BUNDLE
mltcontroller.cpp mltcontroller.h
mltxmlchecker.cpp mltxmlchecker.h
models/actionsmodel.cpp models/actionsmodel.h
models/addonservicemodel.cpp models/addonservicemodel.h
models/alignclipsmodel.cpp models/alignclipsmodel.h
models/attachedfiltersmodel.cpp models/attachedfiltersmodel.h
models/audiolevelstask.cpp models/audiolevelstask.h
Expand Down
98 changes: 98 additions & 0 deletions src/controllers/addonmetadataparser.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* Copyright (c) 2026 Meltytech, LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "addonmetadataparser.h"

static bool parseYesNoBool(const char *value)
{
if (!value)
return false;
const QString text = QString::fromUtf8(value).trimmed().toLower();
return text == QStringLiteral("yes") || text == QStringLiteral("true")
|| text == QStringLiteral("1");
}

AddOnFilterDescriptor AddOnMetadataParser::parse(const QString &service,
Mlt::Properties *mltMetadata)
{
AddOnFilterDescriptor descriptor;
descriptor.service = service;
descriptor.title = service;

if (!mltMetadata || !mltMetadata->is_valid())
return descriptor;

descriptor.title = QString::fromUtf8(mltMetadata->get("title"));
if (descriptor.title.isEmpty())
descriptor.title = service;

descriptor.description = QString::fromUtf8(mltMetadata->get("description"));
Comment thread
bmatherly marked this conversation as resolved.

Mlt::Properties tags(mltMetadata->get_data("tags"));
if (tags.is_valid()) {
for (int i = 0; i < tags.count(); ++i) {
if (!qstricmp(tags.get(i), "Audio")) {
descriptor.isAudio = true;
break;
}
}
}

Mlt::Properties parameters(mltMetadata->get_data("parameters"));
if (!parameters.is_valid())
return descriptor;

for (int i = 0; i < parameters.count(); ++i) {
const char *rawName = parameters.get_name(i);
Mlt::Properties parameter(rawName ? parameters.get_data(rawName) : nullptr);

AddOnParameterDescriptor out;
if (parameter.is_valid()) {
out.title = QString::fromUtf8(parameter.get("title"));
out.defaultValue = QString::fromUtf8(parameter.get("default"));
out.type = QString::fromUtf8(parameter.get("type"));
out.isReadOnly = parseYesNoBool(parameter.get("readonly"));
out.supportsKeyframes = parseYesNoBool(parameter.get("animation"));
out.unit = QString::fromUtf8(parameter.get("unit"));
out.minimum = QString::fromUtf8(parameter.get("minimum"));
out.maximum = QString::fromUtf8(parameter.get("maximum"));
out.description = QString::fromUtf8(parameter.get("description"));
out.name = QString::fromUtf8(parameter.get("identifier"));

Mlt::Properties values(parameter.get_data("values"));
if (values.is_valid()) {
for (int v = 0; v < values.count(); ++v) {
QString option = QString::fromUtf8(values.get(v));
if (option.isEmpty()) {
const char *optionName = values.get_name(v);
if (optionName)
option = QString::fromUtf8(optionName);
}
if (!option.isEmpty() && !out.values.contains(option))
out.values << option;
}
}
}

if (out.name.isEmpty() && rawName)
out.name = QString::fromUtf8(rawName);

descriptor.parameters.push_back(out);
}

return descriptor;
}
55 changes: 55 additions & 0 deletions src/controllers/addonmetadataparser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2026 Meltytech, LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef ADDONMETADATAPARSER_H
#define ADDONMETADATAPARSER_H

#include <MltProperties.h>
#include <QList>
#include <QString>

struct AddOnParameterDescriptor
{
QString name;
QString title;
QString type;
bool isReadOnly = false;
bool supportsKeyframes = false;
QStringList values;
QString defaultValue;
QString unit;
QString minimum;
QString maximum;
QString description;
};

struct AddOnFilterDescriptor
{
QString service;
QString title;
QString description;
bool isAudio = false;
QList<AddOnParameterDescriptor> parameters;
};

class AddOnMetadataParser
{
public:
static AddOnFilterDescriptor parse(const QString &service, Mlt::Properties *mltMetadata);
};

#endif // ADDONMETADATAPARSER_H
Loading