summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2011-03-29 10:18:23 (GMT)
committer Jaromil <jaromil@dyne.org>2011-03-29 10:20:02 (GMT)
commit5f78efae5c71cddfea38b1fc4479b000a0382824 (patch)
tree9c5b43fe5ed23a2c5ff9862a4cfa5d626fe3eef9
parentdfdc58484f94f6c373da4f08ffe1f372a574d72a (diff)
now using upnp to play
new upnp shell script going to substitute upnp-cmd for lower latency now time to test this...
-rw-r--r--scripts/S88hdsync8
-rwxr-xr-xscripts/assemble-app-bin.sh1
-rwxr-xr-xscripts/listen-sync.sh2
-rwxr-xr-xscripts/offer-sync.sh4
-rwxr-xr-xscripts/upnp.sh52
-rw-r--r--scripts/utils-sync.sh50
6 files changed, 66 insertions, 51 deletions
diff --git a/scripts/S88hdsync b/scripts/S88hdsync
index e3a3cb2..af9bc4d 100644
--- a/scripts/S88hdsync
+++ b/scripts/S88hdsync
@@ -20,7 +20,10 @@ sleep 15
APPROOT=/apps/hdsync
-USBROOT=`mount | awk '/.tmp.mnt/ { print $3}'`
+# USBROOT=`mount | awk '/.tmp.mnt/ { print $3}'`
+USBROOT=`cat /tmp/appsRoot | grep hdsync | sed 's/hdsync//`
+echo "HDSync app running on USB $USBROOT" > /tmp/hdsync.log
+date >> /tmp/hdsync.log
# if there is a custom osd, we have to wait longer
ls $USBROOT/ | grep 'osd.bin$'
@@ -29,7 +32,7 @@ if [ $? = 0 ]; then
fi
if ! [ -r $USBROOT/hdsync.conf ]; then
- echo "config file not found" > /tmp/hdsync.log
+ echo "config file not found" >> /tmp/hdsync.log
echo "place hdsync.conf in your usb key" >> /tmp/hdsync.log
exit 0
else
@@ -39,6 +42,7 @@ else
echo "sync role configured to: $SYNC_ROLE" >> $SYNC_LOG
fi
+export USBROOT
export APPROOT
export SYNC_LOG
export OFFER_SLEEP
diff --git a/scripts/assemble-app-bin.sh b/scripts/assemble-app-bin.sh
index 963925a..15b8284 100755
--- a/scripts/assemble-app-bin.sh
+++ b/scripts/assemble-app-bin.sh
@@ -41,6 +41,7 @@ if [ -z $1 ]; then
cp -v src/netcat $appdir/bin &&
cp -v src/broadcaster $appdir/bin &&
cp -v scripts/*-sync.sh $appdir/bin &&
+ cp -v scripts/upnp.sh $appdir/bin &&
cp -v scripts/S88hdsync $appdir/etc/init.d &&
chmod a+x $appdir/etc/init.d/S88hdsync &&
cp -v README $appdir &&
diff --git a/scripts/listen-sync.sh b/scripts/listen-sync.sh
index cef8480..0e00faa 100755
--- a/scripts/listen-sync.sh
+++ b/scripts/listen-sync.sh
@@ -69,7 +69,7 @@ while [ true ]; do
$NC -c -u -l -p 3336 -e true
# "press play on tape"
- echo "p" > /tmp/ir_injection; sleep 0.1
+ upnp.sh play
echo "sync playback started"
fi
diff --git a/scripts/offer-sync.sh b/scripts/offer-sync.sh
index 178ad16..7d351ed 100755
--- a/scripts/offer-sync.sh
+++ b/scripts/offer-sync.sh
@@ -75,10 +75,10 @@ while [ true ]; do
$BC $bcast 3336 s
# configurable wait step
- sleep $OFFER_SLEEP
+# sleep $OFFER_SLEEP
# "press play on tape"
- echo "p" > /tmp/ir_injection; sleep 0.1
+ upnp.sh play
echo "sync playback started"
diff --git a/scripts/upnp.sh b/scripts/upnp.sh
new file mode 100755
index 0000000..1875958
--- /dev/null
+++ b/scripts/upnp.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+# small upnp player in shell script, for WDLXTV
+# this is supposed to work faster than the upnp-cmd
+# needed to lower latency of operation in hdsync.app.bin
+
+# (C) 2011 by Jaromil - GNU GPL v3
+
+if [ -z $1 ]; then
+ echo "usage: $0 [command]"
+ echo "commands: load filename, play, stop, pause"
+ exit 0
+fi
+
+# make cmd case insensitive
+cmd="`echo $1 | tr '[:upper:]' '[:lower:]'`"
+
+case $cmd in
+
+ load)
+ file="$2"
+ if ! [ -r "$file" ]; then
+ echo "file not found: $file"
+ echo "operation aborted."; exit 1
+ fi
+ uri="file://$file"
+ upnp-cmd SetAVTransportURI "$uri"
+ # allowed NewPlayMode = "NORMAL", "REPEAT_ONE", "REPEAT_ALL", "RANDOM"
+ upnp-cmd SetPlayMode REPEAT_ONE
+ ;;
+
+ play)
+ upnp-cmd Play
+ ;;
+
+ stop)
+ upnp-cmd Stop
+ ;;
+
+ pause)
+ upnp-cmd Pause
+ ;;
+
+ *)
+ echo "unrecognized command: $cmd"
+ exit 1
+ ;;
+
+esac
+
+echo "command $cmd executed succesfully"
+exit 0
diff --git a/scripts/utils-sync.sh b/scripts/utils-sync.sh
index ca3c2e5..02de54f 100644
--- a/scripts/utils-sync.sh
+++ b/scripts/utils-sync.sh
@@ -48,51 +48,9 @@ get_netcat() {
}
prepare_play() {
-# poor man's syncstarting:
-# we emulate remote control commands
-#
-# we could do much better if this damn Sigma SDK would be open
-# but so far, so good.
-
- # go to the video from the initial menu position
- echo "r" > /tmp/ir_injection; sleep 1
- echo "r" > /tmp/ir_injection; sleep 1
- echo "r" > /tmp/ir_injection; sleep 2
+ file=`ls $USBROOT/sync`
+ upnp.sh load "$USBROOT/sync/$file"
+ upnp.sh play
+ upnp.sh pause
}
-switch_output() {
-
- type=$1
- case $type in
- hdmi)
- echo "u" > /tmp/ir_injection; sleep 0.5
- echo "r" > /tmp/ir_injection; sleep 0.5
- echo "r" > /tmp/ir_injection; sleep 0.5
- echo "n" > /tmp/ir_injection; sleep 0.5
- echo "d" > /tmp/ir_injection; sleep 0.5
- echo "d" > /tmp/ir_injection; sleep 0.5
- # set HDMI res and color to auto
- echo "n" > /tmp/ir_injection; sleep 0.5
- echo "n" > /tmp/ir_injection; sleep 0.5
- echo "n" > /tmp/ir_injection;
- sleep 2 # wait change and confirm selection
- echo "r" > /tmp/ir_injection; sleep 0.5
- echo "n" > /tmp/ir_injection;
- echo "video output switched to HDMI"
- ;;
-
- composite)
- echo "u" > /tmp/ir_injection; sleep 0.5
- echo "r" > /tmp/ir_injection; sleep 0.5
- echo "r" > /tmp/ir_injection; sleep 0.5
- echo "n" > /tmp/ir_injection; sleep 0.5
- # select composite default (PAL)
- echo "n" > /tmp/ir_injection; sleep 0.5
- echo "n" > /tmp/ir_injection; sleep 0.5
- echo "video output switched to HDMI"
- ;;
-
- *)
- echo "output selected not recognized: $type"
- esac
-}