diff options
author | Guido van Rossum <guido@python.org> | 1993-05-10 15:45:49 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1993-05-10 15:45:49 (GMT) |
commit | c17c84fbe3a002c3aaae19a3d19c6ebf6f1311ca (patch) | |
tree | c629caf4395b5f61db78c3ffc81b122311579d4a /Demo | |
parent | 9f42f4fe432282f282d0d297baf359dbaee03118 (diff) | |
download | cpython-c17c84fbe3a002c3aaae19a3d19c6ebf6f1311ca.zip cpython-c17c84fbe3a002c3aaae19a3d19c6ebf6f1311ca.tar.gz cpython-c17c84fbe3a002c3aaae19a3d19c6ebf6f1311ca.tar.bz2 |
Disconnect from VCR when switching modes.
Wait for VCR ready and set VCR mode to DNR when initializing VCR.
Fix type error in getfloat().
Diffstat (limited to 'Demo')
-rwxr-xr-x | Demo/sgi/video/Vb.py | 7 | ||||
-rwxr-xr-x | Demo/sgi/video/Vrecb.py | 51 |
2 files changed, 52 insertions, 6 deletions
diff --git a/Demo/sgi/video/Vb.py b/Demo/sgi/video/Vb.py index da868f1..e6fecdf 100755 --- a/Demo/sgi/video/Vb.py +++ b/Demo/sgi/video/Vb.py @@ -228,6 +228,8 @@ class VideoBagOfTricks: self.rebindvideo() def cb_vmode(self, *args): + if self.vcr: + self.vcr = None self.vmode = self.c_vmode.get_choice() self.form.freeze_form() self.g_cont.hide_object() @@ -433,7 +435,10 @@ class VideoBagOfTricks: import VCR try: self.vcr = VCR.VCR().init() + self.vcr.wait() + self.vcr.fmmode('dnr') except VCR.error, msg: + self.vcr = None self.b_capture.set_button(0) fl.show_message('VCR error', str(msg), '') return @@ -615,7 +620,7 @@ class VideoBagOfTricks: value = float(eval(field.get_input())) except: value = float(default) - field.set_input(value) + field.set_input(`value`) return value # Audio stuff diff --git a/Demo/sgi/video/Vrecb.py b/Demo/sgi/video/Vrecb.py index ef7bc37..f726fe3 100755 --- a/Demo/sgi/video/Vrecb.py +++ b/Demo/sgi/video/Vrecb.py @@ -48,6 +48,7 @@ def usage(): print '-M value : monochrome tresholded with value' print '-f : Capture fields (instead of frames)' print '-n number : Capture this many frames (default 60)' + print '-N memsize : Capture frames fitting in this many kbytes' print 'moviefile : here goes the movie data (default film.video)' def help(): @@ -75,10 +76,11 @@ def main(): greybits = 0 monotreshold = -1 fields = 0 - number = 60 + number = 0 + memsize = 0 try: - opts, args = getopt.getopt(sys.argv[1:], 'ar:w:dg:mM:Gfn:') + opts, args = getopt.getopt(sys.argv[1:], 'ar:w:dg:mM:Gfn:N:') except getopt.error, msg: sys.stdout = sys.stderr print 'Error:', msg, '\n' @@ -117,11 +119,24 @@ def main(): fields = 1 elif opt == '-n': number = string.atoi(arg) + elif opt == '-N': + memsize = string.atoi(arg) + if 0 < memsize < 1024: + memsize = memsize * 1024 + if 0 < memsize < 1024*1024: + memsize = memsize * 1024 + print 'memsize', memsize except string.atoi_error: sys.stdout = sys.stderr print 'Option', opt, 'requires integer argument' sys.exit(2) + if number <> 0 and memsize <> 0: + sys.stderr.write('-n and -N are mutually exclusive\n') + sys.exit(2) + if number == 0 and memsize == 0: + number = 60 + if not fields: print '-f option assumed until somebody fixes it' fields = 1 @@ -180,7 +195,9 @@ def main(): gl.winconstraints() x, y = gl.getsize() print x, 'x', y - + if memsize: + number = calcnumber(x, y, grey or mono, memsize) + print number, 'frames' v.SetSize(x, y) if drop: @@ -215,6 +232,9 @@ def main(): # Window resize (or move) x, y = gl.getsize() print x, 'x', y + if memsize: + number = calcnumber(x, y, grey or mono, memsize) + print number, 'frames' v.SetSize(x, y) v.BindGLWindow(win, SV.IN_REPLACE) elif dev in (DEVICE.ESCKEY, DEVICE.WINQUIT, DEVICE.WINSHUT): @@ -224,6 +244,14 @@ def main(): break +def calcnumber(x, y, grey, memsize): + pixels = x*y + pixels = pixels/2 # XXX always assume fields + if grey: n = memsize/pixels + else: n = memsize/(4*pixels) + return max(1, n) + + # Record until the mouse is released (or any other GL event) # XXX audio not yet supported @@ -318,11 +346,22 @@ def record(v, info, filename, audiofilename, \ nskipped = 0 realframeno = 0 tpf = 1000 / 50.0 #XXXX + # Trying to find the pattern in frame skipping + okstretch = 0 + skipstretch = 0 for frameno in range(0, number*2): if frameno <> 0 and \ bitvec[frameno] == bitvec[frameno-1]: nskipped = nskipped + 1 + if okstretch: + print okstretch, 'ok', + okstretch = 0 + skipstretch = skipstretch + 1 continue + if skipstretch: + print skipstretch, 'skipped' + skipstretch = 0 + okstretch = okstretch + 1 # # Save field. # XXXX Works only for fields and top-to-bottom @@ -337,9 +376,11 @@ def record(v, info, filename, audiofilename, \ elif mono: field = imageop.dither2mono( \ field, len(field), 1) - vout.writeframe(int(realframeno*tpf), field, None) realframeno = realframeno + 1 - print 'Skipped',nskipped,'duplicate frames' + vout.writeframe(int(realframeno*tpf), field, None) + print okstretch, 'ok', + print skipstretch, 'skipped' + print 'Skipped', nskipped, 'duplicate frames' vout.close() gl.wintitle('(done) ' + filename) |