#ifndef __SOUNDSOURCE_H
#define __SOUNDSOURCE_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

#include "file.h"

typedef enum
{
	OPEN_FAILURE,
	OPEN_SUCCESS,
	OPEN_TRYAGAIN,
	OPEN_ANOTHERDECODER
} OpenStatus;

class SoundSource
{
	public:
		SoundSource();
		virtual ~SoundSource();
		
		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);
		
		void getFormat(char *fmt);
	protected:
		File *_sourceFile;
		
		int _length;
		char newFormat[64];
};

#ifdef __cplusplus
}
#endif

#endif
