Mlt Ref Counts and Playlist split/join
[melted] / mlt++ / swig / perl / play.pl
1 #!/bin/env perl
2
3 # Import required modules
4 use mltpp;
5
6 # Not sure why the mltpp::Factory.init method fails...
7 mltpp::mlt_factory_init( undef );
8
9 # Create the producer
10 $p = new mltpp::Producer( $ARGV[0] );
11
12 if ( $p->is_valid( ) )
13 {
14 # Loop the video
15 $p->set( "eof", "loop" );
16
17 # Create the consumer
18 $c = new mltpp::FilteredConsumer( "sdl" );
19 $c->attach( new mltpp::Filter( "greyscale" ) );
20
21 # Turn of the default rescaling
22 $c->set( "rescale", "none" );
23
24 # Connect the producer to the consumer
25 $c->connect( $p );
26
27 # Start the consumer
28 $c->start;
29
30 # Wait until the user stops the consumer
31 while ( !$c->is_stopped ) {
32 sleep( 1 );
33 }
34
35 $c->stop( );
36 $c = undef;
37 $p = undef;
38 }
39 else
40 {
41 print "Unable to open $ARGV[0]\n";
42 }
43
44 mltpp::mlt_factory_close( );