|
@@ -8,6 +8,15 @@ import threading
|
|
|
import os
|
|
import os
|
|
|
import stat
|
|
import stat
|
|
|
|
|
|
|
|
|
|
+WIDTH = 800
|
|
|
|
|
+HEIGHT = 600
|
|
|
|
|
+
|
|
|
|
|
+WIDTH = 500
|
|
|
|
|
+HEIGHT = 450
|
|
|
|
|
+
|
|
|
|
|
+SCREEN_WIDTH = 800
|
|
|
|
|
+SCREEN_HEIGHT = 600
|
|
|
|
|
+
|
|
|
def bus_call(bus, msg, *args):
|
|
def bus_call(bus, msg, *args):
|
|
|
if msg.type == Gst.MessageType.EOS:
|
|
if msg.type == Gst.MessageType.EOS:
|
|
|
print("End-of-stream")
|
|
print("End-of-stream")
|
|
@@ -25,8 +34,8 @@ def quit():
|
|
|
|
|
|
|
|
def set_preview(val):
|
|
def set_preview(val):
|
|
|
if val == 0:
|
|
if val == 0:
|
|
|
- videosrc.set_property("preview-x", 800)
|
|
|
|
|
- videosrc.set_property("preview-y", 600)
|
|
|
|
|
|
|
+ videosrc.set_property("preview-x", SCREEN_WIDTH)
|
|
|
|
|
+ videosrc.set_property("preview-y", SCREEN_HEIGHT)
|
|
|
else:
|
|
else:
|
|
|
videosrc.set_property("preview-x", 0)
|
|
videosrc.set_property("preview-x", 0)
|
|
|
videosrc.set_property("preview-y", 0)
|
|
videosrc.set_property("preview-y", 0)
|
|
@@ -39,7 +48,7 @@ def set_zoom(target):
|
|
|
direction = 1
|
|
direction = 1
|
|
|
|
|
|
|
|
target=min(target, 1)
|
|
target=min(target, 1)
|
|
|
- target=max(target, 0.50)
|
|
|
|
|
|
|
+ target=max(target, 0.40)
|
|
|
|
|
|
|
|
while abs(target-zoom) > 0.01: #fuck IEEE floats
|
|
while abs(target-zoom) > 0.01: #fuck IEEE floats
|
|
|
zoom = zoom + direction*0.015
|
|
zoom = zoom + direction*0.015
|
|
@@ -96,10 +105,13 @@ def control():
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|
|
|
|
|
+ if 'LD_LIBRARY_PATH' not in os.environ:
|
|
|
|
|
+ os.environ['LD_LIBRARY_PATH'] = '/usr/local/lib'
|
|
|
|
|
+ os.execv(sys.argv[0], sys.argv)
|
|
|
# initialization
|
|
# initialization
|
|
|
Gst.init(None)
|
|
Gst.init(None)
|
|
|
|
|
|
|
|
- videocodec = "queue ! video/x-h264, width=800, height=600, framerate=24/1, profile=high ! h264parse ! rtph264pay config-interval=1"
|
|
|
|
|
|
|
+ videocodec = "queue ! video/x-h264, width=%d, height=%d, framerate=25/1, profile=high ! h264parse ! rtph264pay mtu=1360 config-interval=1" % (WIDTH, HEIGHT)
|
|
|
p = "rpicamsrc do-timestamp=true name=src ! "+videocodec+" ! multiudpsink name=out"
|
|
p = "rpicamsrc do-timestamp=true name=src ! "+videocodec+" ! multiudpsink name=out"
|
|
|
pipeline = Gst.parse_launch (p)
|
|
pipeline = Gst.parse_launch (p)
|
|
|
if pipeline == None:
|
|
if pipeline == None:
|
|
@@ -108,15 +120,15 @@ if __name__ == "__main__":
|
|
|
|
|
|
|
|
videosrc = pipeline.get_by_name ("src")
|
|
videosrc = pipeline.get_by_name ("src")
|
|
|
videosrc.set_property("preview", 1)
|
|
videosrc.set_property("preview", 1)
|
|
|
- videosrc.set_property("preview-w", 800)
|
|
|
|
|
- videosrc.set_property("preview-h", 600)
|
|
|
|
|
|
|
+ videosrc.set_property("preview-w", WIDTH)
|
|
|
|
|
+ videosrc.set_property("preview-h", HEIGHT)
|
|
|
videosrc.set_property("fullscreen", False)
|
|
videosrc.set_property("fullscreen", False)
|
|
|
videosrc.set_property("bitrate", 900000)
|
|
videosrc.set_property("bitrate", 900000)
|
|
|
videosrc.set_property("rotation", 180)
|
|
videosrc.set_property("rotation", 180)
|
|
|
set_preview(0)
|
|
set_preview(0)
|
|
|
|
|
|
|
|
sink = pipeline.get_by_name ("out")
|
|
sink = pipeline.get_by_name ("out")
|
|
|
- sink.set_property("clients", ",".join(["192.168.2.120:5000"]))
|
|
|
|
|
|
|
+ sink.set_property("clients", ",".join(["192.168.2.120:5000", "192.168.2.208:5000", "192.168.2.84:5000"]))
|
|
|
print(sink.get_property("clients"))
|
|
print(sink.get_property("clients"))
|
|
|
|
|
|
|
|
# run
|
|
# run
|