Thank you to Steeve Descarpentries for the initial contribution.
cat << EOF
SWIG options:
- --swig-languages=[all | [java | lua | perl | php | python | ruby | tcl]*]
+ --swig-languages=[all | [csharp | java | lua | perl | php | python | ruby | tcl]*]
- High level language bindings (default: none)
EOF
fi
which swig > /dev/null 2>&1
[ $? != 0 ] && echo "Please install swig" && exit 1
- [ "$languages" = "all" ] && languages="java lua perl php python ruby tcl"
+ [ "$languages" = "all" ] && languages="csharp java lua perl php python ruby tcl"
echo SUBDIRS = $languages > config.mak
;;
esac
--- /dev/null
+#!/bin/sh
+
+if [ "$1" = "clean" ]
+then
+ ( cd `dirname $0`; rm -rf *.cxx *.snk *.so *.o *.exe *.dll mlt.i ../.cs src_swig )
+ exit 0
+fi
+
+path=`which mcs 2> /dev/null`
+
+if [ $? = 0 ]
+then
+ ln -sf ../mlt.i
+
+ # Invoke swig
+ mkdir src_swig
+ swig -c++ -I../../mlt++ -I../.. -csharp -dllimport libmltsharp -outdir src_swig -namespace Mlt mlt.i || exit $?
+
+ # Compile the wrapper
+ g++ -D_GNU_SOURCE -c -rdynamic -pthread -I../.. mlt_wrap.cxx -fPIC || exit $?
+
+ # Create the module
+ gcc -shared mlt_wrap.o -L../../mlt++ -lmlt++ -o libmltsharp.so || exit $?
+
+ # Compile the library assembly
+ mcs -out:mlt-sharp.dll -target:library src_swig/*.cs
+ # uncomment the below if you want to sign the assembly
+ # sn -k mlt-sharp.snk
+ # mcs -out:mlt-sharp.dll -target:library -keyfile:mlt-sharp.snk src_swig/*.cs
+
+ # Compile the example
+ mcs -r:mlt-sharp.dll play.cs
+
+else
+ echo Mono C# compiler not installed.
+ exit 1
+fi
--- /dev/null
+using System;
+using System.Threading;
+using Mlt;
+
+public class Play {
+ public static void Main(String[] args) {
+ Console.WriteLine("Welcome to MLT.");
+ Factory.init();
+ Profile profile = new Profile("");
+ Producer p = new Producer(profile, args[0], null);
+ if (p.is_valid()) {
+ Consumer c = new Consumer(profile, "sdl", null);
+ c.set("rescale", "none");
+ c.connect(p);
+ c.start();
+ while (!c.is_stopped())
+ Thread.Sleep(300);
+ c.stop();
+ }
+ }
+}
--- /dev/null
+#!/bin/sh
+mono play.exe "$@"