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
82534fd8
Commit
82534fd8
authored
Aug 18, 1992
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add comments and options
parent
bc0eb996
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
151 additions
and
18 deletions
+151
-18
Demo/sgi/video/Vinfo.py
Demo/sgi/video/Vinfo.py
+66
-10
Demo/sgi/video/Vplay.py
Demo/sgi/video/Vplay.py
+85
-8
No files found.
Demo/sgi/video/Vinfo.py
View file @
82534fd8
#! /usr/local/python
# Print some info about a CMIF movie file
# Usage:
#
# Vinfo [-d] [-q] [-s] [file] ...
# Options:
#
# -d : print deltas between frames instead of frame times
# -q : quick: don't read the frames
# -s : don't print times (but do count frames and print the total)
# file ... : file(s) to inspect; default film.video
import
sys
sys
.
path
.
append
(
'/ufs/guido/src/video'
)
import
VFile
import
getopt
# Global options
short
=
0
quick
=
0
diffs
=
0
# Main program -- mostly command line parsing
def
main
():
if
sys
.
argv
[
1
:]:
for
filename
in
sys
.
argv
[
1
:]:
process
(
filename
)
else
:
process
(
'film.video'
)
global
short
,
quick
,
diffs
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'dqs'
)
for
opt
,
arg
in
opts
:
if
opt
==
'-q'
:
quick
=
1
elif
opt
==
'-d'
:
diffs
=
1
elif
opt
==
'-s'
:
short
=
1
if
not
args
:
args
=
[
'film.video'
]
for
filename
in
args
:
process
(
filename
)
# Process one file
def
process
(
filename
):
vin
=
VFile
.
VinFile
().
init
(
filename
)
...
...
@@ -17,22 +58,37 @@ def process(filename):
print
'Bits: '
,
vin
.
c0bits
,
vin
.
c1bits
,
vin
.
c2bits
print
'Format: '
,
vin
.
format
print
'Offset: '
,
vin
.
offset
print
'Frame times:'
,
if
quick
:
vin
.
close
()
return
if
not
short
:
print
'Frame times:'
,
n
=
0
t
=
0
told
=
0
while
1
:
try
:
t
,
data
,
cdata
=
vin
.
getnextframe
()
except
EOFError
:
print
if
not
short
:
print
break
if
n
%
8
==
0
:
sys
.
stdout
.
write
(
'
\
n
'
)
sys
.
stdout
.
write
(
'
\
t
'
+
`t`
)
if
not
short
:
if
n
%
8
==
0
:
sys
.
stdout
.
write
(
'
\
n
'
)
if
delta
:
sys
.
stdout
.
write
(
'
\
t
'
+
`t - told`
)
told
=
t
else
:
sys
.
stdout
.
write
(
'
\
t
'
+
`t`
)
n
=
n
+
1
print
'Total'
,
n
,
'frames in'
,
t
*
0.001
,
'sec.'
,
if
t
:
print
'-- average'
,
int
(
n
*
10000.0
/
t
)
*
0.1
,
'frames/sec'
,
print
vin
.
close
()
# Don't forget to call the main program
main
()
Demo/sgi/video/Vplay.py
View file @
82534fd8
#! /usr/local/python
# Play CMIF movie files
# Usage:
#
# Vplay [-l] [-m maginfy] [file] ...
# Options:
#
# -l : loop, playing the movie over and over again
# -m magnify : magnify the image by the given factor
# file ... : file(s) to play; default film.video
# User interface:
#
# Place the windo where you want it. The size is determined by the
# movie file and the -m option.
#
# Press ESC or select the window manager Quit or Close window option
# to close a window; if more files are given the window for the next
# file now pops up.
import
sys
sys
.
path
.
append
(
'/ufs/guido/src/video'
)
import
VFile
import
time
import
gl
,
GL
from
DEVICE
import
*
import
getopt
import
string
# Global options
magnify
=
1
looping
=
0
# Main program -- mostly command line parsing
def
main
():
if
sys
.
argv
[
1
:]:
for
filename
in
sys
.
argv
[
1
:]:
process
(
filename
)
else
:
process
(
'film.video'
)
global
magnify
,
looping
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'lm:'
)
for
opt
,
arg
in
opts
:
if
opt
==
'-l'
:
looping
=
1
elif
opt
==
'-m'
:
magnify
=
string
.
atoi
(
arg
)
if
not
args
:
args
=
[
'film.video'
]
for
filename
in
args
:
process
(
filename
)
# Process one file
def
process
(
filename
):
vin
=
VFile
.
VinFile
().
init
(
filename
)
...
...
@@ -20,9 +68,10 @@ def process(filename):
print
'Bits: '
,
vin
.
c0bits
,
vin
.
c1bits
,
vin
.
c2bits
print
'Format: '
,
vin
.
format
print
'Offset: '
,
vin
.
offset
vin
.
magnify
=
magnify
gl
.
foreground
()
gl
.
prefsize
(
vin
.
width
,
vin
.
height
)
gl
.
prefsize
(
vin
.
width
*
magnify
,
vin
.
height
*
magnify
)
win
=
gl
.
winopen
(
'* '
+
filename
)
vin
.
initcolormap
()
...
...
@@ -33,25 +82,53 @@ def process(filename):
t0
=
time
.
millitimer
()
running
=
1
data
=
None
t
=
0
n
=
0
while
1
:
if
running
:
try
:
t
,
data
,
chromdata
=
vin
.
getnextframe
()
n
=
n
+
1
except
EOFError
:
running
=
0
t1
=
time
.
millitimer
()
gl
.
wintitle
(
filename
)
print
'Recorded:'
,
n
,
print
'frames in'
,
t
*
0.001
,
'sec.'
,
if
t
:
print
'-- average'
,
print
int
(
n
*
10000.0
/
t
)
*
0.1
,
print
'frames/sec'
,
print
t
=
t1
-
t0
print
'Played:'
,
n
,
print
'frames in'
,
t
*
0.001
,
'sec.'
,
if
t
:
print
'-- average'
,
print
int
(
n
*
10000.0
/
t
)
*
0.1
,
print
'frames/sec'
,
print
if
looping
and
n
>
0
:
vin
.
rewind
()
vin
.
magnify
=
magnify
continue
else
:
running
=
0
if
running
:
dt
=
t
+
t0
-
time
.
millitimer
()
if
dt
>
0
:
time
.
millisleep
(
dt
)
vin
.
showframe
(
data
,
chromdata
)
vin
.
showframe
(
data
,
chromdata
)
if
not
running
or
gl
.
qtest
():
dev
,
val
=
gl
.
qread
()
if
dev
in
(
ESCKEY
,
WINSHUT
,
WINQUIT
):
gl
.
winclose
(
win
)
break
if
dev
==
REDRAW
:
gl
.
reshapeviewport
()
if
data
:
vin
.
showframe
(
data
,
chromdata
)
# Don't forget to call the main program
main
()
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