<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 2014-02-02, at 12:00 PM, <a href="mailto:vorbis-request@xiph.org">vorbis-request@xiph.org</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Send Vorbis mailing list submissions to<br><span class="Apple-tab-span" style="white-space:pre">        </span><a href="mailto:vorbis@xiph.org">vorbis@xiph.org</a><br><br>To subscribe or unsubscribe via the World Wide Web, visit<br><span class="Apple-tab-span" style="white-space:pre">        </span>http://lists.xiph.org/mailman/listinfo/vorbis<br>or, via email, send a message with subject or body 'help' to<br><span class="Apple-tab-span" style="white-space:pre">        </span>vorbis-request@xiph.org<br><br>You can reach the person managing the list at<br><span class="Apple-tab-span" style="white-space:pre">        </span>vorbis-owner@xiph.org<br><br>When replying, please edit your Subject line so it is more specific<br>than "Re: Contents of Vorbis digest..."<br>Today's Topics:<br><br> &nbsp;&nbsp;1. Trouble implementing ov_callbacks,<span class="Apple-tab-span" style="white-space:pre">        </span>endless loop calling<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;seek_func (Rich E)<br><br><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(127, 127, 127, 1.0);"><b>From: </b></span><span style="font-family:'Helvetica'; font-size:medium;">Rich E &lt;reakinator@gmail.com&gt;<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(127, 127, 127, 1.0);"><b>Subject: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><b>[Vorbis] Trouble implementing ov_callbacks, endless loop calling seek_func</b><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(127, 127, 127, 1.0);"><b>Date: </b></span><span style="font-family:'Helvetica'; font-size:medium;">2 February, 2014 1:54:15 AM PST<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(127, 127, 127, 1.0);"><b>To: </b></span><span style="font-family:'Helvetica'; font-size:medium;">vorbis@xiph.org<br></span></div><br><br><div dir="ltr">Hello list,<div><br></div><div>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.</div>
<div><br></div><div>I'm hoping it is something obvious, but I can't see why my seek_func is being called endlessly. &nbsp;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:</div>
<div><br></div><div><div>size_t SourceFileImplOggVorbis::readFn( void *ptr, size_t size, size_t nmemb, void *datasource )<br></div><div>{</div><div><span class="" style="white-space:pre">        </span>auto sourceFile = (SourceFileImplOggVorbis *)datasource;</div>
<div><br></div><div><span class="" style="white-space:pre">        </span>size_t bytes = size * nmemb;</div><div><span class="" style="white-space:pre">        </span>sourceFile-&gt;mStream-&gt;readData( ptr, bytes );</div><div><br></div>
<div><span class="" style="white-space:pre">        </span>return nmemb;</div><div>}</div><div><br></div><div>int SourceFileImplOggVorbis::seekFn( void *datasource, ogg_int64_t offset, int whence )<br></div><div>{</div><div><span class="" style="white-space:pre">        </span>auto sourceFile = (SourceFileImplOggVorbis *)datasource;</div>
<div><br></div><div><span class="" style="white-space:pre">        </span>switch( whence ) {<br></div><div><span class="" style="white-space:pre">                </span>case SEEK_SET:</div><div><span class="" style="white-space:pre">                        </span>sourceFile-&gt;mStream-&gt;seekAbsolute( (off_t)offset );</div>
<div><span class="" style="white-space:pre">                        </span>break;</div><div><span class="" style="white-space:pre">                </span>case SEEK_CUR:</div><div><span class="" style="white-space:pre">                        </span>sourceFile-&gt;mStream-&gt;seekRelative( (off_t)offset );</div>
<div><span class="" style="white-space:pre">                        </span>break;</div><div><span class="" style="white-space:pre">                </span>case SEEK_END:</div><div><span class="" style="white-space:pre">                        </span>sourceFile-&gt;mStream-&gt;seekAbsolute( (off_t)( - offset ) );<br>
</div><div><span class="" style="white-space:pre">                        </span>break;</div><div><span class="" style="white-space:pre">                </span>default:</div><div><span class="" style="white-space:pre">                        </span>CI_ASSERT_NOT_REACHABLE();</div>
<div><span class="" style="white-space:pre">                        </span>return -1;</div><div><span class="" style="white-space:pre">        </span>}</div><div><br></div><div><span class="" style="white-space:pre">        </span>return 0;</div><div>}</div>
<div><br></div><div>int<span class="" style="white-space:pre">        </span>SourceFileImplOggVorbis::closeFn( void *datasource )<br></div><div>{</div><div><span class="" style="white-space:pre">        </span>return 0;</div><div>}</div>
<div><br></div><div>long SourceFileImplOggVorbis::tellFn( void *datasource )<br></div><div>{</div><div><span class="" style="white-space:pre">        </span>auto sourceFile = (SourceFileImplOggVorbis *)datasource;</div><div><br>
</div><div><span class="" style="white-space:pre">        </span>long pos = sourceFile-&gt;mStream-&gt;tell();</div><div><br></div><div><span class="" style="white-space:pre">        </span>return pos;<br></div><div>}</div></div><div><br>
</div><div>The source file for this code can also be <a href="https://github.com/richardeakin/Cinder-Audio2/blob/85126bdddc69110d6ea8bbd982bc11ff20d536d3/src/cinder/audio2/FileOggVorbis.cpp#L153">found here</a>.</div><div>
<br></div><div>Thanks a ton,</div><div>Rich</div></div>
<br><br>_______________________________________________<br>Vorbis mailing list<br>Vorbis@xiph.org<br>http://lists.xiph.org/mailman/listinfo/vorbis<br></blockquote></div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div>Robert Bailey</div><div><a href="mailto:rob@the-treehouse-studio.com">rob@the-treehouse-studio.com</a></div><div><br></div></span><br class="Apple-interchange-newline">
</div>
<br></body></html>