Merge ../mlt
[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 # Establish the mlt profile
10 profile = Mltpp::Profile.new
11
12 # Get and check the argument
13 file = ARGV.shift
14 raise "Usage: test.rb file" if file.nil?
15
16 # Create the producer
17 producer = Mltpp::Factory::producer( profile, file )
18 raise "Unable to load #{file}" if !producer.is_valid
19
20 # Create the consumer
21 consumer = Mltpp::Consumer.new( profile, "sdl" )
22 raise "Unable to open sdl consumer" if !consumer.is_valid
23
24 # Turn off the default rescaling
25 consumer.set( "rescale", "none" )
26
27 # Set up a 'wait for' event
28 event = consumer.setup_wait_for( "consumer-stopped" )
29
30 # Start the consumer
31 consumer.start
32
33 # Connect the producer to the consumer
34 consumer.connect( producer )
35
36 # Wait until the user stops the consumer
37 consumer.wait_for( event )
38
39 # Clean up consumer
40 consumer.stop
41