Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0caf46b

Browse files
committed
VFile: fix c0bits etc. after setformat; Vrec.py: use setformat; rm Makefile.
1 parent c9e340d commit 0caf46b

2 files changed

Lines changed: 27 additions & 10 deletions

File tree

Demo/sgi/video/VFile.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ def init(self):
190190
self.width = 0 # width of frame
191191
self.height = 0 # height of frame
192192
self.packfactor = 1, 1 # expansion using rectzoom
193+
# Colormap info
193194
self.c0bits = 8 # bits in first color dimension
194195
self.c1bits = 0 # bits in second color dimension
195196
self.c2bits = 0 # bits in third color dimension
@@ -224,6 +225,22 @@ def setderived(self):
224225
self.realwidth = self.width / self.xpf
225226
self.realheight = self.height / self.ypf
226227

228+
# Set colormap info
229+
230+
def setcmapinfo(self):
231+
stuff = 0, 0, 0, 0, 0
232+
if self.format in ('rgb8', 'grey'):
233+
stuff = 8, 0, 0, 0, 0
234+
if self.format == 'grey4':
235+
stuff = 4, 0, 0, 0, 0
236+
if self.format == 'grey2':
237+
stuff = 2, 0, 0, 0, 0
238+
if self.format == 'mono':
239+
stuff = 1, 0, 0, 0, 0
240+
print 'setcmapinfo:', stuff
241+
self.c0bits, self.c1bits, self.c2bits, \
242+
self.offset, self.chrompack = stuff
243+
227244
# Set the frame width and height (e.g. from gl.getsize())
228245

229246
def setsize(self, width, height):
@@ -242,9 +259,9 @@ def getsize(self):
242259

243260
def setformat(self, format):
244261
if self.frozen: raise CallError
245-
if format <> self.format:
246-
self.format = format
247-
self.setderived()
262+
self.format = format
263+
self.setderived()
264+
self.setcmapinfo()
248265

249266
# Get the format
250267

Demo/sgi/video/Vrec.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,17 +255,17 @@ def record(v, info, filename, audiofilename, mono, grey, greybits, \
255255
if filename:
256256
vout = VFile.VoutFile().init(filename)
257257
if mono:
258-
vout.format = 'mono'
258+
format = 'mono'
259259
elif grey and greybits == 8:
260-
vout.format = 'grey'
260+
format = 'grey'
261261
elif grey:
262-
vout.format = 'grey'+`abs(greybits)`
262+
format = 'grey'+`abs(greybits)`
263263
else:
264-
vout.format = 'rgb8'
265-
vout.width = x
266-
vout.height = y
264+
format = 'rgb8'
265+
vout.setformat(format)
266+
vout.setsize(x, y)
267267
if fields:
268-
vout.packfactor = (1,-2)
268+
vout.setpf(1, -2))
269269
vout.writeheader()
270270
if preallocspace:
271271
print 'Preallocating space...'

0 commit comments

Comments
 (0)