summaryrefslogtreecommitdiff
path: root/decoder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'decoder.cpp')
-rw-r--r--decoder.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/decoder.cpp b/decoder.cpp
new file mode 100644
index 0000000..e80c714
--- /dev/null
+++ b/decoder.cpp
@@ -0,0 +1,19 @@
+#include "decoder.h"
+#include "decoders/mpg123_decoder.h"
+
+#include <map>
+
+namespace decoder {
+ typedef boost::function<DecoderBase*()> DecoderFactory;
+ std::map<std::string, DecoderFactory> decoder_factories;
+
+void init() {
+ mpg123_init(); // initialize the mpg123 library
+ decoder_factories["mpg123"] = boost::factory<DecoderMpg123*>();
+}
+
+DecoderBase *get_decoder(const std::string& name) {
+ return decoder_factories[name]();
+}
+
+};