#ifndef __VORBISSOURCE_H
#define __VORBISSOURCE_H

#ifdef __cplusplus
extern "C" {
#endif

#include "soundsource.h"
#include "vorbis/codec.h"
#include "vorbis/vorbisfile.h"

class VorbisSource : public SoundSource
{
	public:
		VorbisSource();
		virtual ~VorbisSource();
		
		virtual OpenStatus openLocation(File *sourceFile);
		virtual int renderChunk(uint8_t *buf, int &renderSamples);
		virtual void seekSeconds(int seconds);
		virtual int tellSeconds();
		virtual int getLength();
		virtual uint32_t getFrequency();
		virtual void close();
		virtual void readAhead();
		
		virtual void getNowPlaying(const char *fmtString, char *output);
		virtual int supportsFormat(const char *ext);
	private:
		OggVorbis_File vf;
		vorbis_info *vi;
		
		int opened;
		int rendered;
};

#ifdef __cplusplus
}
#endif

#endif
