Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f47d0485
Commit
f47d0485
authored
Feb 11, 1992
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new syntax
parent
d61bbb33
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
60 additions
and
60 deletions
+60
-60
Demo/sgi/video/cam.py
Demo/sgi/video/cam.py
+4
-4
Demo/sgi/video/camcorder.py
Demo/sgi/video/camcorder.py
+13
-13
Demo/sgi/video/colorsys.py
Demo/sgi/video/colorsys.py
+5
-5
Demo/sgi/video/statit.py
Demo/sgi/video/statit.py
+1
-1
Demo/sgi/video/syncaudio.py
Demo/sgi/video/syncaudio.py
+3
-3
Demo/sgi/video/tv.py
Demo/sgi/video/tv.py
+2
-2
Demo/sgi/video/vcopy.py
Demo/sgi/video/vcopy.py
+9
-9
Demo/sgi/video/video.py
Demo/sgi/video/video.py
+13
-13
Demo/sgi/video/vinfo.py
Demo/sgi/video/vinfo.py
+8
-8
Demo/sgi/video/vtime.py
Demo/sgi/video/vtime.py
+2
-2
No files found.
Demo/sgi/video/cam.py
View file @
f47d0485
...
@@ -23,7 +23,7 @@ if sys.argv[1:]:
...
@@ -23,7 +23,7 @@ if sys.argv[1:]:
if
sys
.
argv
[
2
:]:
if
sys
.
argv
[
2
:]:
HOST
=
sys
.
argv
[
2
]
HOST
=
sys
.
argv
[
2
]
if
HOST
=
'all'
:
if
HOST
=
=
'all'
:
HOST
=
'<broadcast>'
HOST
=
'<broadcast>'
MAX
=
1400
MAX
=
1400
...
@@ -47,7 +47,7 @@ def main():
...
@@ -47,7 +47,7 @@ def main():
readsource
(
SRC_FRAMEGRABBER
)
readsource
(
SRC_FRAMEGRABBER
)
s
=
socket
(
AF_INET
,
SOCK_DGRAM
)
s
=
socket
(
AF_INET
,
SOCK_DGRAM
)
if
HOST
=
'<broadcast>'
:
if
HOST
=
=
'<broadcast>'
:
s
.
allowbroadcast
(
1
)
s
.
allowbroadcast
(
1
)
addr
=
HOST
,
PORT
addr
=
HOST
,
PORT
...
@@ -72,7 +72,7 @@ def main():
...
@@ -72,7 +72,7 @@ def main():
while
1
:
while
1
:
while
qtest
():
while
qtest
():
dev
,
val
=
qread
()
dev
,
val
=
qread
()
if
dev
=
REDRAW
:
if
dev
=
=
REDRAW
:
reshapeviewport
()
reshapeviewport
()
w
,
h
=
getsize
()
w
,
h
=
getsize
()
ortho2
(
0
,
w
,
0
,
h
)
ortho2
(
0
,
w
,
0
,
h
)
...
@@ -93,7 +93,7 @@ def main():
...
@@ -93,7 +93,7 @@ def main():
fps
=
0
fps
=
0
elif
dev
=
ESCKEY
:
elif
dev
=
=
ESCKEY
:
winclose
(
wid
)
winclose
(
wid
)
return
return
...
...
Demo/sgi/video/camcorder.py
View file @
f47d0485
...
@@ -93,7 +93,7 @@ def wrheader(f, w, h, pf):
...
@@ -93,7 +93,7 @@ def wrheader(f, w, h, pf):
f
.
write
(
'CMIF video 1.0
\
n
'
)
f
.
write
(
'CMIF video 1.0
\
n
'
)
f
.
write
(
`w,h,pf`
+
'
\
n
'
)
f
.
write
(
`w,h,pf`
+
'
\
n
'
)
print
'width,height,pf:'
,
w
,
h
,
pf
,
print
'width,height,pf:'
,
w
,
h
,
pf
,
if
pf
=
0
:
pf
=
4
if
pf
=
=
0
:
pf
=
4
print
'(i.e.,'
,
w
*
h
*
pf
,
'bytes/frame)'
print
'(i.e.,'
,
w
*
h
*
pf
,
'bytes/frame)'
def
main
():
def
main
():
...
@@ -103,14 +103,14 @@ def main():
...
@@ -103,14 +103,14 @@ def main():
austart
=
0
austart
=
0
optlist
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'ca:sp:'
)
optlist
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'ca:sp:'
)
for
opt
,
arg
in
optlist
:
for
opt
,
arg
in
optlist
:
if
opt
=
'-c'
:
if
opt
=
=
'-c'
:
pf
=
0
pf
=
0
elif
opt
=
'-a'
:
elif
opt
=
=
'-a'
:
ausync
=
1
ausync
=
1
aumachine
=
arg
aumachine
=
arg
elif
opt
=
'-s'
:
elif
opt
=
=
'-s'
:
austart
=
1
austart
=
1
elif
opt
=
'-p'
:
elif
opt
=
=
'-p'
:
pf
=
int
(
eval
(
arg
))
pf
=
int
(
eval
(
arg
))
else
:
else
:
usage
()
usage
()
...
@@ -184,13 +184,13 @@ def main():
...
@@ -184,13 +184,13 @@ def main():
if
qtest
()
or
\
if
qtest
()
or
\
not
(
mousing
or
inrunning
or
insingle
or
outrunning
or
outsingle
):
not
(
mousing
or
inrunning
or
insingle
or
outrunning
or
outsingle
):
ev
,
val
=
qread
()
ev
,
val
=
qread
()
if
ev
=
LEFTMOUSE
and
val
=
1
:
if
ev
=
=
LEFTMOUSE
and
val
=
=
1
:
drawframe
(
x
,
y
,
w
,
h
,
0
)
drawframe
(
x
,
y
,
w
,
h
,
0
)
mousing
=
1
mousing
=
1
ox
,
oy
=
getorigin
()
ox
,
oy
=
getorigin
()
x
=
getvaluator
(
MOUSEX
)
-
ox
x
=
getvaluator
(
MOUSEX
)
-
ox
y
=
getvaluator
(
MOUSEY
)
-
oy
y
=
getvaluator
(
MOUSEY
)
-
oy
elif
ev
=
LEFTMOUSE
and
val
=
0
:
elif
ev
=
=
LEFTMOUSE
and
val
=
=
0
:
if
h
<
0
:
if
h
<
0
:
y
,
h
=
y
+
h
,
-
h
y
,
h
=
y
+
h
,
-
h
if
w
<
0
:
if
w
<
0
:
...
@@ -200,7 +200,7 @@ def main():
...
@@ -200,7 +200,7 @@ def main():
wrheader
(
f
,
w
,
h
,
pf
)
wrheader
(
f
,
w
,
h
,
pf
)
sizewritten
=
1
sizewritten
=
1
prealloc
(
w
,
h
)
prealloc
(
w
,
h
)
elif
ev
=
RKEY
and
val
=
1
:
elif
ev
=
=
RKEY
and
val
=
=
1
:
if
not
inrunning
:
if
not
inrunning
:
ringbell
()
ringbell
()
else
:
else
:
...
@@ -211,7 +211,7 @@ def main():
...
@@ -211,7 +211,7 @@ def main():
starttime
=
time
.
millitimer
()
starttime
=
time
.
millitimer
()
if
ausync
:
if
ausync
:
ctl
.
sendto
(
`(1,starttime)`
,
aua
)
ctl
.
sendto
(
`(1,starttime)`
,
aua
)
elif
ev
=
PKEY
and
val
=
1
and
outrunning
:
elif
ev
=
=
PKEY
and
val
=
=
1
and
outrunning
:
outrunning
=
0
outrunning
=
0
stoptime
=
time
.
millitimer
()
stoptime
=
time
.
millitimer
()
if
ausync
:
if
ausync
:
...
@@ -222,11 +222,11 @@ def main():
...
@@ -222,11 +222,11 @@ def main():
print
'Saving...'
print
'Saving...'
saveframes
(
f
,
w
,
h
,
pf
)
saveframes
(
f
,
w
,
h
,
pf
)
print
'Done.'
print
'Done.'
elif
ev
=
PKEY
and
val
=
1
and
not
outrunning
:
elif
ev
=
=
PKEY
and
val
=
=
1
and
not
outrunning
:
outsingle
=
1
outsingle
=
1
elif
ev
=
CKEY
and
val
=
1
:
elif
ev
=
=
CKEY
and
val
=
=
1
:
inrunning
=
1
inrunning
=
1
elif
ev
=
SKEY
and
val
=
1
:
elif
ev
=
=
SKEY
and
val
=
=
1
:
if
outrunning
:
if
outrunning
:
ringbell
()
ringbell
()
elif
inrunning
:
elif
inrunning
:
...
@@ -237,7 +237,7 @@ def main():
...
@@ -237,7 +237,7 @@ def main():
if
ausync
:
if
ausync
:
ctl
.
sendto
(
`(2,time.millitimer())`
,
aua
)
ctl
.
sendto
(
`(2,time.millitimer())`
,
aua
)
raise
stop
raise
stop
elif
ev
=
REDRAW
:
elif
ev
=
=
REDRAW
:
drawframe
(
x
,
y
,
w
,
h
,
0
)
drawframe
(
x
,
y
,
w
,
h
,
0
)
reshapeviewport
()
reshapeviewport
()
drawframe
(
x
,
y
,
w
,
h
,
1
)
drawframe
(
x
,
y
,
w
,
h
,
1
)
...
...
Demo/sgi/video/colorsys.py
View file @
f47d0485
...
@@ -96,11 +96,11 @@ def hsv_to_rgb(h,s,v):
...
@@ -96,11 +96,11 @@ def hsv_to_rgb(h,s,v):
q
=
v
*
(
1.0
-
s
*
f
)
q
=
v
*
(
1.0
-
s
*
f
)
t
=
v
*
(
1.0
-
s
*
(
1.0
-
f
))
t
=
v
*
(
1.0
-
s
*
(
1.0
-
f
))
if
i
in
(
0
,
6
):
return
v
,
t
,
p
if
i
in
(
0
,
6
):
return
v
,
t
,
p
if
i
=
1
:
return
q
,
v
,
p
if
i
=
=
1
:
return
q
,
v
,
p
if
i
=
2
:
return
p
,
v
,
t
if
i
=
=
2
:
return
p
,
v
,
t
if
i
=
3
:
return
p
,
q
,
v
if
i
=
=
3
:
return
p
,
q
,
v
if
i
=
4
:
return
t
,
p
,
v
if
i
=
=
4
:
return
t
,
p
,
v
if
i
=
5
:
return
v
,
p
,
q
if
i
=
=
5
:
return
v
,
p
,
q
print
i
,
h
,
f
print
i
,
h
,
f
print
h
,
s
,
v
print
h
,
s
,
v
raise
'Bad color'
raise
'Bad color'
Demo/sgi/video/statit.py
View file @
f47d0485
...
@@ -94,7 +94,7 @@ def packline(line):
...
@@ -94,7 +94,7 @@ def packline(line):
i
,
n
=
1
,
len
(
bytes
)
i
,
n
=
1
,
len
(
bytes
)
while
i
<
n
:
while
i
<
n
:
for
pack
in
(
0
,
2
,
4
,
8
):
for
pack
in
(
0
,
2
,
4
,
8
):
if
pack
=
0
:
if
pack
=
=
0
:
lo
,
hi
=
0
,
0
lo
,
hi
=
0
,
0
else
:
else
:
hi
=
pow
(
2
,
pack
-
1
)
-
1
hi
=
pow
(
2
,
pack
-
1
)
-
1
...
...
Demo/sgi/video/syncaudio.py
View file @
f47d0485
...
@@ -70,8 +70,8 @@ def mainloop(ofile, ctl, inp, out, globaltime):
...
@@ -70,8 +70,8 @@ def mainloop(ofile, ctl, inp, out, globaltime):
# buffer. Discard all buffered data upto his starttime
# buffer. Discard all buffered data upto his starttime
#
#
startstop
,
histime
=
eval
(
ctl
.
recv
(
100
))
startstop
,
histime
=
eval
(
ctl
.
recv
(
100
))
if
(
ofile
=
None
and
startstop
=
0
)
or
\
if
(
ofile
=
=
None
and
startstop
=
=
0
)
or
\
(
ofile
<>
None
and
startstop
=
1
):
(
ofile
<>
None
and
startstop
=
=
1
):
print
'Sync error: saving='
,
save
,
' request='
,
startstop
print
'Sync error: saving='
,
save
,
' request='
,
startstop
sys
.
exit
(
1
)
sys
.
exit
(
1
)
filllevel
=
inp
.
getfilled
()
filllevel
=
inp
.
getfilled
()
...
@@ -89,6 +89,6 @@ def mainloop(ofile, ctl, inp, out, globaltime):
...
@@ -89,6 +89,6 @@ def mainloop(ofile, ctl, inp, out, globaltime):
print
'Time: '
,
time
.
millitimer
()
-
starttime
,
', Bytes: '
,
totbytes
,
', Samples: '
,
totsamps
print
'Time: '
,
time
.
millitimer
()
-
starttime
,
', Bytes: '
,
totbytes
,
', Samples: '
,
totsamps
if
ofile
<>
None
:
if
ofile
<>
None
:
ofile
.
write
(
data
)
ofile
.
write
(
data
)
return
(
startstop
=
2
)
return
(
startstop
=
=
2
)
main
()
main
()
Demo/sgi/video/tv.py
View file @
f47d0485
...
@@ -44,10 +44,10 @@ def main():
...
@@ -44,10 +44,10 @@ def main():
while
1
:
while
1
:
if
qtest
():
if
qtest
():
dev
,
val
=
qread
()
dev
,
val
=
qread
()
if
dev
=
ESCKEY
:
if
dev
=
=
ESCKEY
:
winclose
(
wid
)
winclose
(
wid
)
return
return
elif
dev
=
REDRAW
:
elif
dev
=
=
REDRAW
:
oldw
,
oldh
=
reshape
()
oldw
,
oldh
=
reshape
()
elif
s
.
avail
():
elif
s
.
avail
():
data
=
s
.
recv
(
17000
)
data
=
s
.
recv
(
17000
)
...
...
Demo/sgi/video/vcopy.py
View file @
f47d0485
...
@@ -7,10 +7,10 @@ from DEVICE import *
...
@@ -7,10 +7,10 @@ from DEVICE import *
def
loadframe
(
f
,
w
,
h
,
pf
):
def
loadframe
(
f
,
w
,
h
,
pf
):
line
=
f
.
readline
()
line
=
f
.
readline
()
if
not
line
or
line
=
'
\
n
'
:
if
not
line
or
line
=
=
'
\
n
'
:
raise
EOFError
raise
EOFError
x
=
eval
(
line
[:
-
1
])
x
=
eval
(
line
[:
-
1
])
if
type
(
x
)
=
type
(
0
):
if
type
(
x
)
=
=
type
(
0
):
if
pf
:
size
=
w
*
h
*
4
if
pf
:
size
=
w
*
h
*
4
else
:
size
=
w
*
h
*
pf
else
:
size
=
w
*
h
*
pf
else
:
else
:
...
@@ -47,10 +47,10 @@ def main():
...
@@ -47,10 +47,10 @@ def main():
ofp
=
open
(
ofile
,
'w'
)
ofp
=
open
(
ofile
,
'w'
)
#
#
line
=
ifp
.
readline
()
line
=
ifp
.
readline
()
if
line
[:
4
]
=
'CMIF'
:
if
line
[:
4
]
=
=
'CMIF'
:
line
=
ifp
.
readline
()
line
=
ifp
.
readline
()
x
=
eval
(
line
[:
-
1
])
x
=
eval
(
line
[:
-
1
])
if
len
(
x
)
=
3
:
if
len
(
x
)
=
=
3
:
w
,
h
,
pf
=
x
w
,
h
,
pf
=
x
else
:
else
:
w
,
h
=
x
w
,
h
=
x
...
@@ -82,11 +82,11 @@ def main():
...
@@ -82,11 +82,11 @@ def main():
dev
,
val
=
qread
()
dev
,
val
=
qread
()
if
dev
in
(
ESCKEY
,
WINQUIT
,
WINSHUT
):
if
dev
in
(
ESCKEY
,
WINQUIT
,
WINSHUT
):
break
break
if
dev
=
REDRAW
:
if
dev
=
=
REDRAW
:
reshapeviewport
()
reshapeviewport
()
elif
dev
=
KEYBD
:
elif
dev
=
=
KEYBD
:
c
=
chr
(
val
)
c
=
chr
(
val
)
if
c
=
'n'
:
if
c
=
=
'n'
:
try
:
try
:
time
,
data
=
loadframe
(
ifp
,
w
,
h
,
pf
)
time
,
data
=
loadframe
(
ifp
,
w
,
h
,
pf
)
iframe
=
iframe
+
1
iframe
=
iframe
+
1
...
@@ -94,13 +94,13 @@ def main():
...
@@ -94,13 +94,13 @@ def main():
except
EOFError
:
except
EOFError
:
print
'EOF'
print
'EOF'
ringbell
()
ringbell
()
elif
c
=
'w'
:
elif
c
=
=
'w'
:
ofp
.
write
(
`time, len(data)`
+
'
\
n
'
)
ofp
.
write
(
`time, len(data)`
+
'
\
n
'
)
ofp
.
write
(
data
)
ofp
.
write
(
data
)
print
'Frame'
,
iframe
,
'written.'
print
'Frame'
,
iframe
,
'written.'
else
:
else
:
print
'Character'
,
`c`
,
'ignored'
print
'Character'
,
`c`
,
'ignored'
elif
dev
=
INPUTCHANGE
:
elif
dev
=
=
INPUTCHANGE
:
pass
pass
else
:
else
:
print
'(dev, val) ='
,
(
dev
,
val
)
print
'(dev, val) ='
,
(
dev
,
val
)
...
...
Demo/sgi/video/video.py
View file @
f47d0485
...
@@ -31,26 +31,26 @@ def openvideo(name):
...
@@ -31,26 +31,26 @@ def openvideo(name):
sys
.
exit
(
1
)
sys
.
exit
(
1
)
line
=
f
.
readline
()
line
=
f
.
readline
()
if
not
line
:
raise
EndOfFile
if
not
line
:
raise
EndOfFile
if
line
[:
4
]
=
'CMIF'
:
if
line
[:
4
]
=
=
'CMIF'
:
if
line
[:
14
]
=
'CMIF video 2.0'
:
if
line
[:
14
]
=
=
'CMIF video 2.0'
:
line
=
f
.
readline
()
line
=
f
.
readline
()
colorinfo
=
eval
(
line
[:
-
1
])
colorinfo
=
eval
(
line
[:
-
1
])
else
:
else
:
colorinfo
=
(
8
,
0
,
0
,
0
)
colorinfo
=
(
8
,
0
,
0
,
0
)
line
=
f
.
readline
()
line
=
f
.
readline
()
x
=
eval
(
line
[:
-
1
])
x
=
eval
(
line
[:
-
1
])
if
len
(
x
)
=
3
:
w
,
h
,
pf
=
x
if
len
(
x
)
=
=
3
:
w
,
h
,
pf
=
x
else
:
w
,
h
=
x
;
pf
=
2
else
:
w
,
h
=
x
;
pf
=
2
return
f
,
w
,
h
,
pf
,
colorinfo
return
f
,
w
,
h
,
pf
,
colorinfo
def
loadframe
(
f
,
w
,
h
,
pf
,
af
,
spkr
,
(
ybits
,
ibits
,
qbits
,
chrompack
),
mf
):
def
loadframe
(
f
,
w
,
h
,
pf
,
af
,
spkr
,
(
ybits
,
ibits
,
qbits
,
chrompack
),
mf
):
line
=
f
.
readline
()
line
=
f
.
readline
()
if
line
=
''
:
if
line
=
=
''
:
raise
EndOfFile
raise
EndOfFile
x
=
eval
(
line
[:
-
1
])
x
=
eval
(
line
[:
-
1
])
if
type
(
x
)
=
type
(
0
)
or
type
(
x
)
=
type
(
0.0
):
if
type
(
x
)
=
=
type
(
0
)
or
type
(
x
)
=
=
type
(
0.0
):
tijd
=
x
tijd
=
x
if
pf
=
0
:
if
pf
=
=
0
:
size
=
w
*
h
*
4
size
=
w
*
h
*
4
else
:
else
:
size
=
(
w
/
pf
)
*
(
h
/
pf
)
size
=
(
w
/
pf
)
*
(
h
/
pf
)
...
@@ -98,10 +98,10 @@ def initcmap(ybits,ibits,qbits,chrompack):
...
@@ -98,10 +98,10 @@ def initcmap(ybits,ibits,qbits,chrompack):
for
y
in
range
(
maxy
):
for
y
in
range
(
maxy
):
yv
=
float
(
y
)
/
float
(
maxy
-
1
)
yv
=
float
(
y
)
/
float
(
maxy
-
1
)
for
i
in
range
(
maxi
):
for
i
in
range
(
maxi
):
if
maxi
=
1
:
iv
=
0
if
maxi
=
=
1
:
iv
=
0
else
:
iv
=
(
float
(
i
)
/
float
(
maxi
-
1
))
-
0.5
else
:
iv
=
(
float
(
i
)
/
float
(
maxi
-
1
))
-
0.5
for
q
in
range
(
maxq
):
for
q
in
range
(
maxq
):
if
maxq
=
1
:
qv
=
0
if
maxq
=
=
1
:
qv
=
0
else
:
qv
=
(
float
(
q
)
/
float
(
maxq
-
1
))
-
0.5
else
:
qv
=
(
float
(
q
)
/
float
(
maxq
-
1
))
-
0.5
index
=
2048
+
y
+
(
i
<<
ybits
)
+
(
q
<<
(
ybits
+
ibits
))
index
=
2048
+
y
+
(
i
<<
ybits
)
+
(
q
<<
(
ybits
+
ibits
))
rv
,
gv
,
bv
=
colorsys
.
yiq_to_rgb
(
yv
,
iv
,
qv
)
rv
,
gv
,
bv
=
colorsys
.
yiq_to_rgb
(
yv
,
iv
,
qv
)
...
@@ -125,13 +125,13 @@ def main():
...
@@ -125,13 +125,13 @@ def main():
'[-l] [-p pf] [-m mag] [-F] [moviefile [soundfile [skipbytes]]]
\
n
'
)
'[-l] [-p pf] [-m mag] [-F] [moviefile [soundfile [skipbytes]]]
\
n
'
)
sys
.
exit
(
2
)
sys
.
exit
(
2
)
for
opt
,
arg
in
opts
:
for
opt
,
arg
in
opts
:
if
opt
=
'-m'
:
if
opt
=
=
'-m'
:
magfactor
=
int
(
eval
(
arg
))
magfactor
=
int
(
eval
(
arg
))
elif
opt
=
'-p'
:
elif
opt
=
=
'-p'
:
packfactor
=
int
(
eval
(
arg
))
packfactor
=
int
(
eval
(
arg
))
elif
opt
=
'-l'
:
elif
opt
=
=
'-l'
:
looping
=
1
looping
=
1
elif
opt
=
'-F'
:
elif
opt
=
=
'-F'
:
epoch
.
correcttiming
=
0
epoch
.
correcttiming
=
0
if
args
:
if
args
:
filename
=
args
[
0
]
filename
=
args
[
0
]
...
@@ -206,7 +206,7 @@ def main():
...
@@ -206,7 +206,7 @@ def main():
dev
,
val
=
qread
()
dev
,
val
=
qread
()
if
dev
in
(
ESCKEY
,
WINSHUT
,
WINQUIT
):
if
dev
in
(
ESCKEY
,
WINSHUT
,
WINQUIT
):
raise
bye
raise
bye
elif
dev
=
REDRAW
:
elif
dev
=
=
REDRAW
:
reshapeviewport
()
reshapeviewport
()
except
bye
:
except
bye
:
pass
pass
...
...
Demo/sgi/video/vinfo.py
View file @
f47d0485
...
@@ -14,20 +14,20 @@ def openvideo(filename):
...
@@ -14,20 +14,20 @@ def openvideo(filename):
f
=
open
(
filename
,
'r'
)
f
=
open
(
filename
,
'r'
)
line
=
f
.
readline
()
line
=
f
.
readline
()
if
not
line
:
raise
EndOfFile
if
not
line
:
raise
EndOfFile
if
line
[:
4
]
=
'CMIF'
:
line
=
f
.
readline
()
if
line
[:
4
]
=
=
'CMIF'
:
line
=
f
.
readline
()
x
=
eval
(
line
[:
-
1
])
x
=
eval
(
line
[:
-
1
])
if
len
(
x
)
=
3
:
w
,
h
,
pf
=
x
if
len
(
x
)
=
=
3
:
w
,
h
,
pf
=
x
else
:
w
,
h
=
x
;
pf
=
2
else
:
w
,
h
=
x
;
pf
=
2
return
f
,
w
,
h
,
pf
return
f
,
w
,
h
,
pf
def
loadframe
(
f
,
w
,
h
,
pf
):
def
loadframe
(
f
,
w
,
h
,
pf
):
line
=
f
.
readline
()
line
=
f
.
readline
()
if
line
=
''
:
if
line
=
=
''
:
raise
EndOfFile
raise
EndOfFile
x
=
eval
(
line
[:
-
1
])
x
=
eval
(
line
[:
-
1
])
if
type
(
x
)
=
type
(
0
)
or
type
(
x
)
=
type
(
0.0
):
if
type
(
x
)
=
=
type
(
0
)
or
type
(
x
)
=
=
type
(
0.0
):
tijd
=
x
tijd
=
x
if
pf
=
0
:
if
pf
=
=
0
:
size
=
w
*
h
*
4
size
=
w
*
h
*
4
else
:
else
:
size
=
(
w
/
pf
)
*
(
h
/
pf
)
size
=
(
w
/
pf
)
*
(
h
/
pf
)
...
@@ -47,8 +47,8 @@ def main():
...
@@ -47,8 +47,8 @@ def main():
delta
=
0
delta
=
0
opts
,
names
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'd'
)
opts
,
names
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'd'
)
for
opt
,
arg
in
opts
:
for
opt
,
arg
in
opts
:
if
opt
=
'-d'
:
delta
=
1
if
opt
=
=
'-d'
:
delta
=
1
if
names
=
[]:
if
names
=
=
[]:
names
=
[
'film.video'
]
names
=
[
'film.video'
]
for
name
in
names
:
for
name
in
names
:
try
:
try
:
...
@@ -67,7 +67,7 @@ def main():
...
@@ -67,7 +67,7 @@ def main():
else
:
print
'
\
t
'
,
tijd
,
else
:
print
'
\
t
'
,
tijd
,
otijd
=
tijd
otijd
=
tijd
num
=
num
+
1
num
=
num
+
1
if
num
%
8
=
0
:
if
num
%
8
=
=
0
:
print
print
except
EndOfFile
:
except
EndOfFile
:
raise
bye
raise
bye
...
...
Demo/sgi/video/vtime.py
View file @
f47d0485
...
@@ -59,7 +59,7 @@ class VTime():
...
@@ -59,7 +59,7 @@ class VTime():
print
'Someone else syncing to us: '
,
other
print
'Someone else syncing to us: '
,
other
raise
bad_connect
raise
bad_connect
data
=
eval
(
data
)
data
=
eval
(
data
)
if
data
[:
2
]
=
(
loopct
+
1
,
curtijd
):
if
data
[:
2
]
=
=
(
loopct
+
1
,
curtijd
):
break
break
if
data
[
0
]
<>
2
:
if
data
[
0
]
<>
2
:
print
'Illegal sync reply: '
,
data
print
'Illegal sync reply: '
,
data
...
@@ -83,7 +83,7 @@ class VTime():
...
@@ -83,7 +83,7 @@ class VTime():
if
data
[
0
]
in
(
0
,
2
):
if
data
[
0
]
in
(
0
,
2
):
curtijd
=
time
.
millitimer
()
curtijd
=
time
.
millitimer
()
s
.
sendto
(
`(data[0]+1,data[1],curtijd)`
,
raddr
)
s
.
sendto
(
`(data[0]+1,data[1],curtijd)`
,
raddr
)
elif
data
[
0
]
=
4
:
elif
data
[
0
]
=
=
4
:
newtijd
=
time
.
millitimer
()
newtijd
=
time
.
millitimer
()
histime
=
data
[
1
]
histime
=
data
[
1
]
mytime
=
timeavg
(
curtijd
,
newtijd
)
mytime
=
timeavg
(
curtijd
,
newtijd
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment