mlt icon indicating copy to clipboard operation
mlt copied to clipboard

Initial Implementation of LV2 module

Open joinlaw opened this issue 1 year ago • 7 comments

Can be tested with melt eg:

$ melt ~/path/to/audio/file.wav -attach "lv2.http<//kxstudio.sf.net/carla/plugins/audiogain_s" 5=0.3 -consumer avformat:processed.mp3 acodec=libmp3lame

(:) in http://kxstudio.sf.net/carla/plugins/audiogain_s replaced with (<) because melt and/or mlt doesn't accept (:) in plugin name and also uri should be prefiexed with "lv2."

currently only this extensions are supported: http://lv2plug.in/ns/ext/buf-size#boundedBlockLength http://lv2plug.in/ns/ext/urid#map http://lv2plug.in/ns/ext/urid#unmap http://lv2plug.in/ns/ext/options#options

https://lv2plug.in/pages/host-compatibility.html

joinlaw avatar May 11 '24 19:05 joinlaw

The approach of copying the jackrack module and modifying it is not acceptable. That brings in a lot of baggage. jackrack code base was chosen at a time when I needed to support a rack XML file made with its GUI tool for a customer. This was a time when there were only some toy GUI tools for MLT. As a bonus it added support for JACK. I later modified it to support a single named LADSPA plugin for Kdenlive and friends. This ought to be a cleaner implementation without all of that baggage. I guess you can get there by continuing to modify, but I am not in a situation where I want to go through many PR reviews to get there. Alternatively, can the existing jackrack module be extended to support LV2?

At first I tried to extend the jackrack module and even put both LADSPA and LV2 plugins in the same plugin manager but I fail to get working code for months until I tried copying and I get here.

Actually I have to think about the approach and take time to be more familiar with filter design in mlt. The problem is it was hard for me to use same structure of plugin/process/manager so I have to heavily alter it and only lock_free_fifo.c, lock_free_fifo.h files copied without modification.

joinlaw avatar May 13 '24 22:05 joinlaw

with this commit aba53e9 now parameters metadata is more accurate and not causing issues and be readonly

kdenwork

And still I don't get dropdown options (enumerations) to work.

I am investigating ways to integrate this module in jackrack.

joinlaw avatar May 17 '24 19:05 joinlaw

By now this feature is reimplemented as part of jackrack module and the old implementation moved to lv2-module-old-way https://github.com/joinlaw/mlt/tree/lv2-module-old-way branch.

@ddennedy

joinlaw avatar May 24 '24 13:05 joinlaw

With commit 1de2a58 enumeration is supported and also I created MR in kdenlive project https://invent.kde.org/multimedia/kdenlive/-/merge_requests/520 to support it in the generic UI. In the case of Shotcut from what I see that shotcut does not generate generic effect UI there should be a manually created qt UI file and I don't look into other projects using mlt.

Screenshot from 2024-06-28 18-08-09

joinlaw avatar Jun 28 '24 15:06 joinlaw

Do not force push to a PR that has a lot of changes and already had some review. When you force push I need to start over the review because I can not see what you changed from I left off. And when there is a lot of code, it makes the reviewer more reluctant to start over.

ddennedy avatar Jun 28 '24 21:06 ddennedy

Build target clang-format-check fails with many errors. I noticed problems immediately when I start editing files, and git diff showed many unrelated changes because my IDE is setup to follow our clang-format rules and reformats some of the code. One of the biggest issues is using tab characters for indent. clang-format should be following our include .clang-format config file.

ddennedy avatar Jun 28 '24 22:06 ddennedy

Not wanting to be a total downer, I did run it (with my change to use ^), and it is working including things like melt -query and serializing to XML with melt -consumer xml my.mp4 -attach lv2.http^//calf.sourceforge.net/plugins/Crusher 20=100

...
    <filter id="filter0">
      <property name="mlt_service">lv2.http^//calf.sourceforge.net/plugins/Crusher</property>
      <property name="20">100</property>
    </filter>
...

I also ran the above for several frames through valgrind, and it did not complain about any memory problems in this new code. So, just these few things to tidy up, and it is ready!

ddennedy avatar Jun 28 '24 23:06 ddennedy