summaryrefslogtreecommitdiff
path: root/encoder.cpp
blob: 0f2a5fee33666127e37aee62304cc5f3db0657a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#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<EncoderBase::p ()> EncoderFactory;
std::map<std::string, EncoderFactory> encoder_factories;

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

//! Construct a filter with the given encoder.
EncoderFilter::p encoder::get_encoder(const std::string& name) {
	return EncoderFilter::p(new EncoderFilter(encoder_factories[name]()));
}