You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mltpp/swig/ruby/play.rb

39 lines
801 B

#!/usr/bin/env ruby
# Import required modules
require 'mltpp'
# Create the mlt system
Mltpp::Factory::init
# 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
# Create the consumer
consumer = Mltpp::Consumer.new( "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
# Connect the producer to the consumer
consumer.connect( producer )
# Wait until the user stops the consumer
consumer.wait_for( event )
# Clean up consumer
consumer.stop