Added options to Vsend and Vreceive; moved common defaults to senddefs.
Optimized LiveVideoIn quite a bit; removed print stmt from LiveVideoOut.
diff --git a/Demo/sgi/video/LiveVideoOut.py b/Demo/sgi/video/LiveVideoOut.py
index d9c1138..150e8a0 100755
--- a/Demo/sgi/video/LiveVideoOut.py
+++ b/Demo/sgi/video/LiveVideoOut.py
@@ -53,4 +53,5 @@
 		gl.winset(oldwid)
 
 	def close(self):
-		print 'Done video out'
+		##print 'Done video out'
+		pass
diff --git a/Demo/sgi/video/Vreceive.py b/Demo/sgi/video/Vreceive.py
index 415df59..334fe66 100755
--- a/Demo/sgi/video/Vreceive.py
+++ b/Demo/sgi/video/Vreceive.py
@@ -14,23 +14,43 @@
 sys.path.append('/ufs/guido/src/video')
 import LiveVideoOut
 import regsub
+import getopt
 
-MYGROUP = '225.0.0.250'
-PORT = 5555
+from senddefs import *
 
-PKTMAX = 16*1024
-WIDTH = 400
-HEIGHT = 300
+
+def usage(msg):
+	print msg
+	print 'usage: Vreceive [-m mcastgrp] [-p port]'
+	print '-m mcastgrp: multicast group (default ' + `DEFMCAST` + ')'
+	print '-p port    : port (default ' + `DEFPORT` + ')'
+	sys.exit(2)
+
 
 def main():
 
-	port = PORT
-	if sys.argv[1:]:
-		port = eval(sys.argv[1])
+	sys.stdout = sys.stderr
 
-	s = opensocket(MYGROUP, port)
+	group = DEFMCAST
+	port = DEFPORT
+	width = DEFWIDTH
+	height = DEFHEIGHT
 
-	width, height = WIDTH, HEIGHT
+	try:
+		opts, args = getopt.getopt(sys.argv[1:], 'm:p:')
+	except getopt.error, msg:
+		usage(msg)
+
+	try:
+		for opt, optarg in opts:
+			if opt == '-p':
+				port = string.atoi(optarg)
+			if opt == '-m':
+				group = gethostbyname(optarg)
+	except string.atoi_error, msg:
+		usage('bad integer: ' + msg)
+
+	s = opensocket(group, port)
 
 	gl.foreground()
 	gl.prefsize(width, height)
diff --git a/Demo/sgi/video/Vsend.py b/Demo/sgi/video/Vsend.py
index f38e965..e5154c0 100755
--- a/Demo/sgi/video/Vsend.py
+++ b/Demo/sgi/video/Vsend.py
@@ -1,11 +1,13 @@
 #!/ufs/guido/bin/sgi/python-405
 
 # Send live video UDP packets.
-# Usage: Vsend [host [port]]
+# Usage: Vsend [-b] [-h height] [-p port] [-s size] [-t ttl] [-w width]
+#              [host] ..
 
 import sys
 import time
 import struct
+import string
 from socket import *
 from SOCKET import *
 import gl, GL, DEVICE
@@ -13,37 +15,73 @@
 import LiveVideoIn
 import LiveVideoOut
 import SV
+import getopt
+from IN import *
 
-PKTMAX_UCAST = 16*1024 - 6
-PKTMAX_BCAST = 1450
-WIDTH = 400
-HEIGHT = 300
-HOST = '225.0.0.250' # Multicast address!
-PORT = 5555
+from senddefs import *
+
+def usage(msg):
+	print msg
+	print 'usage: Vsend [-b] [-h height] [-p port] [-s size] [-t ttl]',
+	print '[-w width] [host] ...'
+	print '-b        : broadcast on local net'
+	print '-h height : window height (default ' + `DEFHEIGHT` + ')'
+	print '-p port   : port to use (default ' + `DEFPORT` + ')'
+	print '-t ttl    : time-to-live (multicast only; default 1)'
+	print '-s size   : max packet size (default ' + `DEFPKTMAX` + ')'
+	print '-w width  : window width (default ' + `DEFWIDTH` + ')'
+	print '[host] ...: host(s) to send to (default multicast to ' + \
+		DEFMCAST + ')'
+	sys.exit(2)
+
 
 def main():
+	sys.stdout = sys.stderr
+
+	hosts = []
+	port = DEFPORT
+	ttl = -1
+	pktmax = DEFPKTMAX
+	width = DEFWIDTH
+	height = DEFHEIGHT
+
+	try:
+		opts, args = getopt.getopt(sys.argv[1:], 'bh:p:s:t:w:')
+	except getopt.error, msg:
+		usage(msg)
+
+	try:
+		for opt, optarg in opts:
+			if opt == '-p':
+				port = string.atoi(optarg)
+			if opt == '-b':
+				host = '<broadcast>'
+			if opt == '-t':
+				ttl = string.atoi(optarg)
+			if opt == '-s':
+				pktmax = string.atoi(optarg)
+			if opt == '-w':
+				width = string.atoi(optarg)
+			if opt == '-h':
+				height = string.atoi(optarg)
+	except string.atoi_error, msg:
+		usage('bad integer: ' + msg)
+
+	for host in args:
+		hosts.append(gethostbyname(host))
+
+	if not hosts:
+		hosts.append(gethostbyname(DEFMCAST))
+
 	if not LiveVideoIn.have_video:
-		print 'Sorry, no video (use python-405 on roos)'
+		print 'Sorry, no video available (use python-405 on roos)'
 		sys.exit(1)
 
-	host = HOST
-	port = PORT
-	if sys.argv[1:]:
-		host = sys.argv[1]
-		if host == '-b':
-			host = '<broadcast>'
-		if sys.argv[2:]:
-			port = eval(sys.argv[2])
-
-	if host == '<broadcast>':
-		pktmax = PKTMAX_BCAST
-	else:
-		pktmax = PKTMAX_UCAST
-
 	gl.foreground()
-	gl.prefsize(WIDTH, HEIGHT)
+	gl.prefsize(width, height)
+	gl.stepunit(8, 6)
 	wid = gl.winopen('Vsend')
-	gl.keepaspect(WIDTH, HEIGHT)
+	gl.keepaspect(width, height)
 	gl.stepunit(8, 6)
 	gl.maxsize(SV.PAL_XMAX, SV.PAL_YMAX)
 	gl.winconstraints()
@@ -62,6 +100,8 @@
 
 	s = socket(AF_INET, SOCK_DGRAM)
 	s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
+	if ttl >= 0:
+		s.setsockopt(IPPROTO_IP, IP_MULTICAST_TTL, chr(ttl))
 
 	frozen = 0
 
@@ -101,9 +141,16 @@
 			lvo.putnextpacket(pos, data)
 
 		hdr = struct.pack('hhh', pos, width, height)
-		s.sendto(hdr + data, (host, port))
+		for host in hosts:
+			try:
+				s.sendto(hdr + data, (host, port))
+			except error, msg: # really socket.error
+				if msg[0] <> 121: # no buffer space available
+					raise error, msg # re-raise it
+				print 'Warning:', msg[1]
 
 	lvi.close()
 	lvo.close()
 
+
 main()
diff --git a/Demo/sgi/video/senddefs.py b/Demo/sgi/video/senddefs.py
new file mode 100755
index 0000000..c3ce2cd
--- /dev/null
+++ b/Demo/sgi/video/senddefs.py
@@ -0,0 +1,11 @@
+# Defaults shared by Vsend and Vreceice
+
+DEFMCAST = '225.0.0.250'
+DEFPORT = 5555
+
+PKTMAX_UCAST = 16*1024 - 6
+PKTMAX_BCAST = 1450
+DEFPKTMAX = PKTMAX_BCAST
+
+DEFWIDTH = 400
+DEFHEIGHT = 300