[Jahshaka-cvs] jah/jahtools/jbatch bootstrap.py, 1.5, 1.6 common.py, 1.4, 1.5 jbatch.py, 1.5, 1.6
Status: Beta
Brought to you by:
jahshaka
From: Charles Y. <lil...@us...> - 2007-03-09 10:57:36
|
Update of /cvsroot/jahshaka/jah/jahtools/jbatch In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv23612 Modified Files: bootstrap.py common.py jbatch.py Log Message: + Hook up for keygrab and handlers Index: jbatch.py =================================================================== RCS file: /cvsroot/jahshaka/jah/jahtools/jbatch/jbatch.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- jbatch.py 27 Feb 2007 15:34:17 -0000 1.5 +++ jbatch.py 9 Mar 2007 10:57:19 -0000 1.6 @@ -6,9 +6,11 @@ import openimagelib import openmedialib import jstack +import keygrab if len( sys.argv ) > 1: sys.argv.pop( 0 ) + keygrab.init( ) try: rpn = jstack.stack( ) rpn.push( "jstack.oml" ) Index: bootstrap.py =================================================================== RCS file: /cvsroot/jahshaka/jah/jahtools/jbatch/bootstrap.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- bootstrap.py 8 Mar 2007 11:30:46 -0000 1.5 +++ bootstrap.py 9 Mar 2007 10:57:19 -0000 1.6 @@ -8,7 +8,7 @@ # This is required for the executable generated from py2exe # to use the preinstalled openlibraries python bindings -if platform.system() == "win32": +if platform.system() == "Windows": sys.path.append(os.environ['PYTHONPATH']) # Initialise the dynamic linking functionality - note that the ubuntu amd64 @@ -39,51 +39,11 @@ else: openpluginlib.init() -# Provide http playback via python's urllib +# Register custom stream handlers +import handlers import openimagelib import openmedialib -import urllib - -# A reader which handles http stream playback -# -# NB: It assumes that the url to open starts with oml: - -class url_reader( openmedialib.stream_handler_delegate ): - def __init__( self ): - openmedialib.stream_handler_delegate.__init__( self ) - self.stream = None - self.block = "" - - def open( self, url, flags ): - self.stream = urllib.urlopen( url[ 4: ] ) - return self.stream is not None - - def read( self, size ): - self.block = self.stream.read( size ) - return self.block - def write( self, data ): - return -1 - - def seek( self, pos, whence ): - return -1 - - def close( self ): - self.stream.close( ) - - def is_stream( self ): - return True - - def is_thread_safe( self ): - return False - -# Dummy factory method for handlers (there's only one handler..) - -def url_callback( url, flags ): - return url_reader( ) - -# Register the factory method - -openmedialib.stream_handler_register( url_callback ) +openmedialib.stream_handler_register( handlers.url_callback ) Index: common.py =================================================================== RCS file: /cvsroot/jahshaka/jah/jahtools/jbatch/common.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- common.py 28 Feb 2007 10:20:51 -0000 1.4 +++ common.py 9 Mar 2007 10:57:19 -0000 1.5 @@ -4,6 +4,7 @@ import openmedialib import balance import time +import keygrab def parse_args( args ): clips = [] @@ -134,6 +135,10 @@ assign_props( output.properties( ), properties ) output.init( ) balance.activate( input ) + + if not has_keydown and keygrab.used( ): + print "Press 'q' to terminate" + i = 0 while frame is not None and i < input.get_frames( ): if not output.push( frame ): break @@ -144,6 +149,9 @@ elif key == 27: break elif key == 104: speed = -1 elif key != 0: print key + else: + key = keygrab.get( ) + if key == 'q': break if speed != 0: i += speed if i < 0: i = 0 @@ -266,7 +274,7 @@ self.fps_num.value_as_int( ), self.fps_den.value_as_int( ) ) for i in self.frame_store.keys( ): - if i < input_requested: + if i < input_requested or i > input_requested + 25: self.frame_store.pop( i ) while not self.frame_store.has_key( input_requested ) or not self.reseat.has( samples_required ): |