X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdecoder_factory.cc;h=8674c6262e03aab9e940f3808d03940634d75e8d;hb=9c58fcdb6fd8131c17456dd71c5c277a6b0ae053;hp=c03912094a231df6300cd52a16c8bb24be293c0e;hpb=cb33319a820b17a05cfb2ef78ba1799f4d0c54b9;p=dcpomatic.git diff --git a/src/lib/decoder_factory.cc b/src/lib/decoder_factory.cc index c03912094..8674c6262 100644 --- a/src/lib/decoder_factory.cc +++ b/src/lib/decoder_factory.cc @@ -23,29 +23,34 @@ #include #include "ffmpeg_decoder.h" -#include "tiff_decoder.h" #include "imagemagick_decoder.h" -#include "film_state.h" +#include "film.h" +#include "external_audio_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 fs, shared_ptr o, Job* j, Log* l, bool minimal = false, bool ignore_length = false + shared_ptr f, shared_ptr o, Job* j ) { - if (filesystem::is_directory (fs->content_path ())) { - /* Assume a directory contains TIFFs */ - return shared_ptr (new TIFFDecoder (fs, o, j, l, minimal, ignore_length)); + 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, j)), + shared_ptr () + ); } - if (fs->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 (fs, o, j, l, minimal, true)); + shared_ptr fd (new FFmpegDecoder (f, o, j)); + if (f->use_content_audio()) { + return Decoders (fd, fd); } - - return shared_ptr (new FFmpegDecoder (fs, o, j, l, minimal, ignore_length)); + + return Decoders (fd, shared_ptr (new ExternalAudioDecoder (f, o, j))); }