[vorbis-dev] FLAC support in ogg123
Stan Seibert
volsung at mailsnare.net
Sat Jan 11 17:32:00 PST 2003
On Sat, 2003-01-11 at 19:16, Josh Coalson wrote:
> --- Stan Seibert <volsung at mailsnare.net> wrote:
> > On Sat, 2003-01-11 at 18:48, Kenneth C. Arnold wrote:
> > Unfortunately, there is no seeking interface in libOggFLAC. Not to
> > mention the API makes it a little cumbersome to use the seeking
> > interface in some cases (like local files) and not others (http
> > streaming) without duplicating a lot of code.
>
> Stan, can you elucidate on this? I'm always open to
> suggestions.
>
> Seeking will be in libOggFLAC by flac 1.0.6.
Basically, this is the issue I found when using the FLAC APIs:
ogg123 has modular transport mechanisms--local files and http/ftp
streaming at the moment--and modular decoders--Ogg Vorbis, FLAC and Ogg
FLAC now. The transport mechanisms can either be seekable (like files)
or not (like http streams in the usual case). If the underlying stream
is seekable, then I need to do all of my handling with the
seekable_stream_decoder interface in libFLAC. However, if it isn't,
then I need to use the stream_decoder interface. In order to use
whichever applies to the given source stream, I found that I would need
a lot of code that would look something like:
if (stream_seekable)
{
FLAC__seekable_stream_decoder_foo()
FLAC__seekable_stream_decoder_baz()
FLAC__seekable_stream_decoder_bar()
etc...
}
else
{
FLAC__stream_decoder_foo()
FLAC__stream_decoder_baz()
FLAC__stream_decoder_bar()
etc...
}
Since at least 90% of the code would be be identical between the two
(with just the change s/seekable_stream_decoder/stream_decoder/), I'd
have a lot code duplication and possibility for introducing bugs by
updating one section and not making a parallel change in the other.
<p>My vote, would be for a more unified interface that "leaked" (to borrow
the term from the "leaky abstraction" guy) only in the cases where the
difference between seekable and non-seekable streams appeared.
vorbisfile does this by having an "operation not allowed" return value
on the seek functions.
I wrote a similar unifying layer for the FLAC and OggFLAC stream_decoder
interfaces that I called "EasyFLAC" so that I could transparently handle
FLAC and OggFLAC with the same API, like was possible in FLAC 1.0.3.
This was what I used in both this ogg123 enhancement and the oggenc
patch.
---
Stan Seibert
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Vorbis-dev
mailing list