Skip to content
Merged
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
4 changes: 3 additions & 1 deletion .github/workflows/build-windows-msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ jobs:
env:
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/mltframework/index.json,readwrite"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: 'recursive'

- name: Restore from cache and setup vcpkg executable and data files.
uses: lukka/run-vcpkg@v11
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "src/modules/glaxnimate/glaxnimate"]
path = src/modules/glaxnimate/glaxnimate
url = https://gitlab.com/mattbas/glaxnimate.git
url = https://invent.kde.org/graphics/glaxnimate.git
ignore = dirty
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"MOD_PLUSGPL": "OFF",
"MOD_QT6": "ON",
"MOD_SOX": "OFF",
"MOD_GLAXNIMATE_QT6": "OFF",
"MOD_GLAXNIMATE_QT6": "ON",
"MOD_RESAMPLE": "OFF",
"MOD_RTAUDIO": "OFF",
"MOD_RUBBERBAND": "ON",
Expand Down
167 changes: 7 additions & 160 deletions src/modules/glaxnimate/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,146 +1,13 @@
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CORE_DIR glaxnimate/src/core/)
set(APP_DIR glaxnimate/external/QtAppSetup/src/)

set(GLAX_SOURCES

${APP_DIR}app/application.cpp
${APP_DIR}app/settings/settings_group.cpp
${APP_DIR}app/settings/settings.cpp
${APP_DIR}app/settings/palette_settings.cpp
${APP_DIR}app/settings/keyboard_shortcuts.cpp
${APP_DIR}app/settings/keyboard_shortcuts_model.cpp
${APP_DIR}app/translation_service.cpp
${APP_DIR}app/scripting/script_engine.cpp
${APP_DIR}app/widgets/settings_dialog.cpp
${APP_DIR}app/widgets/settings_dialog.ui
${APP_DIR}app/widgets/widget_palette_editor.cpp
${APP_DIR}app/widgets/widget_palette_editor.ui
${APP_DIR}app/widgets/clearable_keysequence_edit.cpp
${APP_DIR}app/widgets/clearable_keysequence_edit.ui
${APP_DIR}app/widgets/keyboard_settings_widget.cpp
${APP_DIR}app/widgets/keyboard_settings_widget.ui
${APP_DIR}app/log/logger.cpp
${APP_DIR}app/log/log_model.cpp
${APP_DIR}app/cli.cpp

${CORE_DIR}app_info.cpp

${CORE_DIR}command/structure_commands.cpp
${CORE_DIR}command/shape_commands.cpp
${CORE_DIR}command/animation_commands.cpp

${CORE_DIR}io/base.cpp
${CORE_DIR}io/binary_stream.cpp
${CORE_DIR}io/utils.cpp
${CORE_DIR}io/glaxnimate/glaxnimate_format.cpp
${CORE_DIR}io/glaxnimate/glaxnimate_importer.cpp
${CORE_DIR}io/glaxnimate/glaxnimate_mime.cpp
${CORE_DIR}io/lottie/cbor_write_json.cpp
${CORE_DIR}io/lottie/lottie_format.cpp
${CORE_DIR}io/lottie/lottie_html_format.cpp
${CORE_DIR}io/lottie/tgs_format.cpp
${CORE_DIR}io/lottie/validation.cpp
${CORE_DIR}io/mime/mime_serializer.cpp
${CORE_DIR}io/raster/raster_format.cpp
${CORE_DIR}io/raster/spritesheet_format.cpp
${CORE_DIR}io/rive/rive_format.cpp
${CORE_DIR}io/rive/rive_html_format.cpp
${CORE_DIR}io/rive/rive_loader.cpp
${CORE_DIR}io/rive/rive_serializer.cpp
${CORE_DIR}io/rive/type_def.cpp
${CORE_DIR}io/rive/type_system.cpp
${CORE_DIR}io/svg/detail.cpp
${CORE_DIR}io/svg/svg_format.cpp
${CORE_DIR}io/svg/svg_parser.cpp
${CORE_DIR}io/svg/svg_renderer.cpp
${CORE_DIR}io/avd/avd_parser.cpp
${CORE_DIR}io/avd/avd_format.cpp
${CORE_DIR}io/avd/avd_renderer.cpp
${CORE_DIR}io/aep/aep_format.cpp
${CORE_DIR}io/aep/aep_loader.cpp
${CORE_DIR}io/aep/string_decoder.cpp
${CORE_DIR}io/aep/gradient_xml.cpp

${CORE_DIR}math/geom.cpp
${CORE_DIR}math/polynomial.cpp
${CORE_DIR}math/ellipse_solver.cpp
${CORE_DIR}math/bezier/bezier.cpp
${CORE_DIR}math/bezier/point.cpp
${CORE_DIR}math/bezier/operations.cpp
${CORE_DIR}math/bezier/cubic_struts.cpp
${CORE_DIR}math/bezier/meta.cpp
${CORE_DIR}math/bezier/bezier_length.cpp

${CORE_DIR}model/document.cpp
${CORE_DIR}model/document_node.cpp
${CORE_DIR}model/object.cpp
${CORE_DIR}model/transform.cpp
${CORE_DIR}model/factory.cpp
${CORE_DIR}model/animation_container.cpp
${CORE_DIR}model/stretchable_time.cpp
${CORE_DIR}model/comp_graph.cpp
${CORE_DIR}model/mask_settings.cpp
${CORE_DIR}model/visitor.cpp
${CORE_DIR}model/custom_font.cpp

${CORE_DIR}model/animation/keyframe_transition.cpp
${CORE_DIR}model/animation/animatable.cpp
${CORE_DIR}model/animation/animatable_path.cpp
${CORE_DIR}model/property/property.cpp
${CORE_DIR}model/property/reference_property.cpp
${CORE_DIR}model/property/option_list_property.cpp

${CORE_DIR}model/assets/assets.cpp
${CORE_DIR}model/assets/brush_style.cpp
${CORE_DIR}model/assets/named_color.cpp
${CORE_DIR}model/assets/bitmap.cpp
${CORE_DIR}model/assets/gradient.cpp
${CORE_DIR}model/assets/asset_base.cpp
${CORE_DIR}model/assets/asset.cpp
${CORE_DIR}model/assets/composition.cpp
${CORE_DIR}model/assets/embedded_font.cpp
${CORE_DIR}model/assets/network_downloader.cpp

${CORE_DIR}model/shapes/shape.cpp
${CORE_DIR}model/shapes/fill.cpp
${CORE_DIR}model/shapes/rect.cpp
${CORE_DIR}model/shapes/group.cpp
${CORE_DIR}model/shapes/ellipse.cpp
${CORE_DIR}model/shapes/path.cpp
${CORE_DIR}model/shapes/stroke.cpp
${CORE_DIR}model/shapes/polystar.cpp
${CORE_DIR}model/shapes/styler.cpp
${CORE_DIR}model/shapes/layer.cpp
${CORE_DIR}model/shapes/image.cpp
${CORE_DIR}model/shapes/precomp_layer.cpp
${CORE_DIR}model/shapes/text.cpp
${CORE_DIR}model/shapes/repeater.cpp
${CORE_DIR}model/shapes/trim.cpp
${CORE_DIR}model/shapes/inflate_deflate.cpp
${CORE_DIR}model/shapes/path_modifier.cpp
${CORE_DIR}model/shapes/round_corners.cpp
${CORE_DIR}model/shapes/offset_path.cpp
${CORE_DIR}model/shapes/zig_zag.cpp

${CORE_DIR}plugin/plugin.cpp
${CORE_DIR}plugin/action.cpp
${CORE_DIR}plugin/io.cpp

${CORE_DIR}utils/gzip.cpp
)

