[Python-checkins] r68158 - in python/trunk: Lib/plat-mac/videoreader.py Misc/NEWS
ronald.oussoren
python-checkins at python.org
Fri Jan 2 15:46:19 CET 2009
Author: ronald.oussoren
Date: Fri Jan 2 15:46:19 2009
New Revision: 68158
Log:
Fix for issue 900949
Modified:
python/trunk/Lib/plat-mac/videoreader.py
python/trunk/Misc/NEWS
Modified: python/trunk/Lib/plat-mac/videoreader.py
==============================================================================
--- python/trunk/Lib/plat-mac/videoreader.py (original)
+++ python/trunk/Lib/plat-mac/videoreader.py Fri Jan 2 15:46:19 2009
@@ -238,12 +238,12 @@
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 _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 @@
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:
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Fri Jan 2 15:46:19 2009
@@ -227,6 +227,9 @@
- 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
-----------
More information about the Python-checkins
mailing list