OggVorbis player

Russell Penney lists at rustycoin.com.au
Mon Nov 14 09:06:17 UTC 2005


I was thinking along similar lines. Love the Squeak Codec source idea!

My thought would be to have a "priority" of a Resource so that you have a
known order of codecs to try. This would be useful when you ask for a
Resource from a URI. i.e. try JPEG, no?, try PNG, no?, try other image
types, no?, try TextCodec, no?, return ByteStreamCodec

Mix this with each Codec trying to sniff out if it can handle the stream
makes sense. Then the user only has to select from a list of Codec that
*can* handle it.

Russell

> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org [mailto:squeak-dev-
> bounces at lists.squeakfoundation.org] On Behalf Of Peter Crowther
> Sent: Monday, 14 November 2005 9:10 AM
> To: The general-purpose Squeak developers list
> Subject: RE: OggVorbis player
> 
> > From: [...] Russell Penney
> > *Signatures*
> > How do you identify a file (rather than something that has a
> > MIME type) as being a certain type?
> 
> Allow each codec to sniff it and bid for handling it.  Many, though not
> all, formats have some form of header at the start of the stream.  It's
> typically small.
> 
> A possible algorithm:
> 
> Read in (say) 1k of the stream and pass it to each registered codec.
> The codec returns one status from 'I can cope with this', 'I can't cope
> with this', 'I might be able to cope with this but require xxx bytes
> more information to make an informed decision' or 'I don't have a header
> so can't tell'.
> 
> - If exactly one codec can cope with the format, use that codec.
> 
> - If more than one codec can cope with the format, choose one by some
> means (might even ask the user) and use that codec.
> 
> - If no codecs can cope with the format but one or more need more
> information, feed them the extra information (if possible) and go round
> again with just the codecs that might be able to cope or can cope with
> anything.  If that's not possible, prompt the user or perform some other
> algorithm for selecting an essentially random codec :-).
> 
> - If no codecs can cope even after asking for more information, but one
> or more codec can't tell, ask the user then try to use that codec.
> Asking the user is polite; for example a .au codec will play any old
> byte-stream but the user's ears may not appreciate the result.
> 
> - If no codecs match or the user has declined everything thus far, tell
> 'em to go to <insert central source server here> and download a suitable
> codec.  If we're *really* smart, make that a Squeak-based server; pass
> up the header information and let it do the same process with all the
> codecs it knows, then offer one for download.
> 
> Disclaimers: Untested, late at night, too much beer and too little
> coffee, etc.
> 
> 		- Peter






More information about the Squeak-dev mailing list