On 2014-02-02, at 12:00 PM, vorbis-request at xiph.org wrote:
> Send Vorbis mailing list submissions to
> vorbis at xiph.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.xiph.org/mailman/listinfo/vorbis
> or, via email, send a message with subject or body 'help' to
> vorbis-request at xiph.org
>
> You can reach the person managing the list at
> vorbis-owner at xiph.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Vorbis digest..."
> Today's Topics:
>
> 1. Trouble implementing ov_callbacks, endless loop calling
> seek_func (Rich E)
>
> From: Rich E <reakinator at gmail.com>
> Subject: [Vorbis] Trouble implementing ov_callbacks, endless loop calling
seek_func
> Date: 2 February, 2014 1:54:15 AM PST
> To: vorbis at xiph.org
>
>
> Hello list,
>
> I've been having a tough time adding windows resource support to my ogg
vorbise decoder, although I think I am close. Basically when I call
ov_open_callbacks(), it doesn't ever return and repeatedly calls my
seek_func.
>
> I'm hoping it is something obvious, but I can't see why my
seek_func is being called endlessly. If the file is seekable, I should return
0, right? If any one can take a look at the following callback functions and see
if they can spot what I'm doing wrong, it'd be much appreciated:
>
> size_t SourceFileImplOggVorbis::readFn( void *ptr, size_t size, size_t
nmemb, void *datasource )
> {
> auto sourceFile = (SourceFileImplOggVorbis *)datasource;
>
> size_t bytes = size * nmemb;
> sourceFile->mStream->readData( ptr, bytes );
>
> return nmemb;
> }
>
> int SourceFileImplOggVorbis::seekFn( void *datasource, ogg_int64_t offset,
int whence )
> {
> auto sourceFile = (SourceFileImplOggVorbis *)datasource;
>
> switch( whence ) {
> case SEEK_SET:
> sourceFile->mStream->seekAbsolute( (off_t)offset );
> break;
> case SEEK_CUR:
> sourceFile->mStream->seekRelative( (off_t)offset );
> break;
> case SEEK_END:
> sourceFile->mStream->seekAbsolute( (off_t)( - offset ) );
> break;
> default:
> CI_ASSERT_NOT_REACHABLE();
> return -1;
> }
>
> return 0;
> }
>
> int SourceFileImplOggVorbis::closeFn( void *datasource )
> {
> return 0;
> }
>
> long SourceFileImplOggVorbis::tellFn( void *datasource )
> {
> auto sourceFile = (SourceFileImplOggVorbis *)datasource;
>
> long pos = sourceFile->mStream->tell();
>
> return pos;
> }
>
> The source file for this code can also be found here.
>
> Thanks a ton,
> Rich
>
>
> _______________________________________________
> Vorbis mailing list
> Vorbis at xiph.org
> http://lists.xiph.org/mailman/listinfo/vorbis
Robert Bailey
rob at the-treehouse-studio.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.xiph.org/pipermail/vorbis/attachments/20140202/184bdb4d/attachment.htm