blob: 474f2f1382569f48f475f38316bb69958e230e0c (
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
33
34
35
36
37
38
39
40
41
42
|
#ifndef DECODER_H
#define DECODER_H
#include <boost/shared_ptr.hpp>
#include <string>
//! Interface for classes outputting raw audio.
class RawAudioSource {
protected:
int samplerate;
int channels;
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;
//! Return sample rate.
int get_samplerate() { return samplerate; }
//! Return number of channels.
int get_channels() { return channels; }
};
//! 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
|