summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Gusakov <andrey.gusakov@cogentembedded.com>2014-07-31 14:41:01 +0400
committerDavid Herrmann <dh.herrmann@gmail.com>2014-09-03 08:11:13 +0200
commitdbf3972619e60f967d5729791a1d2ef925477fa2 (patch)
tree020d879ccaad8d73115b6a63991ca5a683a4a5c4
parente7aa531dcaf576631dd48bd5193bc08c3e3b6c94 (diff)
sink: add arguments to enable/disable audio and scaling
Forward the --audio and --scale arguments to our gst-spawn helper and parse them via bash for now. Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rwxr-xr-xres/miracle-gst.sh6
-rw-r--r--src/ctl/sinkctl.c23
2 files changed, 26 insertions, 3 deletions
diff --git a/res/miracle-gst.sh b/res/miracle-gst.sh
index 1b4ca51..9af81c9 100755
--- a/res/miracle-gst.sh
+++ b/res/miracle-gst.sh
@@ -4,7 +4,7 @@ DEBUG='0'
AUDIO='0'
SCALE='0'
-while getopts "d:as" optname
+while getopts "d:as:" optname
do
case "$optname" in
"d")
@@ -15,6 +15,8 @@ while getopts "d:as" optname
;;
"s")
SCALE='1'
+ WIDTH=`echo ${OPTARG} | tr -d ' ' | cut -dx -f 1`
+ HEIGHT=`echo ${OPTARG} | tr -d ' ' | cut -dx -f 2`
;;
"?")
echo "Unknown option $OPTARG"
@@ -43,7 +45,7 @@ RUN+="! queue max-size-buffers=0 max-size-time=0 ! h264parse ! avdec_h264 ! vide
if [ $SCALE == '1' ]
then
- RUN+="videoscale method=1 ! video/x-raw,width=1280,height=800 ! "
+ RUN+="videoscale method=1 ! video/x-raw,width=${WIDTH},height=${HEIGHT} ! "
fi
RUN+="autovideosink "
diff --git a/src/ctl/sinkctl.c b/src/ctl/sinkctl.c
index 1d25980..1bbbfc5 100644
--- a/src/ctl/sinkctl.c
+++ b/src/ctl/sinkctl.c
@@ -50,6 +50,9 @@ static char *bound_link;
static struct ctl_link *running_link;
static struct ctl_peer *running_peer;
+char *gst_scale_res;
+int gst_audio_en = 1;
+
/*
* cmd list
*/
@@ -354,6 +357,12 @@ static void spawn_gst(void)
argv[i++] = (char*) BUILD_BINDIR "/miracle-gst.sh";
if (cli_max_sev >= 7)
argv[i++] = "-d 3";
+ if (gst_audio_en)
+ argv[i++] = "-a";
+ if (gst_scale_res) {
+ argv[i++] = "-s";
+ argv[i++] = gst_scale_res;
+ }
argv[i] = NULL;
execve(argv[0], argv, environ);
@@ -546,9 +555,11 @@ void cli_fn_help()
" -h --help Show this help\n"
" --version Show package version\n"
" --log-level <lvl> Maximum level for log messages\n"
+ " --audio <0/1> Enable audio support (default %d)\n"
+ " --scale WxH Scale to resolution\n"
"\n"
"Commands:\n"
- , program_invocation_short_name);
+ , program_invocation_short_name, gst_audio_en);
/*
* 80-char barrier:
* 01234567890123456789012345678901234567890123456789012345678901234567890123456789
@@ -614,11 +625,15 @@ static int parse_argv(int argc, char *argv[])
enum {
ARG_VERSION = 0x100,
ARG_LOG_LEVEL,
+ ARG_AUDIO,
+ ARG_SCALE,
};
static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, ARG_VERSION },
{ "log-level", required_argument, NULL, ARG_LOG_LEVEL },
+ { "audio", required_argument, NULL, ARG_AUDIO },
+ { "scale", required_argument, NULL, ARG_SCALE },
{}
};
int c;
@@ -633,6 +648,12 @@ static int parse_argv(int argc, char *argv[])
case ARG_LOG_LEVEL:
cli_max_sev = atoi(optarg);
break;
+ case ARG_AUDIO:
+ gst_audio_en = atoi(optarg);
+ break;
+ case ARG_SCALE:
+ gst_scale_res = optarg;
+ break;
case '?':
return -EINVAL;
}