X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdecoder_factory.cc;h=f7f9f4074c52ae50c6e617d1bc22d967f44ff752;hb=db0ad7242d39f0fbae04bb6983021c60d57fdcf5;hp=287bba0da9b1759a638e9317be188c14d2ff764f;hpb=b7466a9653345bc51db4cb1d7e960bfc4c12721f;p=dcpomatic.git diff --git a/src/lib/decoder_factory.cc b/src/lib/decoder_factory.cc index 287bba0da..f7f9f4074 100644 --- a/src/lib/decoder_factory.cc +++ b/src/lib/decoder_factory.cc @@ -23,26 +23,38 @@ #include #include "ffmpeg_decoder.h" -#include "tiff_decoder.h" #include "imagemagick_decoder.h" #include "film.h" +#include "sndfile_decoder.h" +#include "decoder_factory.h" using std::string; +using std::pair; +using std::make_pair; using boost::shared_ptr; +using boost::dynamic_pointer_cast; -shared_ptr +Decoders decoder_factory ( - shared_ptr f, shared_ptr o, Job* j, bool minimal = false + shared_ptr f, DecodeOptions o ) { - if (boost::filesystem::is_directory (f->content_path ())) { - /* Assume a directory contains TIFFs */ - return shared_ptr (new TIFFDecoder (f, o, j, minimal)); + if (f->content().empty()) { + return Decoders (); + } + + if (boost::filesystem::is_directory (f->content_path()) || f->content_type() == STILL) { + /* A single image file, or a directory of them */ + return Decoders ( + shared_ptr (new ImageMagickDecoder (f, o)), + shared_ptr (new SndfileDecoder (f, o)) + ); } - if (f->content_type() == STILL) { - return shared_ptr (new ImageMagickDecoder (f, o, j, minimal)); + shared_ptr fd (new FFmpegDecoder (f, o)); + if (f->use_content_audio()) { + return Decoders (fd, fd); } - - return shared_ptr (new FFmpegDecoder (f, o, j, minimal)); + + return Decoders (fd, shared_ptr (new SndfileDecoder (f, o))); }