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