[Vorbis-dev] Re: vorbis file decoding problems

Sam Man sam.manchali at gmail.com
Wed Jul 20 02:31:01 PDT 2005


> The summary is "open the file with 'rb' instead of just 'r'".
> 
> As for a rar, I can't view that.  perhaps just post a small code
> snippet to the list?
> 
> Monty
> 
yes , i have done that. 
Changes i have done 
1> i've also added a #define for  'inline' to '__inline'  in "misc.h" 
2> i've removed the #ifder for endianness, and i've only put the below
code for the union. but i dont think this will come into picture till
the file vorbis decoding actullay begins

union magic {
  struct {
    ogg_int32_t lo;
    ogg_int32_t hi;
  } halves;
  ogg_int64_t whole;
};

 3> Here is the code snippet i have added into the "ivorbisfile_example.c" file
ie. i've removed the 'stdin' and given a FILE pointer to the ov_open().
The file oprned sucessfully and also displayed the 'Ogg' string(i know
it will not display whole, just wanted to check if it displays the
"ogg" or not ie the start of file or not, It does display it so no
problem with fopen() )

//******************
  if( (ogg_file=fopen("song.ogg","rb"))== NULL )

      printf( "The file  song.ogg was not opened\n" );
   else
      printf( "The file song.ogg was opened\n" );

// for debugging if the ogg header was found at the start of file
 	   fscanf( ogg_file, "%s", &sa );
	   printf("%s",sa);

  //if(ov_open(stdin, &vf, NULL, 0) < 0) {
  
  if(ov_open(ogg_file, &vf, NULL, 0) < 0)  // Always returns -132 error
  {
      fclose(ogg_file);
      fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
      exit(1);
  }
//******************

My project file is in the current link, just checked it is working

http://sr2.mytempdir.com/89384

(it is a file sharing webpage, did not get any other place to upload it !)

Thanks and regards
Sam


More information about the Vorbis-dev mailing list