Author Topic: Fun With Shoutcast  (Read 3218 times)

ironstorm

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • http://
Fun With Shoutcast
« on: November 19, 2005, 03:42:46 am »
I'm running OZ 3.5.4RC...

I've been trying to employ my Z5500 as a shoutcast reciever to pump sound into my stereo.

Unfortunately, the state of shoutcast in OZ is somewhat weak...  That is to say neither XMMS (doesn't recognize streams at all) nor Opie-Player2 (crashes right away) can handle shoutcast streams.

This has forced me to fall back to the console, making use of mpg321...  And while mpg321 recognizes streams and plays them back, it also skips during playback...  I suspect either the Z is too slow or it suffers from the bug described here -> http://angerman.net/articles/jukebox/#mpg321 ...

Are there any other alternatives known to support shoutcast streams?

While we are at it is there any way to script volume changes?  

I used to use aumix in the old days, however trying it now just gives an error (SOUND_MIXER_READ_RECSRC) ...   I thought about trying to script the volume applet, but there is no documentation anywhere for it's support or lack of support for QCOP calls.  

Cheers,

-G

humit

  • Newbie
  • *
  • Posts: 27
    • View Profile
    • http://
Fun With Shoutcast
« Reply #1 on: November 19, 2005, 01:59:24 pm »
Hi,

I recommend to use mplayer to listen stream media, if you have mplayer running on your Z, you can play shoutcast streams.

Actually I'm planning to write some scripts when I got time to get the pls links from shoutcast site to search, list & play them.

To give some  quick&dirty hints, one can obtain the playlist urls on the frontapage of www.shoutcast.com with:

Code: [Select]
links -source www.shoutcast.com|grep shoutcast-playlist.pls|awk -F\" '{print "http://www.shoutcast.com"$6}'
it produces something like that:

Code: [Select]
http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=3281&file=filename.pls
http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=2297&file=filename.pls
http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=1346&file=filename.pls
http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=928&file=filename.pls

and this output could be used with mplayer (notice the double quotes)
Code: [Select]
mplayer -playlist "http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=8010&file=filename.pls"
the output from the command:
Code: [Select]
# mplayer -playlist "http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=8010&file=filename.pls"
MPlayer 1.0pre7-3.4.2 (C) 2000-2005 MPlayer Team
 for Zaurus 1.1.5 (C) 2004-2005 AGAWA Koji (atty)
CPU: ARM
CPUflags: iWMMXt

Resolving www.shoutcast.com for AF_INET...
Connecting to server www.shoutcast.com[207.200.98.25]:80 ...
Cache size set to 320 KBytes
Connected to server: www.shoutcast.com
Unknown entry type Version=2
85 audio & 196 video codecs
CommandLine: '-playlist' 'http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=8010&file=filename.pls'
Failed to open /dev/rtc: Device or resource busy (it should be readable by the user.)
Playing http://194.158.114.66:8000.
Connecting to server 194.158.114.66[194.158.114.66]:8000 ...
Name   : FREQUENCE3 - www.frequence3.fr - No ads ! It's only HITS live from Paris France ! - French Webradio
Genre  : Top 40 Dance Pop Rock
Website: http://www.frequence3.fr
Public : yes
Bitrate: 192kbit/s
Cache size set to 320 KBytes
Connected to server: 194.158.114.66
Cache fill: 17.50% (57344 bytes)    Audio file detected.
==========================================================================
Requested audio codec family [mp3] (afm=mp3lib) not available.
Enable it at compilation.
Opening audio decoder: [libmad] libmad mpeg audio decoder
AUDIO: 44100 Hz, 2 ch, s16le, 192.0 kbit/13.61% (ratio: 24000->176400)
Selected audio codec: [mad] afm:libmad (libMAD MPEG layer 1-2-3)
# mplayer -playlist "http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=3281&file=filename.pls"
MPlayer 1.0pre7-3.4.2 (C) 2000-2005 MPlayer Team
 for Zaurus 1.1.5 (C) 2004-2005 AGAWA Koji (atty)
CPU: ARM
CPUflags: iWMMXt

Resolving www.shoutcast.com for AF_INET...
Connecting to server www.shoutcast.com[207.200.98.25]:80 ...
Cache size set to 320 KBytes
Connected to server: www.shoutcast.com
Unknown entry type Version=2
85 audio & 196 video codecs
CommandLine: '-playlist' 'http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=3281&file=filename.pls'
Failed to open /dev/rtc: Device or resource busy (it should be readable by the user.)
Playing http://64.236.34.196:80/stream/1074.
Connecting to server 64.236.34.196[64.236.34.196]:80 ...
Name   : CLUB 977 The Hitz Channel (HIGH BANDWIDTH)
Genre  : Pop Rock Top 40
Website: http://www.hitsradio.com
Public : yes
Bitrate: 128kbit/s
Cache size set to 320 KBytes
Connected to server: 64.236.34.196
Cache fill: 17.50% (57344 bytes)    Audio file detected.
==========================================================================
Requested audio codec family [mp3] (afm=mp3lib) not available.
Enable it at compilation.
Opening audio decoder: [libmad] libmad mpeg audio decoder
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
Selected audio codec: [mad] afm:libmad (libMAD MPEG layer 1-2-3)
==========================================================================
Checking audio filter chain for 44100Hz/2ch/s16le -> 44100Hz/2ch/s16le...
AF_pre: 44100Hz/2ch/s16le
AO: [oss] 44100Hz 2ch s16le (2 bps)
Building audio filter chain for 44100Hz/2ch/s16le -> 44100Hz/2ch/s16le...
Video: no video
Starting playback...
A:   3.0 (03.0)  9.2% 16%                                                                                            

p.s: I tested this on my sl-C3000 but i think once you install the mplayer it runs on any Z.
SL-C3000 pdaXii13

lpotter

  • Sr. Member
  • ****
  • Posts: 450
    • View Profile
    • http://qtopia.net
Fun With Shoutcast
« Reply #2 on: November 20, 2005, 12:58:36 pm »
opieplayer (1) handles shoutcast streams
Software Engineer, Systems Group, MES, Trolltech
irc.freenode.net #qtopia
http://qtopia.net

ironstorm

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • http://
Fun With Shoutcast
« Reply #3 on: November 20, 2005, 02:06:19 pm »
Quote
p.s: I tested this on my sl-C3000 but i think once you install the mplayer it runs on any Z.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=104279\"][{POST_SNAPBACK}][/a][/div]

It installs on my z5500, starts up as if it's going to play, but all I get is 'click... click,click ...  click' as far sound goes....

With the screen being so small on the 5500, there's really not much use in a text browser...  so I stick with `wget -qO -` for pulling down html source...

Quote
opieplayer (1) handles shoutcast streams
[div align=\"right\"][a href=\"index.php?act=findpost&pid=104344\"][{POST_SNAPBACK}][/a][/div]

Yeah, I figured this out last night...   It seems its the only option that handles streams properly - it doesn't skip at all.  
It doesn't like remote playlists but it doesn't mind local playlists with remote streams, which is alright.

Wrote a script to start up the player using qcop:
Code: [Select]
#!/bin/sh

# XTC Radio
wget -qO - http://stream.xtcradio.com:8069/listen.pls > /tmp/playlist.pls
qcop QPE/Application/opieplayer 'setDocument(QString)' '/tmp/playlist.pls'

Apparently it supports the following QCOP commands:
Code: [Select]
qcop QPE/Application/opieplayer 'play()
qcop QPE/Application/opieplayer 'stop()
qcop QPE/Application/opieplayer 'togglePause()
qcop QPE/Application/opieplayer 'next()
qcop QPE/Application/opieplayer 'prev()
qcop QPE/Application/opieplayer 'toggleLooping()
qcop QPE/Application/opieplayer 'toggleShuffled()
qcop QPE/Application/opieplayer 'play(QString)' 'fullpath_to_local_audio_or_m3u_or_pls'
qcop QPE/Application/opieplayer 'add(QString)' 'fullpath_to_local_audio_or_m3u_or_pls'
qcop QPE/Application/opieplayer 'rem(QString)' 'fullpath_to_local_audio_or_m3u_or_pls'
qcop QPE/Application/opieplayer 'setDocument(QString)' 'fullpath_to_local_audio_or_m3u_or_pls'

It looks as if 'volUp()' & 'volDown()' might work given there close position inside the opieplayer binary (when using `strings` on it), however they don't seem to do anything when invoked.

So, I have no way as of yet to control volume/mute...  since aumix is broken and I can't figure out if VolumeApplet has any qcop interface...
« Last Edit: November 24, 2005, 09:10:30 am by ironstorm »

ironstorm

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • http://
Fun With Shoutcast
« Reply #4 on: November 27, 2005, 02:39:38 pm »
Thanks to rabies in the IRC channel, I found out why my Mplayer playback was failing, the default codec doesn't work on OZ3.5.4RC/Collie...

Code: [Select]
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, 16 bit (0x10), ratio: 20000->176400 (160.0 kbit)
Selected audio codec: [mp3] afm:mp3lib (mp3lib MPEG layer-2, layer-3)
^^^ - that's the default non-working codec...

Using:
Code: [Select]
mplayer -ac mad SONG_or_STREAM
forces the codec over to libmad:
Code: [Select]
Forced audio codec: mad
Opening audio decoder: [libmad] libmad mpeg audio decoder
AUDIO: 44100 Hz, 2 ch, 16 bit (0x10), ratio: 20000->176400 (160.0 kbit)
Selected audio codec: [mad] afm:libmad (libMAD MPEG layer 1-2-3)

which plays back local MP3s and remote shoutcast streams without any skipping.

I can control the volume using / (down),* (up), m (mute) ...  so I'm pretty happy with this solution for now.