#!/usr/bin/env python

import bootstrap
import sys
import openpluginlib
import openimagelib
import openmedialib
import common

openpluginlib.init( "" )

if len( sys.argv ) > 1:
	sys.argv.pop( 0 )
	clips = common.parse_args( sys.argv )
	for clip in clips:
		input = common.input_wrapper( openmedialib.create_input( clip[ 0 ] ) )
		if input.valid( ):
			input_name = clip.pop( 0 )
			input.init( clip )
			frame = input.fetch( )
			if frame is not None:
				preview = common.preview( frame )
				i = 0
				while i < input.get_frames( ):
					if not preview.push( frame ): break
					i += 1
					input.seek( i, False )
					frame = input.fetch( )
else:
	print "Usage: play.py <input> ..."
	
openpluginlib.uninit( )
