diff options
author | Guido van Rossum <guido@python.org> | 1993-12-17 15:11:41 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1993-12-17 15:11:41 (GMT) |
commit | 21a3ff9d5d9d8cad0bc52cb603df93d38e139840 (patch) | |
tree | 533c4f8e2a23ecaa6099c868035b1463881ff1a7 | |
parent | 96b608cf6ddb4c7b670c15a365ed8b14accd5d37 (diff) | |
download | cpython-21a3ff9d5d9d8cad0bc52cb603df93d38e139840.zip cpython-21a3ff9d5d9d8cad0bc52cb603df93d38e139840.tar.gz cpython-21a3ff9d5d9d8cad0bc52cb603df93d38e139840.tar.bz2 |
Uniformly replaced init() functions by __init__() constructors.
A few simple things seem to work, I haven't tested it thouroughly
though...
-rwxr-xr-x | Demo/sgi/video/DisplayVideoIn.py | 5 | ||||
-rwxr-xr-x | Demo/sgi/video/Dsend.py | 5 | ||||
-rwxr-xr-x | Demo/sgi/video/LiveVideoIn.py | 7 | ||||
-rwxr-xr-x | Demo/sgi/video/LiveVideoOut.py | 7 | ||||
-rwxr-xr-x | Demo/sgi/video/OldVcopy.py | 4 | ||||
-rwxr-xr-x | Demo/sgi/video/VCR.py | 3 | ||||
-rwxr-xr-x | Demo/sgi/video/VFile.py | 46 | ||||
-rwxr-xr-x | Demo/sgi/video/VGrabber.py | 2 | ||||
-rwxr-xr-x | Demo/sgi/video/Vb.py | 9 | ||||
-rwxr-xr-x | Demo/sgi/video/Vcopy.py | 4 | ||||
-rwxr-xr-x | Demo/sgi/video/VcrIndex.py | 11 | ||||
-rwxr-xr-x | Demo/sgi/video/Vedit.py | 9 | ||||
-rwxr-xr-x | Demo/sgi/video/Vfix.py | 4 | ||||
-rwxr-xr-x | Demo/sgi/video/Viewer.py | 16 | ||||
-rwxr-xr-x | Demo/sgi/video/Vinfo.py | 2 | ||||
-rwxr-xr-x | Demo/sgi/video/Vmkjpeg.py | 4 | ||||
-rwxr-xr-x | Demo/sgi/video/Vplay.py | 4 | ||||
-rwxr-xr-x | Demo/sgi/video/Vrec.py | 8 | ||||
-rwxr-xr-x | Demo/sgi/video/Vrecb.py | 6 | ||||
-rwxr-xr-x | Demo/sgi/video/Vreceive.py | 2 | ||||
-rwxr-xr-x | Demo/sgi/video/Vsend.py | 4 | ||||
-rwxr-xr-x | Demo/sgi/video/Vtime.py | 4 | ||||
-rwxr-xr-x | Demo/sgi/video/Vunjpeg.py | 4 | ||||
-rwxr-xr-x | Demo/sgi/video/aplay.py | 2 | ||||
-rwxr-xr-x | Demo/sgi/video/imgconv.py | 5 | ||||
-rwxr-xr-x | Demo/sgi/video/rgb2video.py | 2 | ||||
-rwxr-xr-x | Demo/sgi/video/video2rgb.py | 2 |
27 files changed, 86 insertions, 95 deletions
diff --git a/Demo/sgi/video/DisplayVideoIn.py b/Demo/sgi/video/DisplayVideoIn.py index 427d30a..6dbc7bc 100755 --- a/Demo/sgi/video/DisplayVideoIn.py +++ b/Demo/sgi/video/DisplayVideoIn.py @@ -11,7 +11,7 @@ class DisplayVideoIn: # Initialize an instance. Arguments: # vw, vh: size of the video window data to be captured. # position defaults to 0, 0 but can be set later - def init(self, pktmax, vw, vh, type): + def __init__(self, pktmax, vw, vh, type): self.pktmax = pktmax self.realwidth, self.realheight = vw, vh if type <> 'rgb': @@ -40,7 +40,6 @@ class DisplayVideoIn: self.dataoffset = 0 self.lpos = 0 self.hints = 0 - return self # Change the size of the video being displayed. @@ -72,7 +71,7 @@ class DisplayVideoIn: # - data is a piece of data # The dimensions of data are: # - pixel depth = 1 byte - # - scan line width = self.width (the vw argument to init()) + # - scan line width = self.width (the vw argument to __init__()) # - number of scan lines = self.lpp (PKTMAX / vw) def getnextpacket(self): diff --git a/Demo/sgi/video/Dsend.py b/Demo/sgi/video/Dsend.py index 3213caa..c4ed842 100755 --- a/Demo/sgi/video/Dsend.py +++ b/Demo/sgi/video/Dsend.py @@ -119,10 +119,9 @@ def main(): gl.qdevice(DEVICE.WINTHAW) width, height = gl.getsize() - lvo = LiveVideoOut.LiveVideoOut().init(wid, width, height, vtype) + lvo = LiveVideoOut.LiveVideoOut(wid, width, height, vtype) - lvi = DisplayVideoIn.DisplayVideoIn().init(pktmax, \ - width, height, vtype) + lvi = DisplayVideoIn.DisplayVideoIn(pktmax, width, height, vtype) if xpos or ypos: lvi.positionvideo(xpos, ypos) diff --git a/Demo/sgi/video/LiveVideoIn.py b/Demo/sgi/video/LiveVideoIn.py index 4e000b1..661ea73 100755 --- a/Demo/sgi/video/LiveVideoIn.py +++ b/Demo/sgi/video/LiveVideoIn.py @@ -33,7 +33,7 @@ class LiveVideoIn: # Note that the data has to be cropped unless vw and vh are # just right for the video board (vw:vh == 4:3 and vh even). - def init(self, pktmax, vw, vh, type): + def __init__(self, pktmax, vw, vh, type): if not have_video: raise RuntimeError, 'no video available' if vw % 4 != 0: @@ -72,13 +72,12 @@ class LiveVideoIn: ## if not self.justright: ## print 'Want:', self.width, 'x', self.height, ## print '; grab:', self.realwidth, 'x', self.realheight - return self # Change the size of the video being displayed. def resizevideo(self, vw, vh): self.close() - self = self.init(self.pktmax, vw, vh, self.type) + self.__init__(self.pktmax, vw, vh, self.type) # Remove an instance. # This turns off continuous capture. @@ -103,7 +102,7 @@ class LiveVideoIn: # - data is a piece of data # The dimensions of data are: # - pixel depth = 1 byte - # - scan line width = self.width (the vw argument to init()) + # - scan line width = self.width (the vw argument to __init__()) # - number of scan lines = self.lpp (PKTMAX / vw) def getnextpacket(self): diff --git a/Demo/sgi/video/LiveVideoOut.py b/Demo/sgi/video/LiveVideoOut.py index 72e3d58..6ee1846 100755 --- a/Demo/sgi/video/LiveVideoOut.py +++ b/Demo/sgi/video/LiveVideoOut.py @@ -12,12 +12,12 @@ class LiveVideoOut: # wid: the window id where the video is to be displayed (centered) # vw, vh: size of the video image to be displayed - def init(self, wid, vw, vh, type): + def __init__(self, wid, vw, vh, type): ##print 'Init', wid, xywh ##print 'video', vw, vw self.vw = vw self.vh = vh - self.disp = Displayer().init() + self.disp = Displayer() if not type in ('rgb', 'rgb8', 'grey', 'mono', 'grey2', \ 'grey4'): raise 'Incorrent live video output type', type @@ -32,7 +32,6 @@ class LiveVideoOut: self.disp.initcolormap() self.reshapewindow() gl.winset(oldwid) - return self # Call this in response to every REDRAW event for the window # or if the window size has changed for other reasons. @@ -111,7 +110,7 @@ class LiveVideoOut: class LiveVideoOutSlow(LiveVideoOut): # Reshapewindow - Realloc buffer. - # (is also called by init() indirectly) + # (is also called by __init__() indirectly) def reshapewindow(self): LiveVideoOut.reshapewindow(self) diff --git a/Demo/sgi/video/OldVcopy.py b/Demo/sgi/video/OldVcopy.py index 63bbf71..61461f4 100755 --- a/Demo/sgi/video/OldVcopy.py +++ b/Demo/sgi/video/OldVcopy.py @@ -41,9 +41,9 @@ def main(): usage() [ifile, ofile] = args print 'open film ', ifile - ifilm = VFile.VinFile().init(ifile) + ifilm = VFile.VinFile(ifile) print 'open output ', ofile - ofilm = GrabbingVoutFile().init(ofile) + ofilm = GrabbingVoutFile(ofile) ofilm.setinfo(ifilm.getinfo()) diff --git a/Demo/sgi/video/VCR.py b/Demo/sgi/video/VCR.py index 8fa87b0..0e2edc6 100755 --- a/Demo/sgi/video/VCR.py +++ b/Demo/sgi/video/VCR.py @@ -142,13 +142,12 @@ MUTE_AV_OFF = EXP_7 + '\xc7' DEBUG=0 class VCR: - def init(self): + def __init__(self): self.ifp, self.ofp = initline(DEVICE) self.busy_cmd = None self.async = 0 self.cb = None self.cb_arg = None - return self def _check(self): if self.busy_cmd: diff --git a/Demo/sgi/video/VFile.py b/Demo/sgi/video/VFile.py index d0eab0d..3cb7506 100755 --- a/Demo/sgi/video/VFile.py +++ b/Demo/sgi/video/VFile.py @@ -186,7 +186,7 @@ class VideoParams: # Set all parameters to something decent # (except width and height are set to zero) - def init(self): + def __init__(self): # Essential parameters self.frozen = 0 # if set, can't change parameters self.format = 'grey' # color system used @@ -203,7 +203,6 @@ class VideoParams: self.chrompack = 0 # set if separate chrominance data self.setderived() self.decompressor = None - return self # Freeze the parameters (disallow changes) @@ -369,11 +368,11 @@ class Displayer(VideoParams): # Initialize an instance. # This does not need a current window - def init(self): + def __init__(self): if no_gl: raise RuntimeError, \ 'no gl module available, so cannot display' - self = VideoParams.init(self) + VideoParams.__init__(self) # User-settable parameters self.magnify = 1.0 # frame magnification factor self.xorigin = 0 # x frame offset @@ -817,15 +816,18 @@ def writecompressfileheader(fp, cheader, values): class BasicVinFile(VideoParams): - def init(self, filename): - if filename == '-': + def __init__(self, filename): + if type(filename) != type(''): + fp = filename + filename = '???' + elif filename == '-': fp = sys.stdin else: fp = open(filename, 'r') - return self.initfp(fp, filename) + self.initfp(fp, filename) def initfp(self, fp, filename): - self = VideoParams.init(self) + VideoParams.__init__(self) self.fp = fp self.filename = filename self.version, values = readfileheader(fp, filename) @@ -857,7 +859,6 @@ class BasicVinFile(VideoParams): except IOError: self.startpos = -1 self.canseek = 0 - return self def _readv0frameheader(self, fp): t, ds, cs = readv0frameheader(fp) @@ -966,9 +967,8 @@ def getfilesize(filename): class RandomVinFile(BasicVinFile): def initfp(self, fp, filename): - self = BasicVinFile.initfp(self, fp, filename) + BasicVinFile.initfp(self, fp, filename) self.index = [] - return self def warmcache(self): if len(self.index) == 0: @@ -1073,19 +1073,21 @@ class RandomVinFile(BasicVinFile): class BasicVoutFile(VideoParams): - def init(self, filename): - if filename == '-': + def __init__(self, filename): + if type(filename) != type(''): + fp = filename + filename = '???' + elif filename == '-': fp = sys.stdout else: fp = open(filename, 'w') - return self.initfp(fp, filename) + self.initfp(fp, filename) def initfp(self, fp, filename): - self = VideoParams.init(self) + VideoParams.__init__(self) self.fp = fp self.filename = filename self.version = 3.1 # In case anyone inquries - return self def flush(self): self.fp.flush() @@ -1153,8 +1155,8 @@ class BasicVoutFile(VideoParams): class VinFile(RandomVinFile, Displayer): def initfp(self, fp, filename): - self = Displayer.init(self) - return RandomVinFile.initfp(self, fp, filename) + Displayer.__init__(self) + RandomVinFile.initfp(self, fp, filename) def shownextframe(self): t, data, cdata = self.getnextframe() @@ -1165,9 +1167,9 @@ class VinFile(RandomVinFile, Displayer): class VoutFile(BasicVoutFile, Displayer): def initfp(self, fp, filename): - self = Displayer.init(self) -## self = Grabber.init(self) # XXX not needed - return BasicVoutFile.initfp(self, fp, filename) + Displayer.__init__(self) +## Grabber.__init__(self) # XXX not needed + BasicVoutFile.initfp(self, fp, filename) # Simple test program (VinFile only) @@ -1176,7 +1178,7 @@ def test(): import time if sys.argv[1:]: filename = sys.argv[1] else: filename = 'film.video' - vin = VinFile().init(filename) + vin = VinFile(filename) vin.printinfo() gl.foreground() gl.prefsize(vin.getsize()) diff --git a/Demo/sgi/video/VGrabber.py b/Demo/sgi/video/VGrabber.py index 3c8693c..242ebf2 100755 --- a/Demo/sgi/video/VGrabber.py +++ b/Demo/sgi/video/VGrabber.py @@ -10,7 +10,7 @@ from VFile import Error class VGrabber(VFile.VideoParams): - # XXX The init() method of VideoParams is just fine, for now + # XXX The constructor of VideoParams is just fine, for now # Grab a frame. # Return (data, chromdata) just like getnextframe(). diff --git a/Demo/sgi/video/Vb.py b/Demo/sgi/video/Vb.py index 2596ca5..093bcf7 100755 --- a/Demo/sgi/video/Vb.py +++ b/Demo/sgi/video/Vb.py @@ -43,7 +43,7 @@ watchcursor.defwatch(WATCH) def main(): ## fl.set_graphics_mode(0, 1) - vb = VideoBagOfTricks().init() + vb = VideoBagOfTricks() while 1: dummy = fl.do_forms() [dummy] @@ -82,7 +82,7 @@ class VideoBagOfTricks: # Init/close stuff - def init(self): + def __init__(self): self.window = None formdef = flp.parse_form('VbForm', 'form') flp.create_full_form(self, formdef) @@ -105,7 +105,6 @@ class VideoBagOfTricks: self.optfullsizewindow() self.showform() fl.set_event_call_back(self.do_event) - return self def close(self): self.close_video() @@ -610,7 +609,7 @@ class VideoBagOfTricks: if not self.vcr: try: print 'Connecting to VCR ...' - self.vcr = VCR.VCR().init() + self.vcr = VCR.VCR() print 'Waiting for VCR to come online ...' self.vcr.initvcr() print 'Preparing VCR ...' @@ -804,7 +803,7 @@ class VideoBagOfTricks: x, y = x/2, y/2 elif self.rgb24_size == 3: x, y = x/4, y/4 - vout = VFile.VoutFile().init(self.vfile) + vout = VFile.VoutFile(self.vfile) vout.setformat(self.vformat) if self.vformat == 'compress': cheader = self.init_compressor(x, y) diff --git a/Demo/sgi/video/Vcopy.py b/Demo/sgi/video/Vcopy.py index ef26f55..59c06a0 100755 --- a/Demo/sgi/video/Vcopy.py +++ b/Demo/sgi/video/Vcopy.py @@ -149,7 +149,7 @@ def process(infilename, outfilename): global newwidth, newheight, newpf try: - vin = VFile.BasicVinFile().init(infilename) + vin = VFile.BasicVinFile(infilename) except IOError, msg: sys.stderr.write(infilename + ': I/O error: ' + `msg` + '\n') return 1 @@ -161,7 +161,7 @@ def process(infilename, outfilename): return 1 try: - vout = VFile.BasicVoutFile().init(outfilename) + vout = VFile.BasicVoutFile(outfilename) except IOError, msg: sys.stderr.write(outfilename + ': I/O error: ' + `msg` + '\n') return 1 diff --git a/Demo/sgi/video/VcrIndex.py b/Demo/sgi/video/VcrIndex.py index d73342b..80212ee 100755 --- a/Demo/sgi/video/VcrIndex.py +++ b/Demo/sgi/video/VcrIndex.py @@ -9,7 +9,7 @@ VERSION_STRING='#!VcrIndex 1.1\n' PREV_VERSION_STRING='#!VcrIndex 1.0\n' class VcrIndex: - def init(self, name): + def __init__(self, name): self.curmovie = None self.curscene = None self.modified = 0 @@ -18,12 +18,12 @@ class VcrIndex: self.editable = [] if not name: self.movies = {} - return self + return try: fp = open(name, 'r') except IOError: self.movies = {} - return self + return header = fp.readline() if header == PREV_VERSION_STRING: print 'Converting old-format database...' @@ -41,14 +41,13 @@ class VcrIndex: self.movies[m] = newd print 'Done.' - return self + return if header <> VERSION_STRING: print 'VcrIndex: incorrect version string:', header self.movies = {} - return self + return data = fp.read(100000) self.movies = eval(data) - return self # # Save database to given file (or same file as read from if no # filename given). diff --git a/Demo/sgi/video/Vedit.py b/Demo/sgi/video/Vedit.py index 43a67c8..228cabc 100755 --- a/Demo/sgi/video/Vedit.py +++ b/Demo/sgi/video/Vedit.py @@ -32,7 +32,7 @@ def main(): for o, a in opts: if o == '-q': qsize = string.atoi(a) - ed = Editor().init(qsize) + ed = Editor(qsize) if args[0:]: ed.open_input(args[0]) if args[1:]: @@ -43,7 +43,7 @@ def main(): class Editor: - def init(self, qsize): + def __init__(self, qsize): self.qsize = qsize self.vin = None self.vout = None @@ -53,7 +53,6 @@ class Editor: flp.create_full_form(self, formdef) self.form.show_form(FL.PLACE_SIZE, FL.TRUE, 'Vedit') fl.set_event_call_back(self.do_event) - return self def do_event(self, dev, val): if dev == DEVICE.REDRAW: @@ -215,7 +214,7 @@ class Editor: basename = os.path.split(filename)[1] title = 'in: ' + basename try: - vin = Viewer.InputViewer().init(filename, title) + vin = Viewer.InputViewer(filename, title) except: self.err('Can\'t open input file', filename) return @@ -244,7 +243,7 @@ class Editor: basename = os.path.split(filename)[1] title = 'out: ' + basename try: - vout = Viewer.OutputViewer().init(filename, \ + vout = Viewer.OutputViewer(filename, \ title, self.qsize) except: self.err('Can\'t open output file', filename) diff --git a/Demo/sgi/video/Vfix.py b/Demo/sgi/video/Vfix.py index 82465bc..6b26023 100755 --- a/Demo/sgi/video/Vfix.py +++ b/Demo/sgi/video/Vfix.py @@ -39,7 +39,7 @@ def main(): def process(infilename, outfilename): try: - vin = VFile.BasicVinFile().init(infilename) + vin = VFile.BasicVinFile(infilename) except IOError, msg: sys.stderr.write(infilename + ': I/O error: ' + `msg` + '\n') return 1 @@ -51,7 +51,7 @@ def process(infilename, outfilename): return 1 try: - vout = VFile.BasicVoutFile().init(outfilename) + vout = VFile.BasicVoutFile(outfilename) except IOError, msg: sys.stderr.write(outfilename + ': I/O error: ' + `msg` + '\n') return 1 diff --git a/Demo/sgi/video/Viewer.py b/Demo/sgi/video/Viewer.py index 2b9607b..07cba54 100755 --- a/Demo/sgi/video/Viewer.py +++ b/Demo/sgi/video/Viewer.py @@ -5,9 +5,9 @@ import os class InputViewer: - def init(self, filename, title, *args): + def __init__(self, filename, title, *args): try: - self.vin = VFile.VinFile().init(filename) + self.vin = VFile.VinFile(filename) except (EOFError, VFile.Error): raise IOError, 'bad video input file' self.vin.warmcache() @@ -20,7 +20,6 @@ class InputViewer: gl.prefsize(self.vin.width, self.vin.height) self.wid = -1 self.reset() - return self def close(self): self.vin.close() @@ -99,9 +98,9 @@ class InputViewer: class OutputViewer: - def init(self, filename, title, qsize): + def __init__(self, filename, title, qsize): try: - self.vout = VFile.VoutFile().init(filename) + self.vout = VFile.VoutFile(filename) except (EOFError, VFile.Error): raise IOError, 'bad video output file' if not title: @@ -112,7 +111,6 @@ class OutputViewer: gl.foreground() self.wid = -1 self.reset() - return self def close(self): while self.queue: @@ -124,7 +122,7 @@ class OutputViewer: def rewind(self): info = self.vout.getinfo() self.vout.close() - self.vout = VFile.VoutFile().init(self.filename) + self.vout = VFile.VoutFile(self.filename) self.vout.setinfo(info) self.reset() @@ -228,8 +226,8 @@ class OutputViewer: def test(): import sys - a = InputViewer().init(sys.argv[1], '') - b = OutputViewer().init(sys.argv[2], '') + a = InputViewer(sys.argv[1], '') + b = OutputViewer(sys.argv[2], '') b.setinfo(a.getinfo()) while 1: diff --git a/Demo/sgi/video/Vinfo.py b/Demo/sgi/video/Vinfo.py index e0c9e8c..c4177dc 100755 --- a/Demo/sgi/video/Vinfo.py +++ b/Demo/sgi/video/Vinfo.py @@ -68,7 +68,7 @@ def main(): def process(filename): try: - vin = VFile.RandomVinFile().init(filename) + vin = VFile.RandomVinFile(filename) except IOError, msg: sys.stderr.write(filename + ': I/O error: ' + `msg` + '\n') return 1 diff --git a/Demo/sgi/video/Vmkjpeg.py b/Demo/sgi/video/Vmkjpeg.py index 19c51d6..4e4c28e 100755 --- a/Demo/sgi/video/Vmkjpeg.py +++ b/Demo/sgi/video/Vmkjpeg.py @@ -39,7 +39,7 @@ def main(): def process(infilename, outfilename): try: - vin = VFile.BasicVinFile().init(infilename) + vin = VFile.BasicVinFile(infilename) except IOError, msg: sys.stderr.write(infilename + ': I/O error: ' + `msg` + '\n') return 1 @@ -51,7 +51,7 @@ def process(infilename, outfilename): return 1 try: - vout = VFile.BasicVoutFile().init(outfilename) + vout = VFile.BasicVoutFile(outfilename) except IOError, msg: sys.stderr.write(outfilename + ': I/O error: ' + `msg` + '\n') return 1 diff --git a/Demo/sgi/video/Vplay.py b/Demo/sgi/video/Vplay.py index 15592d3..05cff6d 100755 --- a/Demo/sgi/video/Vplay.py +++ b/Demo/sgi/video/Vplay.py @@ -144,7 +144,7 @@ def main(): def process(filename): try: - vin = VFile.VinFile().init(filename) + vin = VFile.VinFile(filename) except IOError, msg: sys.stderr.write(filename + ': I/O error: ' + `msg` + '\n') return 1 @@ -233,7 +233,7 @@ def playonce(vin): MAXSIZE = 20 # Don't read ahead too much import thread import Queue - queue = Queue.Queue().init(MAXSIZE) + queue = Queue.Queue(MAXSIZE) stop = [] thread.start_new_thread(read_ahead, (vin, queue, stop)) # Get the read-ahead thread going diff --git a/Demo/sgi/video/Vrec.py b/Demo/sgi/video/Vrec.py index 164e89e..57b628c 100755 --- a/Demo/sgi/video/Vrec.py +++ b/Demo/sgi/video/Vrec.py @@ -253,7 +253,7 @@ def record(v, info, filename, audiofilename, mono, grey, greybits, \ # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: - vout = VFile.VoutFile().init(filename) + vout = VFile.VoutFile(filename) if mono: format = 'mono' elif grey and greybits == 8: @@ -273,7 +273,7 @@ def record(v, info, filename, audiofilename, mono, grey, greybits, \ print 'done.' MAXSIZE = 20 # XXX should be a user option import Queue - queue = Queue.Queue().init(MAXSIZE) + queue = Queue.Queue(MAXSIZE) done = thread.allocate_lock() done.acquire_lock() convertor = None @@ -376,8 +376,8 @@ def saveframes(vout, queue, done, mono, monotreshold, convertor): AQSIZE = 8000 # XXX should be a user option def initaudio(filename, stop, done): - import thread, aiff - afile = aiff.Aiff().init(filename, 'w') + import thread, aifc + afile = aifc.open(filename, 'w') afile.nchannels = AL.MONO afile.sampwidth = AL.SAMPLE_8 params = [AL.INPUT_RATE, 0] diff --git a/Demo/sgi/video/Vrecb.py b/Demo/sgi/video/Vrecb.py index f726fe3..f568779 100755 --- a/Demo/sgi/video/Vrecb.py +++ b/Demo/sgi/video/Vrecb.py @@ -309,7 +309,7 @@ def record(v, info, filename, audiofilename, \ # Construct header and write it # try: - vout = VFile.VoutFile().init(filename) + vout = VFile.VoutFile(filename) except IOError, msg: print filename, ':', msg sys.exit(1) @@ -389,8 +389,8 @@ def record(v, info, filename, audiofilename, \ AQSIZE = 8*8000 # XXX should be a user option def initaudio(filename, stop, start, done): - import thread, aiff - afile = aiff.Aiff().init(filename, 'w') + import thread, aifc + afile = aifc.open(filename, 'w') afile.nchannels = AL.MONO afile.sampwidth = AL.SAMPLE_8 params = [AL.INPUT_RATE, 0] diff --git a/Demo/sgi/video/Vreceive.py b/Demo/sgi/video/Vreceive.py index 22cd95b..f72c6a5 100755 --- a/Demo/sgi/video/Vreceive.py +++ b/Demo/sgi/video/Vreceive.py @@ -68,7 +68,7 @@ def main(): gl.qdevice(DEVICE.WINSHUT) gl.qdevice(DEVICE.WINQUIT) - lvo = LiveVideoOut.LiveVideoOut().init(wid, width, height, vtype) + lvo = LiveVideoOut.LiveVideoOut(wid, width, height, vtype) ifdlist = [gl.qgetfd(), s.fileno()] ofdlist = [] diff --git a/Demo/sgi/video/Vsend.py b/Demo/sgi/video/Vsend.py index 94f2b52..cc1e1ca 100755 --- a/Demo/sgi/video/Vsend.py +++ b/Demo/sgi/video/Vsend.py @@ -96,9 +96,9 @@ def main(): gl.qdevice(DEVICE.WINTHAW) width, height = gl.getsize() - lvo = LiveVideoOut.LiveVideoOut().init(wid, width, height, vtype) + lvo = LiveVideoOut.LiveVideoOut(wid, width, height, vtype) - lvi = LiveVideoIn.LiveVideoIn().init(pktmax, width, height, vtype) + lvi = LiveVideoIn.LiveVideoIn(pktmax, width, height, vtype) s = socket(AF_INET, SOCK_DGRAM) s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1) diff --git a/Demo/sgi/video/Vtime.py b/Demo/sgi/video/Vtime.py index 321e233..be161cc 100755 --- a/Demo/sgi/video/Vtime.py +++ b/Demo/sgi/video/Vtime.py @@ -65,7 +65,7 @@ def main(): def process(infilename, outfilename): try: - vin = VFile.BasicVinFile().init(infilename) + vin = VFile.BasicVinFile(infilename) except IOError, msg: sys.stderr.write(infilename + ': I/O error: ' + `msg` + '\n') return 1 @@ -77,7 +77,7 @@ def process(infilename, outfilename): return 1 try: - vout = VFile.BasicVoutFile().init(outfilename) + vout = VFile.BasicVoutFile(outfilename) except IOError, msg: sys.stderr.write(outfilename + ': I/O error: ' + `msg` + '\n') return 1 diff --git a/Demo/sgi/video/Vunjpeg.py b/Demo/sgi/video/Vunjpeg.py index c5ce471..9f21f95 100755 --- a/Demo/sgi/video/Vunjpeg.py +++ b/Demo/sgi/video/Vunjpeg.py @@ -39,7 +39,7 @@ def main(): def process(infilename, outfilename): try: - vin = VFile.BasicVinFile().init(infilename) + vin = VFile.BasicVinFile(infilename) except IOError, msg: sys.stderr.write(infilename + ': I/O error: ' + `msg` + '\n') return 1 @@ -51,7 +51,7 @@ def process(infilename, outfilename): return 1 try: - vout = VFile.BasicVoutFile().init(outfilename) + vout = VFile.BasicVoutFile(outfilename) except IOError, msg: sys.stderr.write(outfilename + ': I/O error: ' + `msg` + '\n') return 1 diff --git a/Demo/sgi/video/aplay.py b/Demo/sgi/video/aplay.py index 5544fbe..7b10027 100755 --- a/Demo/sgi/video/aplay.py +++ b/Demo/sgi/video/aplay.py @@ -55,7 +55,7 @@ def main(): videofile = videofile + '.video' print 'Opening video input file..' - vin = VFile.VinFile().init(videofile) + vin = VFile.VinFile(videofile) print 'Opening audio input file..' ain = aifc.open(audiofile, 'r') diff --git a/Demo/sgi/video/imgconv.py b/Demo/sgi/video/imgconv.py index 08bc7af..291fdc8 100755 --- a/Demo/sgi/video/imgconv.py +++ b/Demo/sgi/video/imgconv.py @@ -126,14 +126,13 @@ def enumerate_converters(fcs): def instantiate_converter(args): list = args[2] - cl = RtConverters().init(list) + cl = RtConverters(list) args.append(cl.convert) return args class RtConverters: - def init(self, list): + def __init__(self, list): self.list = list - return self def convert(self, img, w, h): for cv in self.list: diff --git a/Demo/sgi/video/rgb2video.py b/Demo/sgi/video/rgb2video.py index c6dd685..b6c34eb 100755 --- a/Demo/sgi/video/rgb2video.py +++ b/Demo/sgi/video/rgb2video.py @@ -48,7 +48,7 @@ def main(): format = oformat cfunc = imgconv.getconverter(oformat, format) - vout = VFile.VoutFile().init(outfile) + vout = VFile.VoutFile(outfile) vout.format = format vout.width = nxsize vout.height = ysize diff --git a/Demo/sgi/video/video2rgb.py b/Demo/sgi/video/video2rgb.py index bf4c3c5..7070a93 100755 --- a/Demo/sgi/video/video2rgb.py +++ b/Demo/sgi/video/video2rgb.py @@ -74,7 +74,7 @@ def main(): def process(filename): try: - vin = VFile.VinFile().init(filename) + vin = VFile.VinFile(filename) except IOError, msg: sys.stderr.write(filename + ': I/O error: ' + `msg` + '\n') return 1 |