Commit dd35cc3c authored by Guido van Rossum's avatar Guido van Rossum

Vrec.py: don't print Ids if no frames are captured.

Vrecb.py: use the new interfaces to imageop (fix -M, -m, -g options).
parent 2a2ec5a4
...@@ -326,13 +326,14 @@ def record(v, info, filename, audiofilename, mono, grey, greybits, \ ...@@ -326,13 +326,14 @@ def record(v, info, filename, audiofilename, mono, grey, greybits, \
print count*200.0/lastid, '%,', print count*200.0/lastid, '%,',
print count*rate*200.0/lastid, '% of wanted rate', print count*rate*200.0/lastid, '% of wanted rate',
print print
print 'Ids:', if ids:
t0 = ids[0] print 'Ids:',
del ids[0] t0 = ids[0]
for t1 in ids: del ids[0]
print t1-t0, for t1 in ids:
t0 = t1 print t1-t0,
print t0 = t1
print
if filename and audiofilename: if filename and audiofilename:
audiostop.append(None) audiostop.append(None)
audiodone.acquire_lock() audiodone.acquire_lock()
......
...@@ -245,7 +245,11 @@ def record(v, info, filename, mono, grey, greybits, monotreshold, fields): ...@@ -245,7 +245,11 @@ def record(v, info, filename, mono, grey, greybits, monotreshold, fields):
# #
# Construct header and write it # 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: if mono:
vout.format = 'mono' vout.format = 'mono'
elif grey and greybits == 8: elif grey and greybits == 8:
...@@ -291,13 +295,15 @@ def record(v, info, filename, mono, grey, greybits, monotreshold, fields): ...@@ -291,13 +295,15 @@ def record(v, info, filename, mono, grey, greybits, monotreshold, fields):
start = frameno*fieldsize start = frameno*fieldsize
field = data[start:start+fieldsize] field = data[start:start+fieldsize]
if convertor: if convertor:
field = convertor(field, x, y) field = convertor(field, len(field), 1)
elif mono and monotreshold >= 0: elif mono and monotreshold >= 0:
field = imageop.grey2mono(field, x, y, \ field = imageop.grey2mono( \
1, monotreshold) field, len(field), 1, monotreshold)
elif mono: elif mono:
field = imageop.dither2mono(field, x, y) field = imageop.dither2mono( \
field, len(field), 1)
vout.writeframe(int(realframeno*tpf), field, None) vout.writeframe(int(realframeno*tpf), field, None)
realframeno = realframeno + 1
print 'Skipped',nskipped,'duplicate frames' print 'Skipped',nskipped,'duplicate frames'
vout.close() vout.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment