src/Makefile: suppress warning on ldconfig failure
[melted] / mlt++ / swig / perl / play.pl
index 1b2e5ac..87047b9 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/env perl
+#!/usr/bin/env perl
 
 # Import required modules
 use mltpp;
@@ -6,8 +6,11 @@ use mltpp;
 # Not sure why the mltpp::Factory.init method fails...
 mltpp::mlt_factory_init( undef );
 
+# Establish the MLT profile
+$profile = new mltpp::Profile( undef );
+
 # Create the producer
-$p = new mltpp::Producer( $ARGV[0] );
+$p = new mltpp::Producer( $profile, $ARGV[0] );
 
 if ( $p->is_valid( ) )
 {
@@ -15,7 +18,7 @@ if ( $p->is_valid( ) )
        $p->set( "eof", "loop" );
 
        # Create the consumer
-       $c = new mltpp::Consumer( "sdl" );
+       $c = new mltpp::FilteredConsumer( $profile, "sdl" );
 
        # Turn of the default rescaling
        $c->set( "rescale", "none" );
@@ -23,16 +26,21 @@ if ( $p->is_valid( ) )
        # Connect the producer to the consumer
        $c->connect( $p );
        
+       $e = $c->setup_wait_for( "consumer-stopped" );
+
        # Start the consumer
        $c->start;
 
        # Wait until the user stops the consumer
-       while ( !$c->is_stopped ) {
-               sleep( 1 );
-       }
+       $c->wait_for( $e );
+
+       $e = undef;
+       $c = undef;
+       $p = undef;
 }
 else
 {
        print "Unable to open $ARGV[0]\n";
 }
 
+mltpp::mlt_factory_close( );