]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Uniformly replaced init() functions by __init__() constructors.
authorGuido van Rossum <guido@python.org>
Fri, 17 Dec 1993 15:11:41 +0000 (15:11 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 17 Dec 1993 15:11:41 +0000 (15:11 +0000)
A few simple things seem to work, I haven't tested it thouroughly
though...

27 files changed:
Demo/sgi/video/DisplayVideoIn.py
Demo/sgi/video/Dsend.py
Demo/sgi/video/LiveVideoIn.py
Demo/sgi/video/LiveVideoOut.py
Demo/sgi/video/OldVcopy.py
Demo/sgi/video/VCR.py
Demo/sgi/video/VFile.py
Demo/sgi/video/VGrabber.py
Demo/sgi/video/Vb.py
Demo/sgi/video/Vcopy.py
Demo/sgi/video/VcrIndex.py
Demo/sgi/video/Vedit.py
Demo/sgi/video/Vfix.py
Demo/sgi/video/Viewer.py
Demo/sgi/video/Vinfo.py
Demo/sgi/video/Vmkjpeg.py
Demo/sgi/video/Vplay.py
Demo/sgi/video/Vrec.py
Demo/sgi/video/Vrecb.py
Demo/sgi/video/Vreceive.py
Demo/sgi/video/Vsend.py
Demo/sgi/video/Vtime.py
Demo/sgi/video/Vunjpeg.py
Demo/sgi/video/aplay.py
Demo/sgi/video/imgconv.py
Demo/sgi/video/rgb2video.py
Demo/sgi/video/video2rgb.py

index 427d30a3c9327fcbc2378bbff0d8b08c5194e6df..6dbc7bcc384dc04c521fe41df8fc0bf4662e4055 100755 (executable)
@@ -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):
index 3213caae44af3c3b46a33740cd63380b827056c7..c4ed84214e5c91ec0189388cc532cf7b9a92e0ef 100755 (executable)
@@ -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)
index 4e000b101bf9b843431fe6c91519619e2efef0ed..661ea738b27935c46f48673151d90da8286c8058 100755 (executable)
@@ -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):
index 72e3d5811e765310d74bc5c87db369dd4779c366..6ee1846d41b53556750a8a350a1947d35c598935 100755 (executable)
@@ -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)
index 63bbf71c07aa0d3a2abadfd9e7b355e7c1828353..61461f40a6ead55bb7148efdc2ebd1b68f5c4ed2 100755 (executable)
@@ -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())
 
index 8fa87b0d95a169de0737473d93a4cf1e7711f0b4..0e2edc63ab30f6fb93c1429c3514d6fb50fdc215 100755 (executable)
@@ -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:
index d0eab0db35f3c279f8112cd00142250bc9b6cec8..3cb7506ac4fb403743b52f281f7ded9ee40282dd 100755 (executable)
@@ -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())
index 3c8693c18b31a286fb0a9cfd97e4d15840270dd2..242ebf2231f112f00b35b7cf39efe5fa94dc841e 100755 (executable)
@@ -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().
index 2596ca50394016f5e41f7cb1859182d67092f017..093bcf7ed0b0a85b7bfc47a62964c5b588a861ce 100755 (executable)
@@ -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)
index ef26f558122cfa033bc74b08370397013323ccbc..59c06a0f694fc9510db8fb7d952c6736d09eac05 100755 (executable)
@@ -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
index d73342b2a9478f0e4aa38a5ec67297e257348992..80212ee56193e0deb39444a924df883e7d583abc 100755 (executable)
@@ -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).
index 43a67c816f0054d0cd45431979d195d9bcbed7ee..228cabc3666db64c6014253669cb40874f3126aa 100755 (executable)
@@ -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)
index 82465bc39b4a902f516ef865003761262d2f4416..6b2602399c290bdbda53364809379588ce6e9b92 100755 (executable)
@@ -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
index 2b9607b64cc32b0dc11440ed03a5e784b30a0e9b..07cba54cec181f41ea746d92a5824f51732bb106 100755 (executable)
@@ -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:
index e0c9e8ccaa1e6c06592f75e9c9f5000b95214bf0..c4177dc8423dbe64ee825124b1b25007fed9d6bd 100755 (executable)
@@ -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
index 19c51d6d0a0a78a9dbfde1551e1bf2b9241c3831..4e4c28ebf4ee1a24a8cb3b10649d72fb67ad625e 100755 (executable)
@@ -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
index 15592d3301b6d6f3617aab3c5dd75501a1954e54..05cff6d6ef6ac00d005ef7f5401b21bd8b7c4a36 100755 (executable)
@@ -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
index 164e89e14729bec29da2f1bea4c4a70f4ff45bc1..57b628c31f731b8fa3bcda6833dbe4e5833ddae9 100755 (executable)
@@ -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]
index f726fe33ad8e1ba55550d6051dc10de145c4d6b8..f5687791b74ac53fc26d7e36dd09b16646460622 100755 (executable)
@@ -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]
index 22cd95bb6620e4672aaac940b678fee2e5f119e4..f72c6a59206b96eb9586897deebd2a857da10ff7 100755 (executable)
@@ -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 = []
index 94f2b529f6e81c0f94c1557bc0649955bfb9715b..cc1e1ca675fa55f6be7299cdd5279ac5f5b5c00a 100755 (executable)
@@ -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)
index 321e23395887b64d3f517ffdfcd0a4c3150f76b1..be161ccb6737e8f9eb3c4228a665c0c859b46141 100755 (executable)
@@ -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
index c5ce4717ccc614af8d057085507b80bb1a6dedfc..9f21f959ffb66492c54b7ed4c70f3765cba29f5e 100755 (executable)
@@ -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
index 5544fbe45d9da384f429a9fdb34e46be1b8f12a5..7b1002722c1661ede0a3b12d805b32860104c373 100755 (executable)
@@ -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')
index 08bc7afee6a6f55ab29ea566a6cfb281e0558f37..291fdc8125deb3a2ff47155b5177cbf8055b79a5 100755 (executable)
@@ -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:
index c6dd6854b45cc13a22dd0ddd99d1f4790dd6d7f8..b6c34ebc35bd1e81daa835a147286649742d9fec 100755 (executable)
@@ -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
index bf4c3c505013dd90b13ba2ee3d1e4183d93e7677..7070a933422fb1990d522eac0b19b5ef34148ab4 100755 (executable)
@@ -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