News:

Latest versions:
Server plugin: 0.5.1
MVP dongle: 0.5.2
Raspberry Pi client: 0.5.2
Windows client: 0.5.2-1

Main Menu

Trying to understand some mediaplayer stuff (test1.sh)

Started by rdoac, September 08, 2009, 22:16:31

Previous topic - Next topic

rdoac

I'm trying to stream BBC radio to the US.

My playlist is: bbcr4.radio

http://www.bbc.co.uk/radio/listen/live/r4.asx

I have added:

  Command.Name.29=/usr/src/vompserver-devenv/test1.sh
  Command.Extension.29=radio
  Command.Type.29=LIST
  Command.Name.30=/usr/src/vompserver-devenv/test1.sh
  Command.Extension.30=http-radio
  Command.Type.30=LIST

to vomp.conf

and :


    radio)
    convertradioList "$2"
    waitFkt
    ;;
    http-radio)
    fn=`echo "$2" | sed 's/\.[^.]*$//' | sed 's?^ */??'`
    createFifo
    convertradio_playlist "$fn"
    startReader
    waitFkt 1
    ;;

and

#convert a radio playlist
#handle http:// as radio-url
convertradioList() {
  cat "$1" 2>&1 | sed 's?^ *http:\(.*\)?/http:\1.http-radio?'
}

Finally, the stream calls:

convertradio_playlist() {

    url=`wget -q -O - "$1" 2>&1 | grep href -m 1 | awk -F \" '{printf $2}' | xargs echo`
    log url is $url
    log "create radio fifo"
    rm -fr /tmp/radio.wav
    mkfifo /tmp/radio.wav
    log "starting  mplayer -ao pcm:file=/tmp/radio.wav $url " 
    mplayer -ao pcm:file=/tmp/radio.wav $url > /tmp/mplayer.out 2>&1 &
    log "lame -b 192 -v /tmp/radio.wav $FIFO"
    lame -b 192 -v /tmp/radio.wav $FIFO >/tmp/lame.out 2>&1 &
    MPID=$!
}

Which almost works..


16194:Tue Sep  8 15:57:25 CDT 2009:started with param play /mnt/media/music/streams/bbcr4.radio
0 0
16194:Tue Sep  8 15:57:25 CDT 2009:sleepcommand=sleep 1
16194:Tue Sep  8 15:57:25 CDT 2009:start waiting for MPID= and FPID=
16194:Tue Sep  8 15:57:25 CDT 2009:leaving waitFkt
16194:Tue Sep  8 15:57:25 CDT 2009:trap received
16194:Tue Sep  8 15:57:25 CDT 2009:bg: started 16194 /tmp/vdrfifo16194
16194:Tue Sep  8 15:57:26 CDT 2009:bg: remove /tmp/vdrfifo16194
16194:Tue Sep  8 15:57:26 CDT 2009:bg: exiting
16217:Tue Sep  8 15:57:27 CDT 2009:started with param play /http://www.bbc.co.uk/radio/listen/li
ve/r4.asx.http-radio 0 0
16217:Tue Sep  8 15:57:27 CDT 2009:creating tmpfile /tmp/vdrfifo16217
16217:Tue Sep  8 15:57:33 CDT 2009:url is mms://wmlive.bbc.net.uk/wms/bbc_ami/radio4/radio4_bb_l
ive_int_eq1_sl0?BBC-UID=b4aa4a16bcd5a3cec3765eaa71092c2b61b484b19080d164546f2987e4339d05&SSO
2-UID=
16217:Tue Sep  8 15:57:33 CDT 2009:create radio fifo
16217:Tue Sep  8 15:57:33 CDT 2009:starting  mplayer -ao pcm:file=/tmp/radio.wav mms://wmlive.bb
c.net.uk/wms/bbc_ami/radio4/radio4_bb_live_int_eq1_sl0?BBC-UID=b4aa4a16bcd5a3cec3765eaa71092c2b6
1b484b19080d164546f2987e4339d05&SSO2-UID=
16217:Tue Sep  8 15:57:33 CDT 2009:lame -b 192 -v /tmp/radio.wav /tmp/vdrfifo16217
16217:Tue Sep  8 15:57:33 CDT 2009:readerPid=16246
16217:Tue Sep  8 15:57:33 CDT 2009:waiting 20 seconds to prebuffer
16217:Tue Sep  8 15:57:33 CDT 2009:bg: started 16217 /tmp/vdrfifo16217 16245 16246
16217:Tue Sep  8 15:57:36 CDT 2009:bg: remove /tmp/vdrfifo16217
16217:Tue Sep  8 15:57:36 CDT 2009:bg: kill 16245
16217:Tue Sep  8 15:57:36 CDT 2009:bg: kill 16246
16217:Tue Sep  8 15:57:36 CDT 2009:bg: exiting


However, it takes a few seconds before the stream arrives.  I think medialauncher is killing it before it has a chance:


15:57:27.485382 [debug]  MediaLauncher - found command /usr/src/vompserver-devenv/test1.sh to handle name /http://www.bbc.co.uk/radio/listen/live/r4.asx.http-radio
15:57:27.488337 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:27.589236 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:27.589318 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:27.693009 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:27.693085 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:27.796789 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:27.796871 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:27.900558 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:27.900637 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:28.004389 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:28.004471 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:28.108103 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:28.108228 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:28.211885 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:28.211968 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:28.315733 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:28.315840 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:28.419420 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:28.419499 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:28.523203 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:28.523280 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:28.626973 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:28.627052 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:28.730739 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:28.730818 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:28.834538 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:28.834688 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:28.938287 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:28.938367 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:29.042059 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:29.042139 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:29.145836 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:29.145916 [debug]  MediaLauncher - get Block buf (nil), len 2048
etc..
15:57:32.155254 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:32.155334 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:32.259027 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:32.259109 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:32.362801 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:32.362881 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:32.466575 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:32.466655 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:32.570343 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:32.570426 [debug]  MediaLauncher - get Block buf (nil), len 2048
15:57:32.674117 [debug]  MediaLauncher - read 0 bytes (no data within 100ms)
15:57:32.674195 [debug]  MediaLauncher - close stream for child 16217
15:57:32.674214 [debug]  MediaLauncher - trying to kill child 16217
15:57:34.474182 [debug]  MediaLauncher - child 16217 aktive after wait, kill -9


Any hints?  Avvdr?

avvdr

After a long time....
not sure whether you are still working on this.
Currently for audio there is a fixed number of retries for reading data - in audioplayer.cc on the client side - MAXTRIES (counts in ~100ms units). This is set to 50 - meaning app. 5 seconds until the stream gets closed.
So first you should switch of the prebuffer delay (waitFkt without the "1" parameter).
But I guess you need at the end more then 5s as the wget takes already 6s.
So a dirty trick (if you cannot change the client) would be to feed initially some silence- sound into the pipe that lasts for a short time - the 5s start again after an receive - so maybe:

http-radio)
    fn=`echo "$2" | sed 's/\.[^.]*$//' | sed 's?^ */??'`
    createFifo
    cat silence.mp3 > $FIFO &
    bgpid=$!
    convertradio_playlist "$fn"
    kill -9 $bgpid
    startReader
    waitFkt

not tested - but only an idea...
The silence.mp3 should be only the time you typically need for the wget+setting up mplayer-5s+someSecureAddOn.

BTW: can't you use mencoder to avoid the second FIFO? - would make converting easier...

regards
Andreas

rdoac

Thanks for the reply.  In the end I gave up and used IPTV to get it working..   However the 5 Second thing I can see would work..