summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Gusakov <andrey.gusakov@cogentembedded.com>2014-08-29 14:43:52 +0400
committerDavid Herrmann <dh.herrmann@gmail.com>2014-09-03 08:11:03 +0200
commite7aa531dcaf576631dd48bd5193bc08c3e3b6c94 (patch)
treeb16fc530258e4c2d1fb1435772bebc0609dba827
parent5fabb386b8c4d49f202930ce19bff02bfed85d5a (diff)
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>
-rw-r--r--Makefile.am6
-rwxr-xr-xres/miracle-gst.sh57
-rw-r--r--src/ctl/ctl-sink.c2
-rw-r--r--src/ctl/sinkctl.c21
4 files changed, 66 insertions, 20 deletions
diff --git a/Makefile.am b/Makefile.am
index d42d946..d251817 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -196,6 +196,12 @@ miracled_LDADD = \
miracled_LDFLAGS = $(AM_LDFLAGS)
#
+# miracle-gst.sh
+#
+
+bin_SCRIPTS = res/miracle-gst.sh
+
+#
# Tests
#
diff --git a/res/miracle-gst.sh b/res/miracle-gst.sh
new file mode 100755
index 0000000..1b4ca51
--- /dev/null
+++ b/res/miracle-gst.sh
@@ -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}
diff --git a/src/ctl/ctl-sink.c b/src/ctl/ctl-sink.c
index bc32bf9..303103a 100644
--- a/src/ctl/ctl-sink.c
+++ b/src/ctl/ctl-sink.c
@@ -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);
diff --git a/src/ctl/sinkctl.c b/src/ctl/sinkctl.c
index f865b1d..1d25980 100644
--- a/src/ctl/sinkctl.c
+++ b/src/ctl/sinkctl.c
@@ -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);