#include "decoder.h" #include "decoders/mpg123_decoder.h" #include "decoders/ffmpeg_decoder.h" #include #include #include typedef boost::function DecoderFactory; std::map decoder_factories; void Decoder::init() { mpg123_init(); // initialize the mpg123 library decoder_factories["mpg123"] = boost::factory >(); decoder_factories["ffmpeg"] = boost::factory >(); } Decoder::p Decoder::get(const std::string& name, const std::string& filename) { return decoder_factories[name](filename); }