file(GLOB YML "*.yml")
add_custom_target(Other_glaxnimate_Files SOURCES
${YML}
)
include(GenerateExportHeader)

function(mlt_add_glaxnimate_module ARG_TARGET)
cmake_parse_arguments(PARSE_ARGV 1 ARG "" "QT_VERSION;DATADIR" "")

Expand All @@ -149,27 +16,19 @@ function(mlt_add_glaxnimate_module ARG_TARGET)
message(FATAL_ERROR "mlt_add_glaxnimate_module called without a valid target name.")
endif()

if (NOT (("${ARG_QT_VERSION}" STREQUAL "5") OR ("${ARG_QT_VERSION}" STREQUAL "6")))
message(FATAL_ERROR "mlt_add_glaxnimate_module called without a valid Qt Version (allowed are 5 or 6).")
if (NOT ("${ARG_QT_VERSION}" STREQUAL "6"))
message(FATAL_ERROR "mlt_add_glaxnimate_module called without a valid Qt Version (allowed is 6).")
endif()

if ("${ARG_DATADIR}" STREQUAL "")
message(FATAL_ERROR "mlt_add_glaxnimate_module called without a valid data dir name.")
endif()

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/${CORE_DIR}application_info_generated.in.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/${CORE_DIR}application_info_generated.hpp"
)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/${APP_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/${CORE_DIR})
include_directories(${LibArchive_INCLUDE_DIRS})
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_subdirectory(glaxnimate/src/core/)

