summaryrefslogtreecommitdiff
path: root/localmms2stdout
blob: 24819761ec4dcc734891bfc403dc314a33552dfd (plain)
  1. #!/bin/sh
  2. #
  3. # Copyright © 2013 Jonas Smedegaard <dr@jones.dk>
  4. # Description: Re-stream MMS stream to stdout
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 3, or (at your option)
  9. # any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. # General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  19. # 02111-1307 USA.
  20. #
  21. # Depends: libav-tools
  22. set -e
  23. PRG=$(basename "$0")
  24. showhelp() {
  25. cat <<EOF
  26. Usage: $PRG STREAM
  27. Examples:
  28. $PRG bbc6 | mplayer -ignore-start -
  29. $PRG mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/6music/6music_bb_live_ep1_sl0
  30. Use pseudo-protocol mmsh:// for mms-over-http.
  31. EOF
  32. }
  33. exit1() {
  34. echo "ERROR: $1"
  35. exit 1
  36. }
  37. url=
  38. # TODO: resolve http redirections, Like BBC6:
  39. # http://sradio.tv/stream/489.m3u → http://www.bbc.co.uk/6music/ram/6music.asx
  40. # TODO: Add more shortnames than BBC6
  41. case "$1" in
  42. mmst:*|mmsh*) url="$1";;
  43. # http://www.bbc.co.uk/radio/listen/live/r1.asx
  44. bbc1) url=mms://wmlive-nonacl.bbc.net.uk/wms/bbc_ami/radio1/radio1_bb_live_int_ep1_sl0;;
  45. bbc1acl) url=mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/radio1/radio1_bb_live_ep1_sl0;;
  46. # http://www.bbc.co.uk/radio/listen/live/r2.asx
  47. bbc2) url=mms://wmlive-nonacl.bbc.net.uk/wms/bbc_ami/radio2/radio2_bb_live_int_ep1_sl0;;
  48. bbc3acl) url=mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/radio2/radio2_bb_live_ep1_sl0;;
  49. # http://www.bbc.co.uk/radio/listen/live/r2.asx
  50. bbc3) url=mms://wmlive-nonacl.bbc.net.uk/wms/bbc_ami/radio3/radio2_bb_live_int_ep1_sl0;;
  51. bbc3acl) url=mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/radio3/radio3_bb_live_ep1_sl0;;
  52. # http://www.bbc.co.uk/radio/listen/live/r4.asx
  53. bbc4) url=mms://wmlive-nonacl.bbc.net.uk/wms/bbc_ami/radio4/radio4_bb_live_int_ep1_sl1;;
  54. bbc4acl) url=mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/radio4/radio4_bb_live_ep1_sl0;;
  55. # http://www.bbc.co.uk/6music/ram/6music.asx
  56. bbc6) url=mms://wmlive-nonacl.bbc.net.uk/wms/bbc_ami/6music/6music_bb_live_int_ep1_sl0;;
  57. bbc6acl) url=mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/6music/6music_bb_live_ep1_sl0;;
  58. *) showhelp; exit1 "unknown or missing stream";;
  59. esac
  60. url=`echo "$url" | perl -pe 's/^mms:/mmst:/'`
  61. avconv -i "$url" -c copy -f avi pipe:1
  62. # alternative methods (needs mms:// protocol URLs)
  63. #mimms -q "$url" -
  64. #gst-launch -q mmssrc "location=$url" '!' fdsink fd=1