00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00027
00029
00030 #ifndef __OGGFILEREADER_H__
00031 #define __OGGFILEREADER_H__
00032
00033 #include "H3DSoundFileNode.h"
00034
00035 #ifdef HAVE_LIBVORBIS
00036 #ifdef _MSC_VER
00037 #pragma comment( lib, "vorbisfile.lib" )
00038 #endif
00039 #include <vorbis/vorbisfile.h>
00040
00041 namespace H3D {
00042
00048 class H3DAPI_API OggFileReader : public H3DSoundFileNode {
00049 public:
00050
00052 OggFileReader() {}
00053
00055 ~OggFileReader() {
00056 ov_clear( &ogg_file );
00057 }
00058
00061 unsigned int load( const string &_url );
00062
00064 virtual H3DTime duration() {
00065 return ov_time_total( &ogg_file, -1 );
00066 }
00067
00069 virtual void reset() {
00070 ov_raw_seek( &ogg_file, 0 );
00071 }
00072
00074 virtual unsigned int totalDataSize() {
00075 return ov_raw_total( &ogg_file, -1 );
00076 }
00077
00080 virtual unsigned int nrChannels() {
00081 return info->channels;
00082 }
00083
00085 virtual unsigned int bitsPerSample() {
00086 return 16;
00087 }
00088
00093 virtual unsigned int read( char *buffer, unsigned int size );
00094
00097 virtual unsigned int samplesPerSecond() {
00098 return info->rate;
00099 }
00100
00103 static bool supportsFileType( const string &url );
00104
00106 static H3DNodeDatabase database;
00107
00109 static FileReaderRegistration reader_registration;
00110
00111 protected:
00112 OggVorbis_File ogg_file;
00113 vorbis_info* info;
00114 vorbis_comment *comment;
00115 string url;
00116 };
00117 }
00118
00119 #endif
00120 #endif