blob: b1f0a1657886916f342b2df1574b66228d9d4528 [file] [log] [blame]
Guido van Rossumdb96c5a1992-09-03 17:01:36 +00001import sv, SV
2import gl, GL, DEVICE
3
4def main():
5 format = SV.RGB8_FRAMES
6 requestedwidth = SV.PAL_XMAX
7 queuesize = 2
8
9 v = sv.OpenVideo()
10 svci = (format, requestedwidth, 0, queuesize, 0)
11
12 svci, buffer, bitvec = v.CaptureBurst(svci)
13 [bitvec]
14
15 w, h = svci[1:3]
16 framesize = w * h
17
18 gl.prefposition(300, 300+w-1, 100, 100+h-1)
19 gl.foreground()
20 win = gl.winopen('Burst Capture')
21 gl.RGBmode()
22 gl.gconfig()
23 gl.qdevice(DEVICE.LEFTMOUSE)
24 gl.qdevice(DEVICE.ESCKEY)
25
26 for i in range(svci[3]):
27 inverted_frame = sv.RGB8toRGB32(1, \
28 buffer[i*framesize:(i+1)*framesize], w, h)
29 gl.lrectwrite(0, 0, w-1, h-1, inverted_frame)
30 while 1:
31 dev, val = gl.qread()
32 if dev == DEVICE.LEFTMOUSE and val == 1:
33 break
34 if dev == DEVICE.REDRAW:
35 gl.lrectwrite(0, 0, w-1, h-1, inverted_frame)
36 if dev == DEVICE.ESCKEY:
37 v.CloseVideo()
38 gl.winclose(win)
39 return
40 v.CloseVideo()
41 gl.winclose(win)
42
43main()