diff options
author | Guido van Rossum <guido@python.org> | 1992-09-22 15:01:43 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1992-09-22 15:01:43 (GMT) |
commit | 42e07afe3dba2a62d54ca82778b315e53b3508ef (patch) | |
tree | 1a75752485c8c6d714c3646638e298bbfa27d2de | |
parent | 66122d2dae055a333d8c755b2a154a5299f078e5 (diff) | |
download | cpython-42e07afe3dba2a62d54ca82778b315e53b3508ef.zip cpython-42e07afe3dba2a62d54ca82778b315e53b3508ef.tar.gz cpython-42e07afe3dba2a62d54ca82778b315e53b3508ef.tar.bz2 |
Vrec.py: sv now raises sv.error instead of RuntimeError.
VFile.py: support for showing partial frames.
-rwxr-xr-x | Demo/sgi/video/VFile.py | 22 | ||||
-rwxr-xr-x | Demo/sgi/video/Vrec.py | 2 |
2 files changed, 16 insertions, 8 deletions
diff --git a/Demo/sgi/video/VFile.py b/Demo/sgi/video/VFile.py index 1516464..b65f287 100755 --- a/Demo/sgi/video/VFile.py +++ b/Demo/sgi/video/VFile.py @@ -273,7 +273,7 @@ class Displayer(VideoParams): # setinfo() must reset some internal flags def setinfo(self, values): - VideoParams.setinfo(values) + VideoParams.setinfo(self, values) self.colormapinited = 0 self.skipchrom = 0 self.color0 = None @@ -282,33 +282,41 @@ class Displayer(VideoParams): # Show one frame, initializing the window if necessary def showframe(self, data, chromdata): + self.showpartframe(data, chromdata, \ + (0,0,self.width,self.height)) + + def showpartframe(self, data, chromdata, (x,y,w,h)): if not self.colormapinited: self.initcolormap() if self.fixcolor0: gl.mapcolor(self.color0) self.fixcolor0 = 0 - w, h, pf = self.width, self.height, self.packfactor + pf = self.packfactor factor = self.magnify if pf: factor = factor * pf if chromdata and not self.skipchrom: cp = self.chrompack + cx = int(x*factor*cp) + self.xorigin + cy = int(y*factor*cp) + self.yorigin cw = (w+cp-1)/cp ch = (h+cp-1)/cp gl.rectzoom(factor*cp, factor*cp) gl.pixmode(GL.PM_SIZE, 16) gl.writemask(self.mask - ((1 << self.c0bits) - 1)) - gl.lrectwrite(self.xorigin, self.yorigin, \ - self.xorigin + cw - 1, self.yorigin + ch - 1, \ - chromdata) + gl.lrectwrite(cx, cy, cx + cw - 1, cy + ch - 1, \ + chromdata) # if pf: gl.writemask((1 << self.c0bits) - 1) gl.pixmode(GL.PM_SIZE, 8) w = w/pf h = h/pf + x = x/pf + y = y/pf gl.rectzoom(factor, factor) - gl.lrectwrite(self.xorigin, self.yorigin, \ - self.xorigin + w - 1, self.yorigin + h - 1, data) + x = int(x*factor)+self.xorigin + y = int(y*factor)+self.yorigin + gl.lrectwrite(x, y, x + w - 1, y + h - 1, data) gl.gflush() # Initialize the window: set RGB or colormap mode as required, diff --git a/Demo/sgi/video/Vrec.py b/Demo/sgi/video/Vrec.py index 5f6cf6e..867c404 100755 --- a/Demo/sgi/video/Vrec.py +++ b/Demo/sgi/video/Vrec.py @@ -183,7 +183,7 @@ def record(v, info, filename, audiofilename): while not gl.qtest(): try: cd, id = v.GetCaptureData() - except RuntimeError: + except sv.error: time.millisleep(10) # XXX is this necessary? continue id = id + 2*rate |