[vorbis-dev] Yet another vf question...
John Morton
jwm at eslnz.co.nz
Tue Dec 16 20:11:18 PST 2003
On Wednesday 17 December 2003 14:16, Michael Smith wrote:
> On Tuesday 16 December 2003 18:48, John Morton wrote:
> > Should I ov_clear a failed ov_open/test/test_open call?
>
> No. I _think_ vorbisfile internally does this on failure, you shouldn't
> repeat it (but it should be harmless?).
A close look into the source shows that ov_clear is called inside _ov_open1
and _ov_open2, so it's not necessary.
> > The xmms plugin does an fclose on failure, and that seems to work, but I
> > thought I ought to know for certain.
>
> Shouldn't be neccesary, should be fairly harmless.
>
> > (An observation: I think the quantity of questions and bugs raised along
> > the lines of "I did open file, ov_open, ov_read, close file, open
> > another file, ov_read, and it exploded", or "I tried to make vorbisfile
> > go in [some language with a deceptively C like stdio] and it didn't
> > work" are probably due to the asymmetry in the callback set - there are
> > callback hooks for read, seek, tell and close, but none for open. Is
> > there any particular reason for this? (I realize it's to late in the day
> > to fix the API in any fashion, but it's possible that oggfile might be
> > able to avoid this API usability flaw.))
>
> There's no good reason for an open callback, really. I would argue that
> close doesn't really belong in vorbisfile either, Monty disagrees (and I
> don't feel strongly on that point). It's relatively difficult to do it
> sensibly, too - opening a generic
> byte-source-object-which-might-be-filelike-but-might-not can be fairly
> complex, fopen() like parameters would probably be
> insufficient.
I think you're probably right. I think symetry in the callbacks would be a
good thing so avoiding a close callback would be good. It's either that or a
lot of documentation reminding people they need to do something a little
conterintuitive.
I'll add writing a documentation patch to the list of things to do.
(the ov_read_float bug is in the tracker as 493, FYI).
John
--- >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