add_library(${ARG_TARGET} MODULE
producer_glaxnimate.cpp
${GLAX_SOURCES}
)
add_library(${ARG_TARGET} MODULE producer_glaxnimate.cpp)

string(MAKE_C_IDENTIFIER ${ARG_TARGET} EXPORT_MACRO_PREFIX)
string(TOUPPER "${EXPORT_MACRO_PREFIX}" EXPORT_MACRO_PREFIX_UPPERCASE)
Expand All @@ -178,25 +37,13 @@ function(mlt_add_glaxnimate_module ARG_TARGET)
EXPORT_MACRO_NAME "${EXPORT_MACRO_PREFIX_UPPERCASE}_EXPORT"
)
target_compile_options(${ARG_TARGET} PRIVATE ${MLT_COMPILE_OPTIONS})
add_definitions(-DWITHOUT_POTRACE -DWITHOUT_QT_COLOR_WIDGETS)

find_package(LibArchive REQUIRED)
find_package(ZLIB REQUIRED)

set_property(TARGET ${ARG_TARGET} APPEND PROPERTY AUTOMOC_MACRO_NAMES "GLAXNIMATE_OBJECT")

target_link_libraries(${ARG_TARGET} PRIVATE
mlt++
mlt
m
Threads::Threads
Qt${ARG_QT_VERSION}::Core
Qt${ARG_QT_VERSION}::Gui
Qt${ARG_QT_VERSION}::Network
Qt${ARG_QT_VERSION}::Widgets
Qt${ARG_QT_VERSION}::Xml
${LibArchive_LIBRARIES}
ZLIB::ZLIB
Glaxnimate::Core
)
target_include_directories(${ARG_TARGET} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
if(NOT WINDOWS_DEPLOY)
Expand Down
2 changes: 1 addition & 1 deletion src/modules/glaxnimate/glaxnimate
Submodule glaxnimate updated from 65f740 to 56c4a3
61 changes: 38 additions & 23 deletions src/modules/glaxnimate/producer_glaxnimate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,18 @@
#include <cstring>
#include <framework/mlt.h>
#include <QApplication>
#include <QPainter>

#include "glaxnimate/io/io_registry.hpp"
#include "glaxnimate/model/assets/assets.hpp"
#include "glaxnimate/model/assets/composition.hpp"
#include "glaxnimate/model/document.hpp"
#include "glaxnimate/module/module.hpp"
#include "glaxnimate/renderer/renderer.hpp"

#include "io/io_registry.hpp"
#include "model/assets/assets.hpp"
#include "model/assets/composition.hpp"
#include "model/document.hpp"
#if defined(mltglaxnimate_qt6_EXPORTS)
#include "mltglaxnimate_qt6_export.h"
#define MLT_GLAXNIMATE_MODULE_EXPORT MLTGLAXNIMATE_QT6_EXPORT
#elif defined(mltglaxnimate_EXPORTS)
#include "mltglaxnimate_export.h"
#define MLT_GLAXNIMATE_MODULE_EXPORT MLTGLAXNIMATE_EXPORT
#else
#define MLT_GLAXNIMATE_MODULE_EXPORT
#endif

using namespace glaxnimate;
Expand All @@ -47,6 +46,12 @@ class Glaxnimate
std::unique_ptr<model::Document> m_document;

public:
Glaxnimate()
{
// Initialize default format loaders and Qt meta types
glaxnimate::module::initialize();
}

mlt_profile m_profile = nullptr;

void setProducer(mlt_producer producer) { m_producer = producer; }
Expand All @@ -59,10 +64,15 @@ class Glaxnimate

glaxnimate::model::Composition *composition() const
{
return m_document->assets()->compositions->values[0];
auto comps = m_document->assets()->compositions.get();
if (comps->values.empty()) {
mlt_log_error(service(), "No compositions in Glaxnimate document\n");
}

return comps->values[0];
}

QSize size() const { return composition()->size(); }
QSizeF size() const { return composition()->size(); }

int duration() const
{
Expand Down Expand Up @@ -95,16 +105,25 @@ class Glaxnimate
int error = 0;
auto pos = mlt_frame_original_position(frame);
if (!::qstrcmp("loop", mlt_properties_get(properties(), "eof"))) {
pos %= duration();
pos %= std::max(1, duration());
}
pos += toMltFps(composition()->animation->first_frame.get());

auto bg = mlt_properties_get_color(properties(), "background");
auto background = QColor(bg.r, bg.g, bg.b, bg.a);
pos += toMltFps(composition()->animation->first_frame.get());
auto image = composition()->render_image(toGlaxnimateFps(pos),
{*width, *height},
background);

// workaround for Glaxnimate 0.6.0 not using background
if (bg.a > 0) {
QPainter painter(&image);
painter.setCompositionMode(QPainter::CompositionMode_DestinationOver);
painter.fillRect(image.rect(), background);
}

*format = mlt_image_rgba;
image = image.convertToFormat(QImage::Format_RGBA8888);
int size = mlt_image_format_size(*format, *width, *height, NULL);
*buffer = static_cast<uint8_t *>(mlt_pool_alloc(size));
memcpy(*buffer, image.constBits(), size);
Expand All @@ -117,21 +136,21 @@ class Glaxnimate
{
auto filename = QString::fromUtf8(fileName);
auto importer = io::IoRegistry::instance().from_filename(filename, io::ImportExport::Import);
if (!importer || !importer->can_open()) {
mlt_log_error(service(), "Unknown importer\n");

if (!importer) {
mlt_log_error(service(), "No suitable importer for %s\n", fileName);
return false;
}

QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) {
mlt_log_error(service(), "Could not open input file for reading\n");
mlt_log_error(service(), "Could not open input file %s for reading\n", fileName);
return false;
}

m_document.reset(new model::Document(filename));
QVariantMap settings;
if (!importer->open(file, filename, m_document.get(), settings)) {
mlt_log_error(service(), "Error loading input file\n");
if (!importer->load(m_document.get(), file.readAll(), {}, filename)) {
mlt_log_error(service(), "Error loading input file %s\n", fileName);
return false;
}

Expand Down Expand Up @@ -279,11 +298,7 @@ static mlt_properties metadata(mlt_service_type type, const char *id, void *data
}
snprintf(file,
PATH_MAX,
#if QT_VERSION_MAJOR < 6
"%s/glaxnimate/%s_%s.yml",
#else
"%s/glaxnimate-qt6/%s_%s.yml",
#endif
mlt_environment("MLT_DATA"),
service_type,
id);
Expand Down
Loading