X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=mlt%2B%2B%2Fswig%2Fruby%2Fplay.rb;h=1ec995bc18163dbdb34bb80564b6c1aa68f94e53;hb=f4963a6aa07644399b273b5d2b1f9299c9047414;hp=0c548643bd613d30bb1611b97b4a4b12489aa9b2;hpb=ccdf1f8b1a0a81a30058240818e0e6e221c84bb6;p=melted diff --git a/mlt++/swig/ruby/play.rb b/mlt++/swig/ruby/play.rb index 0c54864..1ec995b 100755 --- a/mlt++/swig/ruby/play.rb +++ b/mlt++/swig/ruby/play.rb @@ -1,4 +1,4 @@ -#!/usr/bin/ruby +#!/usr/bin/env ruby # Import required modules require 'mltpp' @@ -6,21 +6,27 @@ require 'mltpp' # Create the mlt system Mltpp::Factory::init +# Establish the mlt profile +profile = Mltpp::Profile.new + # Get and check the argument file = ARGV.shift raise "Usage: test.rb file" if file.nil? # Create the producer -producer = Mltpp::Factory::producer( file ) -raise "Unable to load #{file}" if producer.is_valid == 0 +producer = Mltpp::Factory::producer( profile, file ) +raise "Unable to load #{file}" if !producer.is_valid # Create the consumer -consumer = Mltpp::Factory::consumer( "sdl" ) -raise "Unable to open sdl consumer" if consumer.is_valid == 0 +consumer = Mltpp::Consumer.new( profile, "sdl" ) +raise "Unable to open sdl consumer" if !consumer.is_valid # Turn off the default rescaling consumer.set( "rescale", "none" ) +# Set up a 'wait for' event +event = consumer.setup_wait_for( "consumer-stopped" ) + # Start the consumer consumer.start @@ -28,9 +34,7 @@ consumer.start consumer.connect( producer ) # Wait until the user stops the consumer -while consumer.is_stopped == 0 - sleep( 1 ) -end +consumer.wait_for( event ) # Clean up consumer consumer.stop