]> granicus.if.org Git - python/commitdiff
Fix for issue 900949
authorRonald Oussoren <ronaldoussoren@mac.com>
Fri, 2 Jan 2009 14:46:19 +0000 (14:46 +0000)
committerRonald Oussoren <ronaldoussoren@mac.com>
Fri, 2 Jan 2009 14:46:19 +0000 (14:46 +0000)
Lib/plat-mac/videoreader.py
Misc/NEWS

index fbb37e12e752f3402aa8d1d98783c13c58b74eb3..28b71ffe3e0e9a79272ba3e970bf940a3ac04504 100644 (file)
@@ -238,12 +238,12 @@ class _Reader:
         width = self.videodescr['width']
         height = self.videodescr['height']
         start = 0
-        rv = ''
+        rv = []
         for i in range(height):
             nextline = Qdoffs.GetPixMapBytes(self.pixmap, start, width*4)
             start = start + rowbytes
-            rv = rv + nextline
-        return rv
+            rv.append(nextline)
+        return ''.join(rv)
 
 def reader(url):
     try:
@@ -255,9 +255,9 @@ def reader(url):
 def _test():
     import EasyDialogs
     try:
-        import img
+        from PIL import Image
     except ImportError:
-        img = None
+        Image = None
     import MacOS
     Qt.EnterMovies()
     path = EasyDialogs.AskFileForOpen(message='Video to convert')
@@ -277,13 +277,11 @@ def _test():
         fname = 'frame%04.4d.jpg'%num
         num = num+1
         pname = os.path.join(dstdir, fname)
-        if not img: print 'Not',
+        if not Image: print 'Not',
         print 'Writing %s, size %dx%d, %d bytes'%(fname, imgw, imgh, len(data))
-        if img:
-            wrt = img.writer(imgfmt, pname)
-            wrt.width = imgw
-            wrt.height = imgh
-            wrt.write(data)
+        if Image:
+            img = Image.fromstring("RGBA", (imgw, imgh), data)
+            img.save(pname, 'JPEG')
             timestamp, data = rdr.ReadVideo()
             MacOS.SetCreatorAndType(pname, 'ogle', 'JPEG')
             if num > 20:
index 3e82146e3174105cdd354a2f10860fa0f6519f49..d2555a39b5d982df3f3f90c2fed70592ccd8c144 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -227,6 +227,9 @@ Library
 - Issue #1594: MacOS.GetCreatorAndType now always returns a big-endian result,
   to be consistent with Apple tools.
 
+- Issue #900949: plat-mac/videoreader.py no longer relies on a non-existing
+  module. 
+
 Tools/Demos
 -----------