<div dir="ltr"><div><div><div><div>Hi Miller,<br></div><br>On my windows machines (XP and 8.1), if I tried to open with mode 'r', the later call to ov_open would fail. If I change the mode to 'rb', the later call to ov_open works fine. I also read somewhere that the 'b' mode does nothing on Unix (I still have to test that when I'm back to my Linux and Mac machines).<br>
</div><br>As for the comparison against NULL, the original code was comparing <br><br>if((x->x_file = sys_fopen(filename->s_name, "r")) < 0)<br><br></div>And I changed it to <= instead. You are right in that it makes no sense to compare the sign of a pointer so == it is :)<br>
<br></div>R.<br><div><div><div><br></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Apr 5, 2014 at 9:03 AM, Miller Puckette <span dir="ltr"><<a href="mailto:msp@ucsd.edu" target="_blank">msp@ucsd.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I THink it should really be:<br>
<br>
if((x->x_file = sys_fopen(filename->s_name, "r")) == 0)<br>
<br>
sys_fopen returns NULL (also known as 0) on failure, otherwise a pointer;<br>
it makes no sense to check the sign of a pointer as far as I know.<br>
<br>
cheers<br>
<span class="HOEnZb"><font color="#888888">Miller<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Fri, Apr 04, 2014 at 11:21:37PM -0400, Martin Peach wrote:<br>
> I think it's here:<br>
><br>
> <a href="http://sourceforge.net/p/pure-data/patches/" target="_blank">http://sourceforge.net/p/pure-data/patches/</a><br>
><br>
> Martin<br>
><br>
> On 2014-04-04 21:49, Rafael Vega wrote:<br>
> >Even more stuff ;)<br>
> ><br>
> >In the same file, oggread~.c there is a line that reads:<br>
> ><br>
> > if((x->x_file = sys_fopen(filename->s_name, "r")) < 0)<br>
> ><br>
> >But it should be:<br>
> ><br>
> > if((x->x_file = sys_fopen(filename->s_name, "rb")) <= 0)<br>
> ><br>
> >Now, to figure out how to submit a patch to pd-extended :P<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> >On Fri, Apr 4, 2014 at 7:22 PM, Rafael Vega <<a href="mailto:email.rafa@gmail.com">email.rafa@gmail.com</a><br>
> ><mailto:<a href="mailto:email.rafa@gmail.com">email.rafa@gmail.com</a>>> wrote:<br>
> ><br>
> > Follow up:<br>
> ><br>
> > Looking at the code for oggread~, I found that it does the actual<br>
> > opening of the file with<br>
> ><br>
> > if(ov_open(x->x_file, &x->x_ov, NULL, -1) < 0)<br>
> ><br>
> > on the ov_open documentation it warns windows programmers not to use<br>
> > ov_open but ov_open_callbacks instead [1] and [2] so I changed that<br>
> > line to the following and I'm getting the message "Bitstream does<br>
> > not contain any Vorbis data". I'm pretty sure my file is a valid ogg<br>
> > file. I created it using audacity and also tried with an ogg file<br>
> > downloaded from <a href="http://freesound.org" target="_blank">freesound.org</a> <<a href="http://freesound.org" target="_blank">http://freesound.org</a>>.<br>
> ><br>
> > Any help with this will be very much appreciated<br>
> ><br>
> > :)<br>
> ><br>
> ><br>
> > int ret = ov_open_callbacks(x->x_file, &x->x_ov, NULL, -1,<br>
> > OV_CALLBACKS_DEFAULT);<br>
> > switch(ret){<br>
> > case OV_EREAD:<br>
> > post("A read from media returned an error.");<br>
> > break;<br>
> > case OV_ENOTVORBIS:<br>
> > post("Bitstream does not contain any Vorbis data");<br>
> > break;<br>
> > case OV_EVERSION:<br>
> > post("OV_EVERSION - Vorbis version mismatch.");<br>
> > break;<br>
> > case OV_EBADHEADER:<br>
> > post("Invalid Vorbis bitstream header.");<br>
> > break;<br>
> > case OV_EFAULT:<br>
> > post("Internal logic fault; indicates a bug or<br>
> > heap/stack corruption.");<br>
> > break;<br>
> > }<br>
> > if(ret <0)<br>
> ><br>
> ><br>
> ><br>
> > links:<br>
> ><br>
> > [1] <a href="http://xiph.org/vorbis/doc/vorbisfile/ov_open_callbacks.html" target="_blank">http://xiph.org/vorbis/doc/vorbisfile/ov_open_callbacks.html</a><br>
> > [2] <a href="http://xiph.org/vorbis/doc/vorbisfile/ov_open.html" target="_blank">http://xiph.org/vorbis/doc/vorbisfile/ov_open.html</a><br>
> ><br>
> ><br>
> ><br>
> > On Fri, Apr 4, 2014 at 5:48 PM, Rafael Vega <<a href="mailto:email.rafa@gmail.com">email.rafa@gmail.com</a><br>
> > <mailto:<a href="mailto:email.rafa@gmail.com">email.rafa@gmail.com</a>>> wrote:<br>
> ><br>
> > Hi.<br>
> ><br>
> > I am trying to use [oggread~] external on an application i'm<br>
> > developing with libpd. No problems on mac or linux. Howerver, on<br>
> > windows (xp and 8, 32bit) I keep getting an error message from<br>
> > oggread~ when I try to open an ogg file. Even ogg_read~-help.pd<br>
> > won't work:<br>
> ><br>
> > oggread~: file "C:/Users/rv/any.ogg" opened<br>
> > oggread~: error: could not open "C:/Users/rv/Desktop/any.ogg" as<br>
> > an OggVorbis file<br>
> > oggread~: file closed due to error<br>
> ><br>
> > I have tried pd-extended (both installer and standalone) and I<br>
> > also compiled oggread~ into my application and loaded it with<br>
> > libpd, same outcome.<br>
> ><br>
> > The weirdest part is that if I run pd vanilla, copy oggread~.dll<br>
> > from pd-extended into the "extra" directory, the ogg files are<br>
> > opened correctly.<br>
> ><br>
> > Any ideas on how to make this work? What kind of debug info can<br>
> > I provide?<br>
> ><br>
> > --<br>
> > Rafael Vega<br>
> > <a href="mailto:email.rafa@gmail.com">email.rafa@gmail.com</a> <mailto:<a href="mailto:email.rafa@gmail.com">email.rafa@gmail.com</a>><br>
> ><br>
> ><br>
> ><br>
> ><br>
> > --<br>
> > Rafael Vega<br>
> > <a href="mailto:email.rafa@gmail.com">email.rafa@gmail.com</a> <mailto:<a href="mailto:email.rafa@gmail.com">email.rafa@gmail.com</a>><br>
> ><br>
> ><br>
> ><br>
> ><br>
> >--<br>
> >Rafael Vega<br>
> ><a href="mailto:email.rafa@gmail.com">email.rafa@gmail.com</a> <mailto:<a href="mailto:email.rafa@gmail.com">email.rafa@gmail.com</a>><br>
> ><br>
> ><br>
> >_______________________________________________<br>
> >Pd-dev mailing list<br>
> ><a href="mailto:Pd-dev@iem.at">Pd-dev@iem.at</a><br>
> ><a href="http://lists.puredata.info/listinfo/pd-dev" target="_blank">http://lists.puredata.info/listinfo/pd-dev</a><br>
> ><br>
><br>
><br>
> _______________________________________________<br>
> Pd-dev mailing list<br>
> <a href="mailto:Pd-dev@iem.at">Pd-dev@iem.at</a><br>
> <a href="http://lists.puredata.info/listinfo/pd-dev" target="_blank">http://lists.puredata.info/listinfo/pd-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><div>Rafael Vega<br></div><a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a></div>
</div>