[ale] semi OT: ideas about building a PVR/XPC
Michael D. Hirsch
mhirsch at nubridges.com
Wed Mar 5 17:11:35 EST 2003
On Wednesday 05 March 2003 02:18 pm, Joe wrote:
> "F. Grant Robertson" <f.g.robertson at alexiongroup.com> writes:
> > Storing Mp3's as blobs is an interesting way to do it, and I've done
> > that for images and flash files in some projects before. The main
> > problem with doing that for mp3's (from a scripting point of
> > view.. could be a completely different animal if you actually linked
> > libs to play the mp3's) is, how do you feed it to the player? The
> > simplest would be writing the blob out to a file in /tmp, playing it
> > and then deleting it but, this seems a little intense to me..
> > <brainstorming> can you feed an mp3 to mpg123 with a pipe?
>
> Sure. You can feed anything to anything via a pipe: the beauty of
> Un*x :-) (Provided, of course, all the things you're trying to
> plumb together produce output to standard output and accept
> input on standard input.)
>
> You should be able to do something like:
>
> mysql < [some script that barfs out the desired MP3 datastream] | mpg123
Yeah, this will work (I don't remember if mpg123 needs an argument to read
from sdtin, but otherwise okay) the a problem is that pipes have a very
limited buffer (2 or 4 K, I think). I don't know how mysql works, but
there is a danger of a thread somewhere blocking on the write until the
song is almost finished. But if everything is written corectly you can
certainly do that.
> I suspect, however, that pulling a file straight off the disk (as
> opposed to going through mysqld) would be best for streaming reads
> like this.
I agree, I think just saving the filename in the DB should suffice.
--Michael
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list