@@ -12,10 +12,10 @@ def help():
1212 print '-M magnify : magnify the image by the given factor'
1313 print '-d : write some debug stuff on stderr'
1414 print '-l : loop, playing the movie over and over again'
15- print '-m delta : drop frames closer than delta msec (default 0)'
15+ print '-m delta : drop frames closer than delta seconds (default 0. )'
1616 print '-n : don\' t wait after each file'
1717 print '-q : quiet, no informative messages'
18- print '-r delta : regenerate input time base delta msec apart'
18+ print '-r delta : regenerate input time base delta seconds apart'
1919 print '-s speed : speed change factor (default 1.0)'
2020 print '-t : use a 2nd thread for read-ahead'
2121 print '-x left : window offset from left of screen'
@@ -81,10 +81,10 @@ def main():
8181 if opt == '-M' : magnify = float (eval (arg ))
8282 if opt == '-d' : debug = debug + 1
8383 if opt == '-l' : looping = 1
84- if opt == '-m' : mindelta = string . atoi ( arg )
84+ if opt == '-m' : mindelta = float ( eval ( arg ) )
8585 if opt == '-n' : nowait = 1
8686 if opt == '-q' : quiet = 1
87- if opt == '-r' : regen = string . atoi ( arg )
87+ if opt == '-r' : regen = float ( eval ( arg ) )
8888 if opt == '-s' :
8989 try :
9090 speed = float (eval (arg ))
@@ -238,7 +238,7 @@ def playonce(vin):
238238 thread .start_new_thread (read_ahead , (vin , queue , stop ))
239239 # Get the read-ahead thread going
240240 while queue .qsize () < MAXSIZE / 2 and not stop :
241- time .millisleep ( 100 )
241+ time .sleep ( 0. 100 )
242242
243243 tin = 0
244244 toffset = 0
@@ -250,7 +250,7 @@ def playonce(vin):
250250 nskipped = 0
251251 data = None
252252
253- tlast = t0 = time .millitimer ()
253+ tlast = t0 = time .time ()
254254
255255 while 1 :
256256 if gl .qtest ():
@@ -278,6 +278,7 @@ def playonce(vin):
278278 tin , size , csize = vin .getnextframeheader ()
279279 except EOFError :
280280 break
281+ tin = tin * 0.001
281282 nin = nin + 1
282283 if tin + toffset < oldtin :
283284 print 'Fix reversed time:' , oldtin , 'to' , tin
@@ -286,7 +287,7 @@ def playonce(vin):
286287 oldtin = tin
287288 if regen : tout = nin * regen
288289 else : tout = tin
289- tout = int ( tout / speed )
290+ tout = tout / speed
290291 if tout - told < mindelta :
291292 nskipped = nskipped + 1
292293 if not threading :
@@ -300,34 +301,34 @@ def playonce(vin):
300301 if not quiet :
301302 print '[incomplete last frame]'
302303 break
303- now = time .millitimer ()
304+ now = time .time ()
304305 dt = (tout - told ) - (now - tlast )
305306 told = tout
306- if debug : sys .stderr .write (`dt/10 ` + ' ' )
307+ if debug : sys .stderr .write (`round(dt, 3) ` + ' ' )
307308 if dt < 0 : nlate = nlate + 1
308309 if dt > 0 :
309- time .millisleep (dt )
310- now = now + dt
310+ time .sleep (dt )
311+ now = time . time ()
311312 tlast = now
312313 vin .showframe (data , cdata )
313314 nout = nout + 1
314315
315- t1 = time .millitimer ()
316+ t1 = time .time ()
316317
317318 if debug : sys .stderr .write ('\n ' )
318319
319320 if quiet : return 0
320321
321- print 'Recorded:' , nin , 'frames in' , tin * 0.001 , 'sec.' ,
322- if tin : print '-- average' , int (nin * 10000.0 / tin ) * 0.1 , 'frames/sec' ,
322+ print 'Recorded:' , nin , 'frames in' , round ( tin , 3 ) , 'sec.' ,
323+ if tin : print '-- average' , round (nin / tin , 1 ) , 'frames/sec' ,
323324 print
324325
325326 if nskipped : print 'Skipped' , nskipped , 'frames'
326327
327328 tout = t1 - t0
328329 print 'Played:' , nout ,
329- print 'frames in' , tout * 0.001 , 'sec.' ,
330- if tout : print '-- average' , int (nout * 10000.0 / tout ) * 0.1 , 'frames/sec' ,
330+ print 'frames in' , round ( tout , 3 ) , 'sec.' ,
331+ if tout : print '-- average' , round (nout / tout , 1 ) , 'frames/sec' ,
331332 print
332333
333334 if nlate : print 'There were' , nlate , 'late frames'
0 commit comments