As you can see in my read an mp3 stream and save tracks using icy-metaint (ICY protocol) i was able to succesfully read an mp3 stream cutting it at icy-mataint occurences and also able to (possibly) skip advertisements.
Now, and was my original goal, I want to reproduce this stream and I found that all modules I investigated need a file while I have a stream.
If you take a look at my above mentioned code, I just read froma a socket by chunk and, in the read_stream sub, I get $buf populated with just the music (no metadata) and I pass $buf to the write_stream sub.
So my original idea was to push all these $buf into something like a big cache and have some other sub shifting such cache and play each chunk..
Some help on how to implement it? ;=) I'd like a perl solution, portable as much as it is possible (you know I mainly work on win32..): so using external programs as'mpeg123' and similar are not what i'm searching for. Until now I have mumbled the following:
1 - tempfile)As all modules (and programs too) I investigated, needs to be feed with a file, it will be possible to have a temp file and append to it. It's not a optimal solution: how to know how much of the the neverending file was already played? how to rotate it?
2 - reproxing) Once i have $buf i can re-stream them using a local server listening on 127.0.0.1 and launch an external program (like vlc or you preferred one) to connect to such stream to play it. This is an overcomplicated solution..
The only module I found that seems able to play music contained in a variable is SDL::Mixer::Music that can receive data via SDL::RWOps but I was not able to make it to run. Examples in this direction will be appreciated. I suppose SDL has some limitation playing mp3 on windows (missing libraries?) I had success only playing wav files (not varibles with wav inside).
Form the SDL::Mixer::Music documentation
use SDL; use SDL::Mixer; use SDL::Mixer::Music; use SDL::RWOps; my $rwops = SDL::RWOps->new_const_mem( $scalar_holding_music ); my $music = SDL::Mixer::Music::load_MUS_RW( $rwops );
Any help and suggestion will be very much appreciated
L*
In reply to play mp3 stream (music) portably by Discipulus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |