Event modifications
[melted] / mlt++ / swig / ruby / play.rb
1 #!/usr/bin/env 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 # Set up a 'wait for' event
25 event = consumer.setup_wait_for( "consumer-stopped" )
26
27 # Start the consumer
28 consumer.start
29
30 # Connect the producer to the consumer
31 consumer.connect( producer )
32
33 # Wait until the user stops the consumer
34 consumer.wait_for( event )
35
36 # Clean up consumer
37 consumer.stop
38