]> git.sesse.net Git - mlt/blob - mlt++/swig/java/Play.java
Merge ../mlt++
[mlt] / mlt++ / swig / java / Play.java
1 import net.sourceforge.mltpp.*;
2
3 public class Play {
4
5         static {
6                 System.loadLibrary("mltpp_java");
7         }
8
9         public static void main (String[] args) {
10
11                 // Start the mlt system
12                 Factory.init( null );
13
14                 // Set the output profile
15                 Profile profile = new Profile( "" );
16
17                 // Create the producer
18                 Producer p = new Producer( profile, args[0], null );
19
20                 if ( p.is_valid() ) {
21           
22                         p.set ("eof", "loop");
23           
24                         // Create the consumer
25                         Consumer c = new Consumer( profile, "sdl", null);
26
27                         // Turn off the default rescaling
28                         c.set("rescale", "none");
29         
30                         // Connect the producer to the consumer
31                         c.connect(p);
32         
33                         // Start the consumer
34                         c.start();
35
36                         // Wait until the user stops the consumer
37                         Object o = new Object();
38                         while ( !c.is_stopped() ) {
39                                 synchronized (o) {
40                                         try {
41                                                 o.wait(1000);
42                                         } catch (InterruptedException e) {
43                                                 // ignored
44                                         }
45                                 }
46                         }
47
48                         // Stop it anyway
49                         c.stop();
50                 } else {
51                         System.out.println ("Unable to open " + args[0]);
52                 }
53         }
54 }