def makewindow(self): x, y = self.maxx, self.maxy gl.foreground() gl.maxsize(x, y) gl.keepaspect(x, y) gl.stepunit(8, 6) width = self.curx height = self.cury if width and height: # Place the window at (150, 150) from top left # (the video board likes this location...) x1 = 150 x2 = x1+width-1 SCRHEIGHT = 768 y2 = SCRHEIGHT-1-150 y1 = y2-height+1 gl.prefposition(x1, x2, y1, y2) self.window = gl.winopen('Vb video') self.settitle() if width: gl.maxsize(x, y) gl.keepaspect(x, y) gl.stepunit(8, 6) gl.winconstraints() gl.qdevice(DEVICE.LEFTMOUSE) gl.qdevice(DEVICE.WINQUIT) gl.qdevice(DEVICE.WINSHUT)
def open(title): h, v = G.def_pos width, height = G.def_size if h > 0 or v > 0: # Choose arbitrary defaults if h < 0: h = 10 if v < 0: v = 30 if width <= 0: width = 400 if height <= 0: height = 300 gl.prefposition(h, h + width, 1024 - v, 1024 - v - height) elif width > 0 or height > 0: if width <= 0: width = 400 if height <= 0: height = 300 gl.prefsize(width, height) from glstdwwin import WindowObject win = WindowObject()._init(title) G.windowmap[` win._gid `] = win return win
def showform(self): # Get position of video window gl.winset(self.window) x, y = gl.getorigin() width, height = gl.getsize() # Calculate position of form window x1 = x + width + 10 x2 = x1 + int(self.form.w) - 1 y2 = y + height - 1 y1 = y2 - int(self.form.h) + 1 # Position and show form window gl.prefposition(x1, x2, y1, y2) self.form.show_form(FL.PLACE_FREE, FL.TRUE, 'Vb Control')
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)
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)
def main(): gl.foreground() gl.prefposition(500, 900, 500, 900) w = gl.winopen('CrissCross') gl.ortho2(0.0, 400.0, 0.0, 400.0) gl.color(GL.WHITE) gl.clear() gl.color(GL.RED) gl.bgnline() gl.v2f(0.0, 0.0) gl.v2f(400.0, 400.0) gl.endline() gl.bgnline() gl.v2f(400.0, 0.0) gl.v2f(0.0, 400.0) gl.endline() time.sleep(5)
def open(title): h, v = G.def_pos width, height = G.def_size if h > 0 or v > 0: # Choose arbitrary defaults if h < 0: h = 10 if v < 0: v = 30 if width <= 0: width = 400 if height <= 0: height = 300 gl.prefposition(h, h + width, 1024 - v, 1024 - v - height) elif width > 0 or height > 0: if width <= 0: width = 400 if height <= 0: height = 300 gl.prefsize(width, height) from glstdwwin import WindowObject win = WindowObject()._init(title) G.windowmap[ ` win._gid `] = win return win
def optfullsizewindow(self): if not self.window: return gl.winset(self.window) if self.use_24: x, y = self.maxx, self.maxy else: x, y = self.curx, self.cury left, bottom = gl.getorigin() width, height = gl.getsize() bottom = bottom+height-y gl.prefposition(left, left+x-1, bottom, bottom+y-1) gl.winconstraints() if not self.use_24: gl.keepaspect(x, y) gl.stepunit(8, 6) gl.maxsize(self.maxx, self.maxy) gl.winconstraints() self.bindvideo()
import sys
#! /usr/bin/env python
def main(): # insure that we at least have an X display before continuing. import os try: display = os.environ['DISPLAY'] except: # Raise ImportError because regrtest.py handles it specially. raise ImportError, "No $DISPLAY -- skipping gl test" # touch all the attributes of gl without doing anything if verbose: print 'Touching gl module attributes...' for attr in glattrs: if verbose: print 'touching: ', attr getattr(gl, attr) # create a small 'Crisscross' window if verbose: print 'Creating a small "CrissCross" window...' print 'foreground' gl.foreground() if verbose: print 'prefposition' gl.prefposition(500, 900, 500, 900) if verbose: print 'winopen "CrissCross"' w = gl.winopen('CrissCross') if verbose: print 'clear' gl.clear() if verbose: print 'ortho2' gl.ortho2(0.0, 400.0, 0.0, 400.0) if verbose: print 'color WHITE' gl.color(GL.WHITE) if verbose: print 'color RED' gl.color(GL.RED) if verbose: print 'bgnline' gl.bgnline() if verbose: print 'v2f' gl.v2f(0.0, 0.0) gl.v2f(400.0, 400.0) if verbose: print 'endline' gl.endline() if verbose: print 'bgnline' gl.bgnline() if verbose: print 'v2i' gl.v2i(400, 0) gl.v2i(0, 400) if verbose: print 'endline' gl.endline() if verbose: print 'Displaying window for 2 seconds...' time.sleep(2) if verbose: print 'winclose' gl.winclose(w)
y = SV.NTSC_YMAX else: print 'Unknown video standard', param[1] sys.exit(1) gl.foreground() gl.maxsize(x, y) gl.keepaspect(x, y) gl.stepunit(8, 6) if width: height = width * 3 / 4 x1 = 150 x2 = x1 + width - 1 y2 = 768 - 150 y1 = y2 - height + 1 gl.prefposition(x1, x2, y1, y2) win = gl.winopen(filename) if width: gl.maxsize(x, y) gl.keepaspect(x, y) gl.stepunit(8, 6) 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: param = [SV.FIELDDROP, 1, SV.GENLOCK, SV.GENLOCK_OFF]
#! /usr/bin/env python # Capture a CMIF movie using the Indigo video library and board in burst mode # User interface: # # Start the application. Resize the window to the desired movie size. # Press the left mouse button to start recording, release it to end # recording. You can record as many times as you wish, but each time # you overwrite the output file(s), so only the last recording is # kept. # # Press ESC or select the window manager Quit or Close window option # to quit. If you quit before recording anything, the output file(s) # are not touched. import sys sys.path.append('/ufs/guido/src/video') import sv, SV import VFile import gl, GL, DEVICE import al, AL import time import posix import getopt import string import imageop import sgi # Usage and help functions (keep this up-to-date if you change the program!) def usage(): print 'Usage: Vrecb [options] [moviefile [audiofile]]' print
#! /usr/bin/env python #! /ufs/guido/bin/sgi/python-405 # Capture a CMIF movie using the Indigo video library and board # The CMIF video file format is documented in cmif-film.ms. # Audio data is recorded in AIFF format, using the input sampling # rate, source and volume set by the audio panel, in mono, 8 # bits/sample. # Usage and help functions (keep this up-to-date if you change the program!) def usage(): print 'Usage: Vrec [options] [moviefile [audiofile]]' print print 'Options:' print '-a : record audio as well' print '-q queuesize : set the capture queue size (default 2)' print '-r rate : capture 1 out of every "rate" frames', \ '(default and min 2)' print '-w width : initial window width', \ '(default 256, use 0 for interactive placement)' print '-n : Don\'t write to file, only timing info' print '-d : drop fields if needed' print '-g bits : greyscale (2, 4 or 8 bits)' print '-G : 2-bit greyscale dithered' print '-m : monochrome dithered' print '-M value : monochrome thresholded with value' print '-f : Capture fields (in stead of frames)' print '-P frames : preallocate space for "frames" frames' print 'moviefile : here goes the movie data (default film.video)' print 'audiofile : with -a, here goes the audio data', \ '(default film.aiff)'
#! /usr/bin/env python # Capture a CMIF movie using the Indigo video library and board in burst mode # User interface: # # Start the application. Resize the window to the desired movie size. # Press the left mouse button to start recording, release it to end # recording. You can record as many times as you wish, but each time # you overwrite the output file(s), so only the last recording is # kept. # # Press ESC or select the window manager Quit or Close window option # to quit. If you quit before recording anything, the output file(s) # are not touched. import sys sys.path.append('/ufs/guido/src/video') import sv, SV import VFile import gl, GL, DEVICE import al, AL import time import posix import getopt import string import imageop import sgi # Usage and help functions (keep this up-to-date if you change the program!) def usage():
if not quiet: vin.printinfo() gl.foreground() width, height = int(vin.width * magnify), int(vin.height * magnify) xborder = yborder = 0 if xwsiz: vin.xorigin = (xwsiz - width)/2 width = xwsiz if ywsiz: vin.yorigin = (ywsiz - height)/2 height = ywsiz if xoff <> None and yoff <> None: scrheight = gl.getgdesc(GL.GD_YPMAX) gl.prefposition(xoff, xoff+width-1, \ scrheight-yoff-height, scrheight-yoff-1) else: gl.prefsize(width, height) win = gl.winopen(filename) gl.clear() if quiet: vin.quiet = 1 vin.initcolormap() if bgcolor: r, g, b = bgcolor vin.clearto(r,g,b) gl.qdevice(ESCKEY) gl.qdevice(WINSHUT)
#! /usr/bin/env python # Play CMIF movie files # Help function def help(): print 'Usage: Vplay [options] [file] ...' print print 'Options:' print '-M magnify : magnify the image by the given factor' print '-d : write some debug stuff on stderr' print '-l : loop, playing the movie over and over again' print '-m delta : drop frames closer than delta seconds (default 0.)' print '-n : don\'t wait after each file' print '-q : quiet, no informative messages' print '-r delta : regenerate input time base delta seconds apart' print '-s speed : speed change factor (default 1.0)' print '-t : use a 2nd thread for read-ahead' print '-x left : window offset from left of screen' print '-y top : window offset from top of screen' print '-w width : window width' print '-h height : window height' print '-b color : background color (white,black or (r,g,b))' print 'file ... : file(s) to play; default film.video' print print 'User interface:' print 'Press the left mouse button to stop or restart the movie.' print 'Press ESC or use the window manager Close or Quit command' print 'to close the window and play the next file (if any).' # Imported modules
y = SV.NTSC_YMAX else: print 'Unknown video standard', param[1] sys.exit(1) gl.foreground() gl.maxsize(x, y) gl.keepaspect(x, y) gl.stepunit(8, 6) if width: height = width*3/4 x1 = 150 x2 = x1 + width-1 y2 = 768-150 y1 = y2-height+1 gl.prefposition(x1, x2, y1, y2) win = gl.winopen(filename) if width: gl.maxsize(x, y) gl.keepaspect(x, y) gl.stepunit(8, 6) gl.winconstraints() x, y = gl.getsize() print x, 'x', y v.SetSize(x, y) if drop: param = [SV.FIELDDROP, 1, SV.GENLOCK, SV.GENLOCK_OFF] else: param = [SV.FIELDDROP, 0, SV.GENLOCK, SV.GENLOCK_ON]
def main(): # insure that we at least have an X display before continuing. import os try: display = os.environ["DISPLAY"] except: raise TestSkipped, "No $DISPLAY -- skipping gl test" # touch all the attributes of gl without doing anything if verbose: print "Touching gl module attributes..." for attr in glattrs: if verbose: print "touching: ", attr getattr(gl, attr) # create a small 'Crisscross' window if verbose: print 'Creating a small "CrissCross" window...' print "foreground" gl.foreground() if verbose: print "prefposition" gl.prefposition(500, 900, 500, 900) if verbose: print 'winopen "CrissCross"' w = gl.winopen("CrissCross") if verbose: print "clear" gl.clear() if verbose: print "ortho2" gl.ortho2(0.0, 400.0, 0.0, 400.0) if verbose: print "color WHITE" gl.color(GL.WHITE) if verbose: print "color RED" gl.color(GL.RED) if verbose: print "bgnline" gl.bgnline() if verbose: print "v2f" gl.v2f(0.0, 0.0) gl.v2f(400.0, 400.0) if verbose: print "endline" gl.endline() if verbose: print "bgnline" gl.bgnline() if verbose: print "v2i" gl.v2i(400, 0) gl.v2i(0, 400) if verbose: print "endline" gl.endline() if verbose: print "Displaying window for 2 seconds..." time.sleep(2) if verbose: print "winclose" gl.winclose(w)