diff options
Diffstat (limited to 'encoder.cpp')
-rw-r--r-- | encoder.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/encoder.cpp b/encoder.cpp index 9bea59b..d0566fb 100644 --- a/encoder.cpp +++ b/encoder.cpp @@ -3,16 +3,17 @@ #include <map> -namespace encoder { - typedef boost::function<EncoderBase*()> EncoderFactory; - std::map<std::string, EncoderFactory> encoder_factories; - -void init() { - encoder_factories["lame"] = boost::factory<EncoderLame*>(); +EncoderFilter::EncoderFilter(EncoderBase::p encoder_) { + encoder = encoder_; } -EncoderBase *get_encoder(const std::string& name) { - return encoder_factories[name](); +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]()))); +} |