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

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

#include <map>

EncoderFilter::EncoderFilter(EncoderBase::p encoder_) {
	encoder = encoder_;
}

typedef boost::function<boost::shared_ptr<EncoderBase>()> EncoderFactory;
std::map<std::string, EncoderFactory> encoder_factories;

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

EncoderFilter::p encoder::get_encoder(const std::string& name) {
	return EncoderFilter::p(new EncoderFilter(EncoderBase::p(encoder_factories[name]())));
}