blob: e80c714c952d376cf8116add8ec38a828e2e0176 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include "decoder.h"
#include "decoders/mpg123_decoder.h"
#include <map>
namespace decoder {
typedef boost::function<DecoderBase*()> DecoderFactory;
std::map<std::string, DecoderFactory> decoder_factories;
void init() {
mpg123_init(); // initialize the mpg123 library
decoder_factories["mpg123"] = boost::factory<DecoderMpg123*>();
}
DecoderBase *get_decoder(const std::string& name) {
return decoder_factories[name]();
}
};
|