X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Flib%2Fdecoder_factory.cc;h=f7f9f4074c52ae50c6e617d1bc22d967f44ff752;hb=23945ac9d84e2f77a08591604ec1244535548147;hp=56fb562961df38e4bcdeb090c60fc6770c2c1a43;hpb=bd8fa9a370f1739952c83107352baa08c79d095e;p=dcpomatic.git diff --git a/src/lib/decoder_factory.cc b/src/lib/decoder_factory.cc index 56fb56296..f7f9f4074 100644 --- a/src/lib/decoder_factory.cc +++ b/src/lib/decoder_factory.cc @@ -23,29 +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 namespace std; -using namespace boost; +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, bool ignore_length = false + shared_ptr f, DecodeOptions o ) { - if (filesystem::is_directory (f->content_path ())) { - /* Assume a directory contains TIFFs */ - return shared_ptr (new TIFFDecoder (f, o, j, minimal, ignore_length)); + 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) { - /* Always ignore length of decodes of stills, since the decoder finishes very quickly - and it's the encoder that takes the time. - */ - return shared_ptr (new ImageMagickDecoder (f, o, j, minimal, true)); + 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, ignore_length)); + + return Decoders (fd, shared_ptr (new SndfileDecoder (f, o))); }