summaryrefslogtreecommitdiff
path: root/encoder.cpp
blob: 9d352dc32ee76fbde954f73cac0f781dece378bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "encoder.h"
#include "encoders/lame_encoder.h"

#include <boost/function.hpp>
#include <boost/functional/factory.hpp>

#include <map>

typedef boost::function<Encoder::p (RawAudioSource::p)> EncoderFactory;
std::map<std::string, EncoderFactory> encoder_factories;

void Encoder::init() {
	encoder_factories["lame"] = boost::factory<boost::shared_ptr<EncoderLame> >();
}

Encoder::p Encoder::get(const std::string& name, RawAudioSource::p source) {
	return encoder_factories[name](source);
}