streaming-docker/tools/lenkeng2feed

48 lines
1.7 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 to the base of the Snowmix installed directory"
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
# Check for the snowmix and gstreamer settings
if [ ! -f $SNOWMIX/scripts/gstreamer-settings -o ! -f $SNOWMIX/scripts/snowmix-settings ] ; then
echo "Can not find the scripts/gstreamer-settings or the scripts/snowmix-settings in the directory set by the SNOWMIX environment variable"
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
# Load the Snowmix and GStreamer settings
. $SNOWMIX/scripts/gstreamer-settings
. $SNOWMIX/scripts/snowmix-settings
SRC="fdsrc ! queue ! image/jpeg,framerate=30/1 ! jpegparse ! jpegdec"
# Settings for shmsink
SHMSIZE='shm-size='`echo "$feed_width * $feed_height * 4 * 20"|bc`
SHMOPTION="wait-for-connection=0 sync=true"
SHMSINK1="shmsink socket-path=$feed_control_pipe $SHMSIZE $SHMOPTION"
src_type=`echo $SRC | cut -f1 -d' '`
VIDEOFORMAT='video/x-raw,format=BGRA,pixel-aspect-ratio=1/1,interlace-mode=progressive,width='$feed_width',height='$feed_height
AUDIOFORMAT='audio/x-raw,format=S16LE,rate='$feed_rate',channels='$feed_channels
if [ -e $feed_control_pipe ] ; then rm $feed_control_pipe ; fi
echo "Video only. src = $src_type"
exec /tools/de-ip-hdmi/de-ip-hdmi $moreargs $* | gst-launch-1.0 \
$SRC !\
queue ! videoconvert ! $VIDEOFORMAT !\
queue ! $SHMSINK1