Hi,

I did a swig binding for csharp. I just join the build file.

I also run some test step by step to understand howto use mlt, and howto
use mlt with c#.

What can I do for now ? (see file mlt test step 1)

- simple play video
- simple Xml Out
- simple Play With Filter
- simple Play With Patial Filter (not all the video) 
- simple play with a luma transition between 2 video files
- simple render file with a luma transition between 2 video files
- Multitrack Play

I have some problems to : 
Display a simple black colour
Display a singlle jpg image
Import and deserialize a mlt xml file
I will send another mails ...

Steeve


Attachment: build
Description: application/shellscript

                private void SimplePlay(string file)
                {
                        Factory.init();
                        Profile profile = new Profile("atsc_720p_30");
                        Producer p = new Producer( profile,file,null);
                        if (p.is_valid())
                        {
                                System.Console.WriteLine(string.Format("fps : 
{0}", p.get_fps()));
                                System.Console.WriteLine(string.Format("length 
: {0}", p.get_length()));
                                System.Console.WriteLine(string.Format("speed : 
{0}", p.get_speed()));
                                System.Console.WriteLine(string.Format("in : 
{0}", p.get_in()));
                                System.Console.WriteLine(string.Format("out : 
{0}", p.get_out()));
                                System.Console.WriteLine(string.Format("width : 
{0}", profile.width()));
                                System.Console.WriteLine(string.Format("heigth 
: {0}", profile.height()));
                                System.Console.WriteLine(string.Format("name : 
{0}", p.get("ressource")));
                                
                                Consumer c = new Consumer(profile, "sdl", null);
                                c.set("rescale", "none");
                                c.connect(p);
                                c.start();                              
                                
                                while (!c.is_stopped())
                                {
                                        Thread.Sleep(300);
                                        
System.Console.WriteLine(string.Format("position : {0}", p.position()));
                                        if (p.position() >= p.get_length()-1)
                                                break;
                                }
                                c.stop();
                        }
                }
                
                private void SimpleXmlOut(string file)
                {
                        Factory.init();
                        Profile profile = new Profile("atsc_720p_30");
                        Producer p = new Producer( profile,file,null);
                        if (p.is_valid())
                        {
                                Consumer c = new Consumer(profile, "xml", 
"/home/steeve/xmlTestOut.xml");
                                c.set("rescale", "none");
                                c.connect(p);
                                c.start();                              
                                
                                while (!c.is_stopped())
                                {
                                        Thread.Sleep(300);
                                        
System.Console.WriteLine(string.Format("position : {0}", p.position()));
                                        if (p.position() >= p.get_length()-1)
                                                break;
                                }
                                c.stop();
                        }
                }
                
                private void SimplePlayWithFilter(string file, string filter)
                {
                        Factory.init();
                        Profile profile = new Profile("atsc_720p_30");
                        Producer p = new Producer( profile,file,null);
                        if (p.is_valid())
                        {
                                Filter fi = new Filter(profile, "grayscale");
                                SWIGTYPE_p_mlt_service_s s2 = p.get_service();
                                Service s2b = new Service(s2);
                                s2b.attach(fi);
                                fi.set_in_and_out(50,150);
                                Playlist playlist = new Playlist();
                                playlist.append(p);
                                Consumer c = new Consumer(profile, "sdl", null);
                                c.set("rescale", "none");
                                c.connect(playlist);
                                c.start();                              
                                
                                while (!c.is_stopped())
                                {
                                        Thread.Sleep(300);
                                        
System.Console.WriteLine(string.Format("position : {0}", p.position()));
                                        if (p.position() >= p.get_length()-1)
                                                break;
                                }
                                c.stop();
                        }
                }
                
                private void SimplePlayWithPatialFilter(string file, string 
filter, int inPosition, int outPosition)
                {
                        Factory.init();
                        Profile profile = new Profile("atsc_720p_30");
                        Producer p = new Producer( profile,file,null);
                        if (p.is_valid())
                        {
                                Filter fi = new Filter(profile, "grayscale");
                                SWIGTYPE_p_mlt_service_s s2 = p.get_service();
                                Service s2b = new Service(s2);
                                s2b.attach(fi);
                                fi.set_in_and_out(inPosition,outPosition);
                                Playlist playlist = new Playlist();
                                playlist.append(p);
                                Consumer c = new Consumer(profile, "sdl", null);
                                c.set("rescale", "none");
                                c.connect(playlist);
                                c.start();                              
                                
                                while (!c.is_stopped())
                                {
                                        Thread.Sleep(300);
                                        
System.Console.WriteLine(string.Format("position : {0}", playlist.position()));
                                        if (playlist.position() >= 
playlist.get_length()-1)
                                                break;
                                }
                                c.stop();
                        }
                }
                
                private void SimpleMixPlay(string file1, string file2)
                {
                        Factory.init();                                         
                        Profile profile = new Profile("atsc_720p_30");
                        
                        Producer p1 = new Producer( profile,file1,null);
                        Producer p2 = new Producer( profile,file2,null);
                        
                        Playlist playlist = new Playlist();
                        playlist.append(p1);
                        playlist.append(p2);
                        Transition t = new Transition(profile,"luma");
                        playlist.mix(0,50,t);
                        if (playlist.is_valid())
                        {
                                Consumer c = new Consumer(profile, "sdl", null);
                                c.set("rescale", "none");
                                c.connect(playlist);
                                c.start();                              
                                
                                while (!c.is_stopped())
                                {
                                        Thread.Sleep(300);
                                        
System.Console.WriteLine(string.Format("position : {0}", playlist.position()));
                                        if (playlist.position() >= 
playlist.get_length()-1)
                                                break;
                                }
                                c.stop();
                        }
                }
                
                private void SimpleMixRenderFile(string file1, string 
file2,string fileOut)
                {
                        Factory.init();                                         
                        Profile profile = new Profile("atsc_720p_30");
                        
                        Producer p1 = new Producer( profile,file1,null);
                        Producer p2 = new Producer( profile,file2,null);
                        
                        Playlist playlist = new Playlist();
                        playlist.append(p1);
                        playlist.append(p2);
                        Transition t = new Transition(profile,"luma");
                        playlist.mix(0,50,t);
                        if (playlist.is_valid())
                        {
                                Consumer c = new Consumer(profile, "avformat", 
fileOut);
                                c.set("f", "mpeg");
                                c.set("acodec", "mp2");
                                c.set("ab", "384k");
                                c.set("ar", "48000");
                                c.set("vcodec", "mpeg2video");
                                c.set("minrate", "0");
                                c.set("b", "25000k");
                                c.set("bf", "2");
                                c.set("b_strategy", "1");
                                c.set("trellis", "1");
                                c.set("aspect", "@16/9");
                                c.set("s", "720x480");
                                c.connect(playlist);
                                c.start();                              
                                
                                while (!c.is_stopped())
                                {
                                        Thread.Sleep(300);
                                        
System.Console.WriteLine(string.Format("position : {0}", playlist.position()));
                                        if (playlist.position() >= 
playlist.get_length()-1)
                                                break;
                                }
                                c.stop();
                        }
                }
                
                
                private void MultitrackPlay(string file1, string file2)
                {
                        Factory.init();                                         
                        Profile profile = new Profile("atsc_720p_30");
                        
                        Producer p1 = new Producer( profile,file1,null);
                        Producer p2 = new Producer( profile,file2,null);
                        
                        Playlist playlist1 = new Playlist();
                        playlist1.append(p1);
                        Playlist playlist2 = new Playlist();
                        playlist2.blank(playlist1.get_length()-1);
                        playlist2.append(p2);
                        Tractor tr = new Tractor();

                        Multitrack multi = tr.multitrack();;
                                
                        multi.connect(playlist1,0);
                        multi.connect(playlist2,1);
                        
                        if (tr.is_valid())
                        {
                                
                                System.Console.WriteLine(string.Format("length 
: {0}", tr.get_length()));
                                Consumer c = new Consumer(profile, "sdl", null);
                                c.set("rescale", "none");
                                c.connect(tr);
                                c.start();                              
                                
                                while (!c.is_stopped())
                                {
                                        Thread.Sleep(300);
                                        
System.Console.WriteLine(string.Format("position : {0}", tr.position()));
                                        if (tr.position() >= tr.get_length()-1)
                                                break;
                                }
                                c.stop();
                        }
                }
                
                private void MultitrackMixPlay(string file1, string file2)
                {
                        Factory.init();                                         
                        Profile profile = new Profile("atsc_720p_30");
                        
                        Producer p1 = new Producer( profile,file1,null);
                        Producer p2 = new Producer( profile,file2,null);
                        
                        Playlist playlist1 = new Playlist();
                        playlist1.append(p1);
                        Playlist playlist2 = new Playlist();
                        playlist2.blank(playlist1.get_length()-1 -50);
                        playlist2.append(p2);
                        Tractor tr = new Tractor();
                        Field field = tr.field();

                        Multitrack multi = tr.multitrack();;
                                
                        multi.connect(playlist1,0);
                        multi.connect(playlist2,1);
                        
                        Transition t = new Transition(profile,"luma");
                        t.set("in",playlist1.get_length()-1 -50);
                        t.set("out",playlist1.get_length()-1);
                        field.plant_transition(t,0,1);
                        
                        if (tr.is_valid())
                        {
                                
                                System.Console.WriteLine(string.Format("length 
: {0}", tr.get_length()));
                                Consumer c = new Consumer(profile, "sdl", null);
                                c.set("rescale", "none");
                                c.connect(tr);
                                c.start();                              
                                
                                while (!c.is_stopped())
                                {
                                        Thread.Sleep(300);
                                        
System.Console.WriteLine(string.Format("position : {0}", tr.position()));
                                        if (tr.position() >= tr.get_length()-1)
                                                break;
                                }
                                c.stop();
                        }
                }
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to