#include "decoder.h" #include "decoders/mpg123_decoder.h" #include #include #include DecoderFilter::DecoderFilter(DecoderBase::p decoder_) { decoder = decoder_; } typedef boost::function()> DecoderFactory; std::map decoder_factories; void decoder::init() { mpg123_init(); // initialize the mpg123 library decoder_factories["mpg123"] = boost::factory >(); } DecoderFilter::p decoder::get_decoder(const std::string& name) { return DecoderFilter::p(new DecoderFilter(DecoderBase::p(decoder_factories[name]()))); }