83 lines
2.6 KiB
Bash
Executable File
83 lines
2.6 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# IMPORTANT >>>>>You need to get port, ip and feed_id right<<<<<
|
|
if [ "X$SNOWMIX" = X ] ; then
|
|
echo "You need to set the SNOWMIX environment variable"
|
|
exit 1
|
|
fi
|
|
if [ "X$SNOWMIX_PORT" = X ] ; then export SNOWMIX_PORT=9999 ;fi
|
|
if [ "X$SNOWMIX_IP" = X ] ; then export SNOWMIX_IP=127.0.0.1 ;fi
|
|
|
|
if [ $# -lt 1 ] ; then
|
|
echo "Missing argument\nUsage $0 <audio feed id>"
|
|
exit 1
|
|
fi
|
|
|
|
# Set video feed and audio feed id
|
|
feed_id=$1;shift
|
|
|
|
feed_parts=(${feed_id//:/ })
|
|
moreargs=
|
|
|
|
if [[ ! -z "${feed_parts[1]}" ]]; then
|
|
feed_id=${feed_parts[0]}
|
|
moreargs="-sender-ip ${feed_parts[1]}"
|
|
fi
|
|
|
|
audio_feed_id=$feed_id
|
|
|
|
# Check for SNOWMIX variable and the snowmix and gstreamer settings
|
|
if [ ! -f "$SNOWMIX/scripts/gstreamer-settings" -o ! -f "$SNOWMIX/scripts/snowmix-settings" ] ; then
|
|
echo "Can not find the the file scripts/gstreamer-settings or scripts/snowmix-settings"
|
|
echo "in the directory set by the enviroment variable SNOWMIX"
|
|
echo "You need to se the environment variable SNOWMIX to the base of the Snowmix installed directory"
|
|
exit 1
|
|
fi
|
|
|
|
# Load the Snowmix and GStreamer settings
|
|
. $SNOWMIX/scripts/gstreamer-settings
|
|
. $SNOWMIX/scripts/snowmix-settings
|
|
# This will set
|
|
# a) feed_rate
|
|
# b) feed_channels
|
|
# c) feed_control_pipe
|
|
# d) feed_width
|
|
# e) feed_height
|
|
# f) ctrsocket
|
|
# g) system_width
|
|
# h) system_height
|
|
# i) ratefraction
|
|
# j) snowmix
|
|
# k) channels
|
|
# l) rate
|
|
|
|
|
|
if [ X$feed_control_pipe = X -o X$system_width = X -o X$system_height = X ] ; then
|
|
echo Failed to get control pipe or width or height from running snowmix
|
|
exit 1
|
|
fi
|
|
|
|
if [ X$feed_rate = X -o X$feed_channels = X ] ; then
|
|
echo Failed to get rate or channels from running snowmix
|
|
echo Disabling audio
|
|
else
|
|
echo "Audio rate and channels : $feed_rate $feed_channels"
|
|
fi
|
|
|
|
SHMSIZE='shm-size='`echo "$feed_width * $feed_height * 4 * 26"|bc`
|
|
SHMOPTION="wait-for-connection=1 sync=true"
|
|
SHMSINK1="shmsink socket-path=$feed_control_pipe $SHMSIZE $SHMOPTION"
|
|
#SCALE="$VIDEOCONVERT ! videoscale ! $VIDEOCONVERT"
|
|
SCALE="videoscale ! $VIDEOCONVERT"
|
|
AUDIOFORMAT="$AUDIOS16LE"', rate='$feed_rate', channels='$feed_channels
|
|
VIDEOFORMAT=$VIDEOBGRA', width='$feed_width', height='$feed_height', framerate='$ratefraction
|
|
VIDEOFORMAT=$VIDEOBGRA', width='$feed_width', height='$feed_height
|
|
|
|
(
|
|
echo 'audio feed ctr isaudio '$feed_id
|
|
/tools/de-ip-hdmi/de-ip-hdmi -output audio $moreargs $* | \
|
|
$gstlaunch -v fdsrc ! audio/x-raw,rate=48000,channels=2,format=S32BE ! \
|
|
queue ! audioconvert ! audioresample ! audiorate ! \
|
|
$AUDIOFORMAT ! fdsink fd=3 sync=true 3>&1 1>&2
|
|
) | nc -q0 $SNOWMIX_IP $SNOWMIX_PORT
|