Skip to content

Instantly share code, notes, and snippets.

@mraaroncruz
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mraaroncruz/dcf88d81cf51ca2d7c65 to your computer and use it in GitHub Desktop.
Save mraaroncruz/dcf88d81cf51ca2d7c65 to your computer and use it in GitHub Desktop.
How to use mlt framework with ruby

So there are 3 possibilities that I see for getting mlt to work with Ruby.

  1. Run melted and build a ruby client for it. I actually partially built one that I would share with you if you are interested
  2. Use FFI and connect directly to “mlt.h.” This is the direction I would have headed in if I was still using mlt.
  3. Compile the Ruby SWIG bindings, fire up pry (pry was instrumental in being to do anything with the mlt bindings for me) and play around. If you are messing around in the repl, you can send arguments of the wrong type to methods and the error generally tells you what kind of argument it wants. With pry you can also ls classes and objects to see the methods available on them (awesome!).

Here are the lines that expose the SWIG API to the C++ API. So the Ruby classes you can use when you require “mlt”. ex. Producer.new
https://github.com/mltframework/mlt/blob/master/src/swig/mlt.i#L34

Here are the C++ files that are being referenced
https://github.com/mltframework/mlt/tree/master/src/mlt%2B%2B

And here are the C files with the actual implementation. They are pretty easy to read (for the most part) even if you have no C experience. self is trying to use a kind of OOP style in C. It is very similar to how you create Python classes.
https://github.com/mltframework/mlt/tree/master/src/framework

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