1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-02-12 15:51:59 +00:00

sink: move GST pipeline construction to bash script

The sinkctl tool is currently a hack to make Miracast sinks work. The
embedded gst-launch invocation is kinda ugly to handle. Move it into a
bash-script so we can experiment a bit more with different pipelines.
Ultimatively, the goal is obviously to make this work as its own gst
element.

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
This commit is contained in:
Andrey Gusakov 2014-08-29 14:43:52 +04:00 committed by David Herrmann
parent 5fabb386b8
commit e7aa531dca
4 changed files with 66 additions and 20 deletions

View file

@ -195,6 +195,12 @@ miracled_LDADD = \
$(DEPS_LIBS)
miracled_LDFLAGS = $(AM_LDFLAGS)
#
# miracle-gst.sh
#
bin_SCRIPTS = res/miracle-gst.sh
#
# Tests
#

57
res/miracle-gst.sh Executable file
View file

@ -0,0 +1,57 @@
#!/bin/bash
DEBUG='0'
AUDIO='0'
SCALE='0'
while getopts "d:as" optname
do
case "$optname" in
"d")
DEBUG=`echo ${OPTARG} | tr -d ' '`
;;
"a")
AUDIO='1'
;;
"s")
SCALE='1'
;;
"?")
echo "Unknown option $OPTARG"
;;
*)
# Should not occur
echo "Unknown error while processing options"
;;
esac
done
RUN="/usr/bin/gst-launch-1.0 -v "
if [ $DEBUG != '0' ]
then
RUN+="--gst-debug=${DEBUG} "
fi
RUN+="udpsrc port=1991 caps=\"application/x-rtp, media=video\" ! rtpjitterbuffer latency=100 ! rtpmp2tdepay ! tsdemux "
if [ $AUDIO == '1' ]
then
RUN+="name=demuxer demuxer. "
fi
RUN+="! queue max-size-buffers=0 max-size-time=0 ! h264parse ! avdec_h264 ! videoconvert ! "
if [ $SCALE == '1' ]
then
RUN+="videoscale method=1 ! video/x-raw,width=1280,height=800 ! "
fi
RUN+="autovideosink "
if [ $AUDIO == '1' ]
then
RUN+="demuxer. ! queue max-size-buffers=0 max-size-time=0 ! aacparse ! avdec_aac ! audioconvert ! audioresample ! autoaudiosink "
fi
echo "running: $RUN"
exec ${RUN}

View file

@ -123,7 +123,7 @@ static void sink_handle_get_parameter(struct ctl_sink *s,
r = rtsp_message_append(rep, "{&&&&}",
"wfd_content_protection: none",
"wfd_video_formats: 00 00 01 01 0000007f 003fffff 00000000 00 0000 0000 00 none none",
"wfd_audio_codecs: LPCM 00000003 00",
"wfd_audio_codecs: AAC 00000007 00",
"wfd_client_rtp_ports: RTP/AVP/UDP;unicast 1991 0 mode=play");
if (r < 0)
return cli_vERR(r);

View file

@ -351,26 +351,9 @@ static void spawn_gst(void)
}
i = 0;
argv[i++] = (char*) "/usr/bin/gst-launch-1.0";
argv[i++] = "-v";
argv[i++] = (char*) BUILD_BINDIR "/miracle-gst.sh";
if (cli_max_sev >= 7)
argv[i++] = "--gst-debug=3";
argv[i++] = "udpsrc";
argv[i++] = "port=1991";
argv[i++] = "caps=\"application/x-rtp, media=video\"";
argv[i++] = "!";
argv[i++] = "rtpjitterbuffer";
argv[i++] = "!";
argv[i++] = "rtpmp2tdepay";
argv[i++] = "!";
argv[i++] = "tsdemux";
argv[i++] = "!";
argv[i++] = "h264parse";
argv[i++] = "!";
argv[i++] = "avdec_h264";
argv[i++] = "!";
argv[i++] = "autovideosink";
argv[i++] = "sync=false";
argv[i++] = "-d 3";
argv[i] = NULL;
execve(argv[0], argv, environ);