def reshapewindow(self): oldwid = gl.winget() gl.winset(self.wid) gl.reshapeviewport() w, h = gl.getsize() self.disp.xorigin = (w-self.vw)/2 self.disp.yorigin = (h-self.vh)/2 self.disp.clear() gl.winset(oldwid)
def putnextpacket(self, pos, data): nline = len(data)/self.linewidth() if nline*self.linewidth() <> len(data): print 'Incorrect-sized video fragment ignored' return oldwid = gl.winget() gl.winset(self.wid) self.disp.showpartframe(data, None, (0, pos, self.vw, nline)) gl.winset(oldwid)
def __init__(self, wid, vw, vh, type): ##print 'Init', wid, xywh ##print 'video', vw, vw self.vw = vw self.vh = vh self.disp = Displayer() if not type in ('rgb', 'rgb8', 'grey', 'mono', 'grey2', \ 'grey4'): raise 'Incorrent live video output type', type if type == 'rgb': info = (type, vw, vh, 0, 32, 0, 0, 0, 0) else: info = (type, vw, vh, 1, 8, 0, 0, 0, 0) self.disp.setinfo(info) self.wid = wid oldwid = gl.winget() gl.winset(wid) self.disp.initcolormap() self.reshapewindow() gl.winset(oldwid)
# Live video output (display video on the screen, presumably from the net)
# Live video output (display video on the screen, presumably from the net)