]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Vrec.py: don't print Ids if no frames are captured.
authorGuido van Rossum <guido@python.org>
Mon, 15 Feb 1993 17:33:36 +0000 (17:33 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 15 Feb 1993 17:33:36 +0000 (17:33 +0000)
Vrecb.py: use the new interfaces to imageop (fix -M, -m, -g options).

Demo/sgi/video/Vrec.py
Demo/sgi/video/Vrecb.py

index d9525669bb9de5b6c60447c21266c4a85a9f6cd9..e90a4bd030daf08af7d6a76e9a55305fb4fa35dc 100755 (executable)
@@ -326,13 +326,14 @@ def record(v, info, filename, audiofilename, mono, grey, greybits, \
                print count*200.0/lastid, '%,',
                print count*rate*200.0/lastid, '% of wanted rate',
        print
-       print 'Ids:',
-       t0 = ids[0]
-       del ids[0]
-       for t1 in ids:
-               print t1-t0,
-               t0 = t1
-       print
+       if ids:
+               print 'Ids:',
+               t0 = ids[0]
+               del ids[0]
+               for t1 in ids:
+                       print t1-t0,
+                       t0 = t1
+               print
        if filename and audiofilename:
                audiostop.append(None)
                audiodone.acquire_lock()
index 84cd5cceee52392f122e9f97f6bf539a8a5dc875..2dcbe8ea3075e5cc74490a634b4ecd8d55570e1a 100755 (executable)
@@ -245,7 +245,11 @@ def record(v, info, filename, mono, grey, greybits, monotreshold, fields):
                #
                # Construct header and write it
                #
-               vout = VFile.VoutFile().init(filename)
+               try:
+                       vout = VFile.VoutFile().init(filename)
+               except IOError, msg:
+                       print filename, ':', msg
+                       sys.exit(1)
                if mono:
                        vout.format = 'mono'
                elif grey and greybits == 8:
@@ -291,13 +295,15 @@ def record(v, info, filename, mono, grey, greybits, monotreshold, fields):
                        start = frameno*fieldsize
                        field = data[start:start+fieldsize]
                        if convertor:
-                               field = convertor(field, x, y)
+                               field = convertor(field, len(field), 1)
                        elif mono and monotreshold >= 0:
-                               field = imageop.grey2mono(field, x, y, \
-                                         1, monotreshold)
+                               field = imageop.grey2mono( \
+                                         field, len(field), 1, monotreshold)
                        elif mono:
-                               field = imageop.dither2mono(field, x, y)
+                               field = imageop.dither2mono( \
+                                         field, len(field), 1)
                        vout.writeframe(int(realframeno*tpf), field, None)
+                       realframeno = realframeno + 1
                print 'Skipped',nskipped,'duplicate frames'
                vout.close()