1991-10-30 11:52:48 +00:00
|
|
|
from gl import *
|
|
|
|
from GL import *
|
|
|
|
from DEVICE import *
|
|
|
|
import time
|
|
|
|
import sys
|
1991-11-06 16:13:02 +00:00
|
|
|
import getopt
|
1991-10-30 11:52:48 +00:00
|
|
|
|
|
|
|
class Struct(): pass
|
|
|
|
epoch = Struct()
|
|
|
|
EndOfFile = 'End of file'
|
|
|
|
bye = 'bye'
|
|
|
|
|
1991-11-04 14:30:51 +00:00
|
|
|
def openvideo(filename):
|
1992-05-06 17:58:34 +00:00
|
|
|
f = open(filename, 'r')
|
|
|
|
line = f.readline()
|
|
|
|
if not line: raise EndOfFile
|
|
|
|
if line[:4] == 'CMIF': line = f.readline()
|
|
|
|
x = eval(line[:-1])
|
|
|
|
if len(x) == 3: w, h, pf = x
|
|
|
|
else: w, h = x; pf = 2
|
|
|
|
return f, w, h, pf
|
1991-11-04 14:30:51 +00:00
|
|
|
|
|
|
|
def loadframe(f, w, h, pf):
|
1992-05-06 17:58:34 +00:00
|
|
|
line = f.readline()
|
|
|
|
if line == '':
|
|
|
|
raise EndOfFile
|
|
|
|
x = eval(line[:-1])
|
|
|
|
if type(x) == type(0) or type(x) == type(0.0):
|
|
|
|
tijd = x
|
|
|
|
if pf == 0:
|
|
|
|
size = w*h*4
|
|
|
|
else:
|
|
|
|
size = (w/pf) * (h/pf)
|
|
|
|
else:
|
|
|
|
tijd, size = x
|
|
|
|
f.seek(size, 1)
|
|
|
|
return tijd
|
1991-11-04 14:30:51 +00:00
|
|
|
|
1991-10-30 11:52:48 +00:00
|
|
|
def main():
|
1991-11-06 16:13:02 +00:00
|
|
|
delta = 0
|
1992-05-06 17:58:34 +00:00
|
|
|
short = 0
|
|
|
|
try:
|
|
|
|
opts, names = getopt.getopt(sys.argv[1:], 'ds')
|
|
|
|
except getopt.error, msg:
|
|
|
|
sys.stderr.write(msg + '\n')
|
|
|
|
sys.stderr.write('usage: vinfo [-d] [-s] [file] ...\n')
|
|
|
|
sys.exit(2)
|
1991-11-06 16:13:02 +00:00
|
|
|
for opt, arg in opts:
|
1992-05-06 17:58:34 +00:00
|
|
|
if opt == '-d': delta = 1 # print delta between frames
|
|
|
|
elif opt == '-s': short = 1 # short: don't print times
|
1992-02-11 14:50:22 +00:00
|
|
|
if names == []:
|
1991-10-30 11:52:48 +00:00
|
|
|
names = ['film.video']
|
|
|
|
for name in names:
|
1991-11-06 16:13:02 +00:00
|
|
|
try:
|
|
|
|
f, w, h, pf = openvideo(name)
|
|
|
|
except:
|
|
|
|
sys.stderr.write(name + ': cannot open\n')
|
|
|
|
continue
|
1992-05-06 17:58:34 +00:00
|
|
|
if pf == 0:
|
|
|
|
size = w*h*4
|
|
|
|
else:
|
|
|
|
size = (w/pf) * (h/pf)
|
|
|
|
print name, ':', w, 'x', h, '; pf =', pf, ', size =', size,
|
1992-05-07 15:21:52 +00:00
|
|
|
if pf == 0:
|
|
|
|
print '(color)',
|
|
|
|
else:
|
|
|
|
print '(' + `(w/pf)` + 'x' + `(h/pf)` + ')',
|
|
|
|
if (w/pf)%4 <> 0: print '!!!',
|
1992-05-06 17:58:34 +00:00
|
|
|
print
|
1991-10-30 11:52:48 +00:00
|
|
|
num = 0
|
|
|
|
try:
|
1991-11-06 16:13:02 +00:00
|
|
|
otijd = 0
|
1992-05-06 17:58:34 +00:00
|
|
|
while not short:
|
1991-10-30 11:52:48 +00:00
|
|
|
try:
|
1991-11-04 14:30:51 +00:00
|
|
|
tijd = loadframe(f, w, h, pf)
|
1992-05-06 17:58:34 +00:00
|
|
|
if delta: print '\t' + `tijd-otijd`,
|
|
|
|
else: print '\t' + `tijd`,
|
1991-11-06 16:13:02 +00:00
|
|
|
otijd = tijd
|
1991-10-30 11:52:48 +00:00
|
|
|
num = num + 1
|
1992-02-11 14:50:22 +00:00
|
|
|
if num % 8 == 0:
|
1991-10-30 11:52:48 +00:00
|
|
|
print
|
|
|
|
except EndOfFile:
|
|
|
|
raise bye
|
|
|
|
except bye:
|
|
|
|
pass
|
|
|
|
if num % 8 <> 0:
|
|
|
|
print
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
main()
|