summaryrefslogtreecommitdiff
path: root/decoder.h
blob: a1d857f5e9b7aaf4f4d2eb243d5d06887913feae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef DECODER_H
#define DECODER_H

#include <boost/shared_ptr.hpp>

#include <string>

//! Interface for classes outputting raw audio.
class RawAudioSource {
	public:
		typedef boost::shared_ptr<RawAudioSource> p;
		
		//! Virtual destructor.
		virtual ~RawAudioSource() {}
		
		//! Read into provided buffer.
		virtual std::size_t read(char* buf, std::size_t buf_size) = 0;
};

//! Decoder base class.
class Decoder : public RawAudioSource {
	public:
		typedef boost::shared_ptr<Decoder> p;
		
		//! Initialize decoders.
		static void init();
		
		//! Construct and return requested decoder.
		static p get(const std::string& name, const std::string& filename);
};

#endif