Fixes for mods to api
[melted] / mlt++ / swig / ruby / play.rb
1 #!/usr/bin/ruby
2
3 # Import required modules
4 require 'mltpp'
5
6 # Create the mlt system
7 Mltpp::Factory::init
8
9 # Get and check the argument
10 file = ARGV.shift
11 raise "Usage: test.rb file" if file.nil?
12
13 # Create the producer
14 producer = Mltpp::Factory::producer( file )
15 raise "Unable to load #{file}" if !producer.is_valid
16
17 # Create the consumer
18 consumer = Mltpp::Consumer.new( "sdl" )
19 raise "Unable to open sdl consumer" if !consumer.is_valid
20
21 # Turn off the default rescaling
22 consumer.set( "rescale", "none" )
23
24 # Start the consumer
25 consumer.start
26
27 # Connect the producer to the consumer
28 consumer.connect( producer )
29
30 # Wait until the user stops the consumer
31 while !consumer.is_stopped
32 sleep( 1 )
33 end
34
35 # Clean up consumer
36 consumer.stop
37