Time label.
[dcpomatic.git] / src / lib / decoder_factory.cc
index e9b5bfa9e755682f5d4bf72e1dba2b5c31dbadea..478ccd1c18da55d155ab439270b3fa4b90a1b260 100644 (file)
 #include "imagemagick_decoder.h"
 #include "film.h"
 #include "external_audio_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;
 
-pair<shared_ptr<VideoDecoder>, shared_ptr<AudioDecoder> >
+Decoders
 decoder_factory (
-       shared_ptr<Film> f, shared_ptr<const Options> o, Job* j
+       shared_ptr<Film> f, DecodeOptions o
        )
 {
+       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 make_pair (
-                       shared_ptr<VideoDecoder> (new ImageMagickDecoder (f, o, j)),
-                       shared_ptr<AudioDecoder> ()
+               return Decoders (
+                       shared_ptr<VideoDecoder> (new ImageMagickDecoder (f, o)),
+                       shared_ptr<AudioDecoder> (new ExternalAudioDecoder (f, o))
                        );
        }
 
-       shared_ptr<FFmpegDecoder> fd (new FFmpegDecoder (f, o, j));
+       shared_ptr<FFmpegDecoder> fd (new FFmpegDecoder (f, o));
        if (f->use_content_audio()) {
-               return make_pair (fd, fd);
+               return Decoders (fd, fd);
        }
-       
-       return make_pair (fd, shared_ptr<AudioDecoder> (new ExternalAudioDecoder (f, o, j)));
+
+       return Decoders (fd, shared_ptr<AudioDecoder> (new ExternalAudioDecoder (f, o)));
 }