[vorbis] Getting started with vorbisfile_example.c (MS VC 6)

Govind Kharbanda govind.kharbanda at sli-institute.ac.uk
Thu Jun 27 06:31:55 PDT 2002



Hi,

Thanks to James' detailed reply, we've had some success with
vorbisfile_example.c, but still there are a few minor problems.  See
inline comments:

James Boer wrote:

(stages 1-3 snipped)
 
> 4)  Copy vorbisfile_example.c over to your new project directory, and add it
> to your project.  If you've set up the include paths correctly, you should
> be able to compile, but you still shouldn't be able to link yet.

Done.  Compiles succesfully (right click on file, and choose Compile)

> 5)  Now you must tell your program to link with the Vorbis libraries.
> 
> Here are the library types and what they are used for:
> 
> ogg.lib                 Base library used for ogg projects.
> vorbis.lib              Low-level Vorbis decoding library.
> vorbisenc.lib   Low-level Vorbis encoding library.
> vorbisfile.lib  High-level Vorbis file reading library.
> 
> If you want to use the static version of the library instead of the dlls,
> append _static to the name.
> The debug versions have a _d appended to the file name.
> 
> Select Project | Settings, and look for the list of library names labelled
> "object/library modules".  Add the appropriate static libraries, which in
> this case are ogg_d.lib, vorbis_d.lib, and vorbisfile_d.lib.  Note that the
> debug version of the project is selected by default.  In the "Settings For"
> dropdown list (in the upper left corner of the dialog), Select Win32
> Release.  Now you can add ogg.lib, vorbis.lib, and vorbisfile.lib to the
> release version of your project.
> 
> If you wish to compile with the static libraries, you will need to perform
> one extra step.  Your project should be designated to use the multithreaded
> C-runtime dlls instead of the single-threaded static libraries, which are
> chosen by default.  Go to Project | Settings, and select the C++ tab.
> Select "Code Generation" from the Category list.  In the Run-time Library
> drop list, choose "Multhreaded Debug DLL" for the debug project, and
> "Multithreaded DLL" for release (don't forget to do both).
> 
> 6) Now copy the vorbis dlls to same directory your project resides at, or
> make sure it is somewhere in your Windows search path.  This is not
> necessary if you compiled with the static libraries, of course.
> 
> 6) Compile, link, and enjoy.

A) Using ogg_d.lib, vorbis_d.lib, vorbisfile_d.lib for debug project and
ogg.lib, vorbis.lib, vorbisfile.lib for release project.

Compiles and links succesfully.  Copy ogg.dll, vorbis.dll and
vorbisfile.dll into same directory as executable.  Running it produces
an MS-DOS window, Windows reports an error message:

vorbisfile_example.exe - Application Error

The instructions at "0x77f6cehc" refenrenced memory at "0x00000010". 
The memory could not be written.
Click on OK to terminate the application.
Click on Cancel to Debug the application.

We're using Windows NT 4 (on a Dell PC and also on a SunPCi card)

B) Using ogg_d.lib, vorbis_d.lib, vorbisfile_d.lib for debug project and
ogg_static.lib, vorbis_static.lib, vorbisfile_static.lib for release
project, and multithreaded C-runtime dlls designated under Project |
Settings > C++ tab for both debug and release.

Compiles and links succesfully.  Still requires above .dll files to
execute.  No errors.

This brings us onto actual operation of the program.  It takes a vorbis
bitstream from stdin (by this we assume the keyboard by default) and
writes raw pcm to stdout.  How do we set this up so the vorbis bitstream
is read from a file (assuming a vorbis file and a vorbis bitstream are
the same)?  Can we redefine stdin and stdout to point to file, or do we
have to code something like:

file * myfile;
myfile = fopen("C:\downloads\music.ogg","r");

if (ov_open(myfile, &vf, NULL, 0) < 0 {
  fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n);

The above code complains that the Input does not appear to be an Ogg
stream if we supply a standard .ogg file.

Also, as we are hardware engineers, our knowledge about dll's and static
libraries is limited.  We have tried a google search but didn't find
anything relevant. Could anybody direct us to a website which explains
their function, and what Windows uses them for?

Thanks for your help,

Cheers,
Gov


-- 
Govind S Kharbanda                Institute for System Level Integration
MSc Course Rep.                        Alba Campus, Livingston, EH54 7EG
http://www.sli-institute.ac.uk/~gk/                    Tel: 01506 469340

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.




More information about the Vorbis mailing list