Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
67b48952
Kaydet (Commit)
67b48952
authored
Eyl 24, 1992
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added multicast to Vsend and Vreceive. Updated README. Rediced queue
size to 1 in LiveVideoIn.
üst
46927bac
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
10 deletions
+68
-10
LiveVideoIn.py
Demo/sgi/video/LiveVideoIn.py
+1
-1
README
Demo/sgi/video/README
+8
-0
Vreceive.py
Demo/sgi/video/Vreceive.py
+41
-6
Vsend.py
Demo/sgi/video/Vsend.py
+18
-3
No files found.
Demo/sgi/video/LiveVideoIn.py
Dosyayı görüntüle @
67b48952
...
@@ -54,7 +54,7 @@ class LiveVideoIn:
...
@@ -54,7 +54,7 @@ class LiveVideoIn:
# Initialize capture
# Initialize capture
v
.
SetSize
(
self
.
realwidth
,
self
.
realheight
)
v
.
SetSize
(
self
.
realwidth
,
self
.
realheight
)
dummy
=
v
.
InitContinuousCapture
(
SV
.
RGB8_FRAMES
,
\
dummy
=
v
.
InitContinuousCapture
(
SV
.
RGB8_FRAMES
,
\
self
.
realwidth
,
self
.
realheight
,
2
,
5
)
self
.
realwidth
,
self
.
realheight
,
1
,
5
)
self
.
data
=
None
self
.
data
=
None
self
.
lpos
=
0
self
.
lpos
=
0
return
self
return
self
...
...
Demo/sgi/video/README
Dosyayı görüntüle @
67b48952
...
@@ -57,6 +57,10 @@ Vtime.py (unrelated to vtime!!!) Copy a video file,
...
@@ -57,6 +57,10 @@ Vtime.py (unrelated to vtime!!!) Copy a video file,
Vedit.py interactive video editing program
Vedit.py interactive video editing program
Vsend.py unicast or multicast live video as UDP packets
Vreceive.py receive transmissions from Vsend
These modules are used by the above programs:
These modules are used by the above programs:
...
@@ -64,6 +68,10 @@ VFile.py classes that read and write CMIF video files
...
@@ -64,6 +68,10 @@ VFile.py classes that read and write CMIF video files
Viewer.py two viewer classes used by Vedit
Viewer.py two viewer classes used by Vedit
LiveVideoIn.py live video input class, used by Vsend
LiveVideoOut.py live video output class, used by Vsend and Vreceive
The following are C programs, either for efficiency or because they
The following are C programs, either for efficiency or because they
need to link with a C library:
need to link with a C library:
...
...
Demo/sgi/video/Vreceive.py
Dosyayı görüntüle @
67b48952
...
@@ -5,17 +5,22 @@
...
@@ -5,17 +5,22 @@
import
sys
import
sys
import
struct
import
struct
from
socket
import
*
from
socket
import
*
# syscalls and support functions
from
SOCKET
import
*
# <sys/socket.h>
from
IN
import
*
# <netinet/in.h>
import
select
import
select
import
struct
import
gl
,
GL
,
DEVICE
import
gl
,
GL
,
DEVICE
sys
.
path
.
append
(
'/ufs/guido/src/video'
)
sys
.
path
.
append
(
'/ufs/guido/src/video'
)
import
LiveVideoOut
import
LiveVideoOut
import
regsub
MYGROUP
=
'225.0.0.250'
PORT
=
5555
PKTMAX
=
16
*
1024
PKTMAX
=
16
*
1024
WIDTH
=
400
WIDTH
=
400
HEIGHT
=
300
HEIGHT
=
300
HOST
=
''
PORT
=
5555
def
main
():
def
main
():
...
@@ -23,6 +28,8 @@ def main():
...
@@ -23,6 +28,8 @@ def main():
if
sys
.
argv
[
1
:]:
if
sys
.
argv
[
1
:]:
port
=
eval
(
sys
.
argv
[
1
])
port
=
eval
(
sys
.
argv
[
1
])
s
=
opensocket
(
MYGROUP
,
port
)
width
,
height
=
WIDTH
,
HEIGHT
width
,
height
=
WIDTH
,
HEIGHT
gl
.
foreground
()
gl
.
foreground
()
...
@@ -36,9 +43,6 @@ def main():
...
@@ -36,9 +43,6 @@ def main():
lvo
=
LiveVideoOut
.
LiveVideoOut
()
.
init
(
wid
,
(
x
,
y
,
width
,
height
),
\
lvo
=
LiveVideoOut
.
LiveVideoOut
()
.
init
(
wid
,
(
x
,
y
,
width
,
height
),
\
width
,
height
)
width
,
height
)
s
=
socket
(
AF_INET
,
SOCK_DGRAM
)
s
.
bind
(
HOST
,
port
)
ifdlist
=
[
gl
.
qgetfd
(),
s
.
fileno
()]
ifdlist
=
[
gl
.
qgetfd
(),
s
.
fileno
()]
ofdlist
=
[]
ofdlist
=
[]
xfdlist
=
[]
xfdlist
=
[]
...
@@ -71,4 +75,35 @@ def main():
...
@@ -71,4 +75,35 @@ def main():
lvo
.
close
()
lvo
.
close
()
# Subroutine to create and properly initialize the receiving socket
def
opensocket
(
group
,
port
):
# Create the socket
s
=
socket
(
AF_INET
,
SOCK_DGRAM
)
# Bind the port to it
s
.
bind
(
''
,
port
)
# Allow multiple copies of this program on one machine
s
.
setsockopt
(
SOL_SOCKET
,
SO_REUSEPORT
,
1
)
# (Not strictly needed)
# Look up the group once
group
=
gethostbyname
(
group
)
# Ugly: construct binary group address
group_bytes
=
eval
(
regsub
.
gsub
(
'
\
.'
,
','
,
group
))
grpaddr
=
0
for
byte
in
group_bytes
:
grpaddr
=
(
grpaddr
<<
8
)
|
byte
# Construct struct mreq from grpaddr and ifaddr
ifaddr
=
INADDR_ANY
mreq
=
struct
.
pack
(
'll'
,
grpaddr
,
ifaddr
)
# Add group membership
s
.
setsockopt
(
IPPROTO_IP
,
IP_ADD_MEMBERSHIP
,
mreq
)
return
s
main
()
main
()
Demo/sgi/video/Vsend.py
Dosyayı görüntüle @
67b48952
...
@@ -7,16 +7,18 @@ import sys
...
@@ -7,16 +7,18 @@ import sys
import
time
import
time
import
struct
import
struct
from
socket
import
*
from
socket
import
*
from
SOCKET
import
*
import
gl
,
GL
,
DEVICE
import
gl
,
GL
,
DEVICE
sys
.
path
.
append
(
'/ufs/guido/src/video'
)
sys
.
path
.
append
(
'/ufs/guido/src/video'
)
import
LiveVideoIn
import
LiveVideoIn
import
LiveVideoOut
import
LiveVideoOut
import
SV
PKTMAX_UCAST
=
16
*
1024
-
6
PKTMAX_UCAST
=
16
*
1024
-
6
PKTMAX_BCAST
=
1450
PKTMAX_BCAST
=
1450
WIDTH
=
400
WIDTH
=
400
HEIGHT
=
300
HEIGHT
=
300
HOST
=
'
<broadcast>'
HOST
=
'
225.0.0.250'
# Multicast address!
PORT
=
5555
PORT
=
5555
def
main
():
def
main
():
...
@@ -28,6 +30,8 @@ def main():
...
@@ -28,6 +30,8 @@ def main():
port
=
PORT
port
=
PORT
if
sys
.
argv
[
1
:]:
if
sys
.
argv
[
1
:]:
host
=
sys
.
argv
[
1
]
host
=
sys
.
argv
[
1
]
if
host
==
'-b'
:
host
=
'<broadcast>'
if
sys
.
argv
[
2
:]:
if
sys
.
argv
[
2
:]:
port
=
eval
(
sys
.
argv
[
2
])
port
=
eval
(
sys
.
argv
[
2
])
...
@@ -41,10 +45,13 @@ def main():
...
@@ -41,10 +45,13 @@ def main():
wid
=
gl
.
winopen
(
'Vsend'
)
wid
=
gl
.
winopen
(
'Vsend'
)
gl
.
keepaspect
(
WIDTH
,
HEIGHT
)
gl
.
keepaspect
(
WIDTH
,
HEIGHT
)
gl
.
stepunit
(
8
,
6
)
gl
.
stepunit
(
8
,
6
)
gl
.
maxsize
(
SV
.
PAL_XMAX
,
SV
.
PAL_YMAX
)
gl
.
winconstraints
()
gl
.
winconstraints
()
gl
.
qdevice
(
DEVICE
.
ESCKEY
)
gl
.
qdevice
(
DEVICE
.
ESCKEY
)
gl
.
qdevice
(
DEVICE
.
WINSHUT
)
gl
.
qdevice
(
DEVICE
.
WINSHUT
)
gl
.
qdevice
(
DEVICE
.
WINQUIT
)
gl
.
qdevice
(
DEVICE
.
WINQUIT
)
gl
.
qdevice
(
DEVICE
.
WINFREEZE
)
gl
.
qdevice
(
DEVICE
.
WINTHAW
)
width
,
height
=
gl
.
getsize
()
width
,
height
=
gl
.
getsize
()
x
,
y
=
gl
.
getorigin
()
x
,
y
=
gl
.
getorigin
()
...
@@ -54,7 +61,9 @@ def main():
...
@@ -54,7 +61,9 @@ def main():
lvi
=
LiveVideoIn
.
LiveVideoIn
()
.
init
(
pktmax
,
width
,
height
)
lvi
=
LiveVideoIn
.
LiveVideoIn
()
.
init
(
pktmax
,
width
,
height
)
s
=
socket
(
AF_INET
,
SOCK_DGRAM
)
s
=
socket
(
AF_INET
,
SOCK_DGRAM
)
s
.
allowbroadcast
(
1
)
s
.
setsockopt
(
SOL_SOCKET
,
SO_BROADCAST
,
1
)
frozen
=
0
while
1
:
while
1
:
...
@@ -63,6 +72,10 @@ def main():
...
@@ -63,6 +72,10 @@ def main():
if
dev
in
(
DEVICE
.
ESCKEY
,
\
if
dev
in
(
DEVICE
.
ESCKEY
,
\
DEVICE
.
WINSHUT
,
DEVICE
.
WINQUIT
):
DEVICE
.
WINSHUT
,
DEVICE
.
WINQUIT
):
break
break
if
dev
==
DEVICE
.
WINFREEZE
:
frozen
=
1
if
dev
==
DEVICE
.
WINTHAW
:
frozen
=
0
if
dev
==
DEVICE
.
REDRAW
:
if
dev
==
DEVICE
.
REDRAW
:
w
,
h
=
gl
.
getsize
()
w
,
h
=
gl
.
getsize
()
x
,
y
=
gl
.
getorigin
()
x
,
y
=
gl
.
getorigin
()
...
@@ -83,7 +96,9 @@ def main():
...
@@ -83,7 +96,9 @@ def main():
continue
continue
pos
,
data
=
rv
pos
,
data
=
rv
lvo
.
putnextpacket
(
pos
,
data
)
if
not
frozen
:
lvo
.
putnextpacket
(
pos
,
data
)
hdr
=
struct
.
pack
(
'hhh'
,
pos
,
width
,
height
)
hdr
=
struct
.
pack
(
'hhh'
,
pos
,
width
,
height
)
s
.
sendto
(
hdr
+
data
,
(
host
,
port
))
s
.
sendto
(
hdr
+
data
,
(
host
,
port
))
...
...
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