Skip to content

Openfx v3#1204

Draft
bmatherly wants to merge 39 commits intomasterfrom
openfx
Draft

Openfx v3#1204
bmatherly wants to merge 39 commits intomasterfrom
openfx

Conversation

@bmatherly
Copy link
Member

Work on openfx module continued from this PR: #1186

mr.fantastic and others added 30 commits February 22, 2026 15:13
- handle the Microsoft Visual C++ compiler in module CMakeLists.txt
- Change every copyright to the year 2025
- Use C99 variables in the for loop initializer declare style
- Clang format and include <stdbool.h> explicitly
- specify which versions of OpenFX supported
- mention OpenFX header files URL in mlt_openfx.c
- using mlt_image and its functions in src/modules/openfx/filter_openfx.c
…escribe in context action required by some plugins such as net.sf.openfx.Mirror to function
@bmatherly
Copy link
Member Author

bmatherly commented Feb 23, 2026

I still can not get the mirror filter to work:

Using a single parameter like this has no effect:
melt test.mp4 -filter openfx.net.sf.openfx.Mirror flop=1

Using two parameters crashes every time:
melt test.mp4 -filter openfx.net.sf.openfx.Mirror flop=1 flip=1

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds OpenFX 1.5 plugin support to MLT, continuing work from PR #1186. It provides a module for processing videos using OpenFX plugins, filtering out unsupported plugins (draw suite, OpenGL) and handling plugin identifiers containing colons by replacing them with ^.

Changes:

  • Adds complete OpenFX module infrastructure including header files from the OpenFX specification
  • Implements MLT integration layer for OpenFX plugins with host suite implementations
  • Adds CMake build configuration with glib dependency and GPL licensing

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
CMakeLists.txt Adds MOD_OPENFX option and glib dependency check
CMakePresets.json Sets MOD_OPENFX to OFF by default
src/modules/CMakeLists.txt Adds openfx subdirectory to build
src/modules/openfx/CMakeLists.txt Defines mltopenfx module build configuration
src/modules/openfx/factory.c Plugin discovery and registration from OFX_PLUGIN_PATH
src/modules/openfx/filter_openfx.c Main filter implementation for OpenFX effects
src/modules/openfx/mlt_openfx.h Common function declarations for OpenFX integration
src/modules/openfx/filter_openfx.yml Metadata for the OpenFX filter
src/modules/openfx/openfx/LICENSE.md BSD-3-Clause license for OpenFX headers
src/modules/openfx/openfx/include/*.h OpenFX 1.5 API header files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@joinlaw
Copy link
Contributor

joinlaw commented Feb 27, 2026

I built this branch and some plugins cause it to crash such as io.aswf.openfx.example.ColourspacePluginBasic because we didn't define kOfxImageEffectPropColourManagementStyle in the host properties although it come NULL with propGetString but the return status value of propGetString is kOfxStatOK which is not true it should return error status code because this property doesn't exists so:

diff --git a/src/modules/openfx/mlt_openfx.c b/src/modules/openfx/mlt_openfx.c
index 7dc6d8b9..d77ba9da 100644
--- a/src/modules/openfx/mlt_openfx.c
+++ b/src/modules/openfx/mlt_openfx.c
@@ -394,6 +394,10 @@ static OfxStatus propGetString(OfxPropertySetHandle properties,
     mlt_properties p = fetch_mlt_properties(properties, index);
     if (!p)
         return kOfxStatErrBadIndex;
+
+    if (!mlt_properties_exists(p, property))
+       return kOfxStatErrUnknown;
+
     *value = mlt_properties_get(p, property);
     return kOfxStatOK;
 }

And there will plugins that will use extensions that will come in the future and we don't support it yet so setting kOfxImageEffectPropColourManagementStyle alone in the host properties is not enough.

And this branch changed the way that filter metadata is formed so some video editors who parses mlt filter metada and generate the generic UIs such as kdenlive and others cannot render the interface anymore

---
schema_version: 7.0
type: filter
identifier: openfx.uk.co.thefoundry.BasicGainPlugin
title: openfx.uk.co.thefoundry.BasicGainPlugin
version: 1
license: GPLv2
language: en
url: "https://openeffects.org/"
creator: mr.fantastic <mrfantastic@firemail.cc>
tags:
  - Video
description: Process videos using OpenFX 1.5 plugins.
parameters:
  scale:
    type: double
    animation: no
  scaleComponents:
    type: boolean
    animation: no
  componentScales:
    type: group
    opened: 0
    animation: no
  scaleR:
    type: double
    animation: no
  scaleG:
    type: double
    animation: no
  scaleB:
    type: double
    animation: no
  scaleA:
    type: double
    animation: no
  Main:
    animation: no
mltparam

@joinlaw
Copy link
Contributor

joinlaw commented Feb 27, 2026

The way I was saving properties internally as mlt_properties changed significantly it was (in pseudocode)

- Host Properties
  - kOfxImageEffectPropSupportedPixelDepths
    - t: mltofx_prop_string
    - v (length 2)
      - kOfxBitDepthByte
      - kOfxBitDepthShort
  - ...
    - ...
    - ...
      - ...
      - ...

And now it looks like

- Host Properties
 - 0
    - kOfxImageEffectPropContext: kOfxImageEffectContextFilter
    - kOfxImageEffectPropSupportedPixelDepths: kOfxBitDepthByte
 - 1
    - kOfxImageEffectPropSupportedPixelDepths: kOfxBitDepthShort
 - 2
    - ...
    - ...
 - 3
    - ...
    - ...

This resolves some review comments from Copilot about memory
leaks and editing stings by index.
The plugin might try to use the null pointer
@bmatherly
Copy link
Member Author

@joinlaw - Thanks for testing!!

I built this branch and some plugins cause it to crash

I applied your patch for propGetString. I think that makes sense since we do not want the plugin to use a null pointer. Should we also do that for other data types (double, int, pointer)?

And this branch changed the way that filter metadata

I will look into that

The way I was saving properties internally

The first digit is the dimension index. I decided to structure the dimensions this way to resolve the memory leaks caused by the calls to realloc() to create arrays. Let me know if this causes problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 27 out of 28 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Mostly related to:
 * Prefer mlt_properties_get_properties() to nest properties
 * NULL pointer checking
 * whitespace
@bmatherly
Copy link
Member Author

@joinlaw I think I have resolved our comments. Feel free to give it another try.

My only remaining issue is that I still get crashes when I run:

melt test.mp4 -filter openfx.net.sf.openfx.Mirror flop=1

If I can figure that out, this branch should be ready to merge.

@bmatherly
Copy link
Member Author

@joinlaw , I have not fixed the flip crash yet. But in the meantime, can you test this branch with your working copy? Thanks!

@joinlaw
Copy link
Contributor

joinlaw commented Mar 3, 2026

@joinlaw , I have not fixed the flip crash yet. But in the meantime, can you test this branch with your working copy? Thanks!

Nice. I will try it once I have free time an I will debug the mirror plugin also to see if I can find anything to deal with this crashes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants