Page 1 of 1

TVConfig with vdr and softhddevice

Posted: Tue Jun 05, 2012 8:30 pm
by mtron
Hello!

I guess you heard about the softhddevice plugin for vdr. I updated my vdr installation and i must say that i'm impressed. The plugin is very mature already and has a very good vdpau support (no more lags & crashes when watching HD channels!)

So i want to leave vdr-sxfe and settle with the softhddevice plugin. The plugin is started during boot (with vdr) and once i'm logged in to the desktop i bring up the vdr softhddevice window with

Code: Select all

svdrpsend -p 2001 plug softhddevice RESU


i tried to put this in /etc/mms/TVConfig but it does not work as expected.

Code: Select all

### TV ####

version = 1

# path of the tv program executable
#
tv_path = /usr/bin/svdrpsend -p 2001 plug softhddevice RESU

# options to pass to executeable
#
tvopts =


mms goes off fullscreen and the svdrpsend command is executed ok but mms goes again in the foreground after this so the new softhddevice window (with the tv picture in it) is in the background :(

How can i force mms to stay "out of the picture" as long as the softhddevice window is active?

Thanks for your help!

Re: TVConfig with vdr and softhddevice

Posted: Thu Jun 07, 2012 7:34 am
by lorenzodes
This probably means the command returns immediately and doesn't wait for the softhddevice window to close.

I don't use vdr myself, but I'll install it as soon as I get my PC fixed and see if I can post a patch or something.

Re: TVConfig with vdr and softhddevice

Posted: Tue Jun 12, 2012 8:01 am
by mtron
would appreciate that, thanks!

i thought of a hackish workaround with wmctl, but a patch to mms TV plugin would be a lot better!

Re: TVConfig with vdr and softhddevice

Posted: Tue Jun 12, 2012 9:57 am
by lorenzodes
mtron wrote:would appreciate that, thanks!

i thought of a hackish workaround with wmctl, but a patch to mms TV plugin would be a lot better!


Ugh... I suppose I'd need a DVD-T decoder or something... :cry:

Re: TVConfig with vdr and softhddevice

Posted: Sun Jun 17, 2012 10:14 am
by lorenzodes
Right. After an epic fail: I went to the shop to buy a DVB-T stick and bought the specific one that is not yet supported in Linux. Anyone needs a Mac/Win7 DVB-T stick? :roll:

Anyway, all is solved now (more or less), I have bought a second DVB-T stick and I have installed VDR.

I haven't installed any front-end yet, but now I know what svdrpsend is and why it will never work with mms.

Is svdrpsend the only way to launch the softhddevice plugin?

Re: TVConfig with vdr and softhddevice

Posted: Sat Jun 23, 2012 8:46 am
by mtron
yes.

vdr is started during boot with softhddevice as plugin. Softhddevice itself starts in detached (=off) mode. By sending the svdrp command the detached softhddevice can be attached to a specific screen.

So to start a brainstorm on possible solutions:

- make the mms tv plugin svdrp aware, so it could query vdr itself and attach / detach the Softhddevice

- or if svdrp is too much vdr specific we could use dbus (via vdr-plugin-dbus) to communicate with vdr and do the detaching / attaching

start:
vdr-dbus-send /Plugins/softhddevice plugin.SVDRPCommand string:'RESU'
vdr-dbus-send /Plugins/softhddevice plugin.SVDRPCommand string:'ATTA'

stop:
vdr-dbus-send /Plugins/softhddevice plugin.SVDRPCommand string:'DETA'

- use some window manager hacks to see if a softhddevice window is running (e.g with wmctl) and if one is detected put this in the foreground

Re: TVConfig with vdr and softhddevice

Posted: Sat Jun 23, 2012 9:49 am
by lorenzodes
Unfortunately it's not that easy.

The easier hack would be to start softhddevice the way you already do, then polling and parse the result of 'svdrpsend -p 2001 plug softhddevice STAT' every couple of second.
It's not ideal, but if it is acceptable for you, I could write and post a bash script that does that.

Re: TVConfig with vdr and softhddevice

Posted: Sat Jun 23, 2012 7:59 pm
by mtron
well, i guess this is sub-optimal. My current workaround is to start mms from vdr menu.

Would it be much work to extend the tv plugin (that is basically just a launcher currently) to "incorporate" the softhddevice window?

If it's too much work for one request, maybe someone might pick it up someday. But thanks for your help anyway ;)

Re: TVConfig with vdr and softhddevice

Posted: Sat Jun 23, 2012 10:28 pm
by lorenzodes
mtron wrote:well, i guess this is sub-optimal. My current workaround is to start mms from vdr menu.

Would it be much work to extend the tv plugin (that is basically just a launcher currently) to "incorporate" the softhddevice window?

If it's too much work for one request, maybe someone might pick it up someday. But thanks for your help anyway ;)


Yes, it's sub-optimal, but it would be hard for mms to do what you'd like.

This is the bash script I was talking about, it launches softhddevice and wait until it gets detached or in suspended mode.

Code: Select all

#!/bin/bash

VDRADDR=localhost
VDRPORT=2001

COMMAND="svdrpsend -p 2001 plug softhddevice RESU"

NETCAT=nc

NCPID=

INFIFO="/tmp/infifo.~"

OUTFIFO="/tmp/outfifo.~"

cleanup() {
  rm -f $INFIFO $OUTFIFO

  if [ x"$NCPID" != x ]; then
    kill $NCPID
  fi

  exit

}

trap cleanup SIGHUP
trap cleanup SIGTERM
trap cleanup SIGPIPE
trap cleanup SIGABRT
trap cleanup SIGTSTP
trap cleanup SIGCHLD
trap cleanup SIGSEGV
trap cleanup SIGINT

$COMMAND

mkfifo "$INFIFO"  || cleanup
mkfifo "$OUTFIFO" || cleanup


$NETCAT $VDRADDR $VDRPORT < $INFIFO > $OUTFIFO &

NCPID=$!

exec 3<>$INFIFO
exec 4<>$OUTFIFO

while read -u4 line ; do

  case "$line" in
    [0-9][0-9][0-9]-*)
      ;;

    220* | 910*)
      sleep 1
      echo -e "PLUG softhddevice STAT" >&3
      ;;

    909* | 911* | 912*)
      echo "softhddevice is now in suspended state"
      cleanup
      ;;

    *)
      echo "Unknown return code"
      cleanup
      ;;
  esac
done


It's untested, I don't use softhddevice, all I know about it is from the source code.