Example script OSC peer2peer

This commit is contained in:
Bruno Herbelin
2023-06-04 17:46:41 +02:00
parent 216d9a1686
commit 2223024383
2 changed files with 32 additions and 1 deletions

29
rsc/osc/vimix_connect.sh Normal file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
if [ -z "$1" ]
then
echo "Usage: "
echo $0 "<IP address> [PORT]"
exit 0
fi
if [ -z "$2" ]
then
PORT=9000
else
PORT=$2
fi
## 1. request to vimix
## Requires liblo-tools to be installed (Linux: apt install liblo-tools, OSX: brew install liblo)
oscsend $1 7000 /vimix/peertopeer/request i "$PORT"
## 2. start gstreamer client
## Requires gstreamer to be installed (Linux: apt install gstreamer1.0-tools, OSX: brew install gstreamer)
gst-launch-1.0 udpsrc port="$PORT" caps="application/x-rtp,media=(string)video,encoding-name=(string)JPEG" ! rtpjpegdepay ! queue ! decodebin ! videoconvert ! autovideosink sync=false
## if vimix is configured for H246 peer to peer, use this command instead:
## gst-launch-1.0 udpsrc port=9000 caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" ! queue ! rtph264depay ! h264parse ! decodebin ! videoconvert ! autovideosink sync=false
## 3. disconnect from vimix
oscsend $1 7000 /vimix/peertopeer/disconnect i "$PORT"

View File

@@ -1025,7 +1025,9 @@ void Control::receiveStreamAttribute(const std::string &attribute,
// remove prevous identical stream
Streaming::manager().removeStream(sender, port);
// add the requested stream to manager
Streaming::manager().addStream(sender, port, label == nullptr ? sender : label);
std::string clientname = label == nullptr ? sender.substr(0, sender.find_last_of(":")) : label;
clientname += " [" + std::to_string(port) + "]";
Streaming::manager().addStream(sender, port, clientname);
}
// Stream disconnection request /vimix/stream/disconnect
else if ( attribute.compare(OSC_STREAM_DISCONNECT) == 0 ) {