Staging
v0.5.1
v0.5.1
https://github.com/python/cpython
Revision afd0aa680a5233fd70cf7bf71de6e1db3b087562 authored by Jack Jansen on 29 January 2001, 13:29:47 UTC, committed by Jack Jansen on 29 January 2001, 13:29:47 UTC
1 parent 5a8115c
Tip revision: afd0aa680a5233fd70cf7bf71de6e1db3b087562 authored by Jack Jansen on 29 January 2001, 13:29:47 UTC
Replace {Enable,Disable,Check}Item with their carbon-compatible equivalents {Enable,Disable,Check}MenuItem.
Replace {Enable,Disable,Check}Item with their carbon-compatible equivalents {Enable,Disable,Check}MenuItem.
Tip revision: afd0aa6
burstcapt.py
import sys
import sv, SV
import gl, GL, DEVICE
def main():
format = SV.RGB8_FRAMES
requestedwidth = SV.PAL_XMAX
queuesize = 30
if sys.argv[1:]:
queuesize = eval(sys.argv[1])
v = sv.OpenVideo()
svci = (format, requestedwidth, 0, queuesize, 0)
go = raw_input('Press return to capture ' + `queuesize` + ' frames: ')
result = v.CaptureBurst(svci)
svci, buffer, bitvec = result
## svci, buffer = result # XXX If bit vector not yet implemented
print 'Captured', svci[3], 'frames, i.e.', len(buffer)/1024, 'K bytes'
w, h = svci[1:3]
framesize = w * h
gl.prefposition(300, 300+w-1, 100, 100+h-1)
gl.foreground()
win = gl.winopen('Burst Capture')
gl.RGBmode()
gl.gconfig()
gl.qdevice(DEVICE.LEFTMOUSE)
gl.qdevice(DEVICE.ESCKEY)
print 'Click left mouse for next frame'
for i in range(svci[3]):
inverted_frame = sv.RGB8toRGB32(1, \
buffer[i*framesize:(i+1)*framesize], w, h)
gl.lrectwrite(0, 0, w-1, h-1, inverted_frame)
while 1:
dev, val = gl.qread()
if dev == DEVICE.LEFTMOUSE and val == 1:
break
if dev == DEVICE.REDRAW:
gl.lrectwrite(0, 0, w-1, h-1, inverted_frame)
if dev == DEVICE.ESCKEY:
v.CloseVideo()
gl.winclose(win)
return
v.CloseVideo()
gl.winclose(win)
main()
Computing file changes ...