3bf0e47ac6f9e155ffad847a0ece019286321a22
[melted] / 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 // Create the producer
15 Producer p = new Producer( args[0], null );
16
17 if ( p.is_valid() ) {
18
19 p.set ("eof", "loop");
20
21 // Create the consumer
22 Consumer c = new Consumer("sdl", null);
23
24 // Turn off the default rescaling
25 c.set("rescale", "none");
26
27 // Connect the producer to the consumer
28 c.connect(p);
29
30 // Start the consumer
31 c.start();
32
33 // Wait until the user stops the consumer
34 Object o = new Object();
35 while (c.is_stopped() == 0) {
36 synchronized (o) {
37 try {
38 o.wait(1000);
39 } catch (InterruptedException e) {
40 // ignored
41 }
42 }
43 }
44
45 // Stop it anyway
46 c.stop();
47 } else {
48 System.out.println ("Unable to open " + args[0]);
49 }
50 }
51 }