Change MagickImageProxy to FFmpegImageProxy and make it use FFmpeg
[dcpomatic.git] / src / lib / decoder_factory.cc
index dc01a043a56cf49aa1df7c0baf311be1aa6e9301..df23ef6f604cb5d476a90f90231a4f9cdeea5c76 100644 (file)
@@ -24,8 +24,8 @@
 #include "dcp_decoder.h"
 #include "image_content.h"
 #include "image_decoder.h"
-#include "text_subtitle_content.h"
-#include "text_subtitle_decoder.h"
+#include "string_text_file_content.h"
+#include "string_text_file_decoder.h"
 #include "dcp_subtitle_content.h"
 #include "dcp_subtitle_decoder.h"
 #include "video_mxf_content.h"
@@ -46,7 +46,12 @@ decoder_factory (shared_ptr<const Content> content, shared_ptr<Log> log, bool fa
 
        shared_ptr<const DCPContent> dc = dynamic_pointer_cast<const DCPContent> (content);
        if (dc) {
-               return shared_ptr<Decoder> (new DCPDecoder (dc, log, fast));
+               try {
+                       return shared_ptr<Decoder> (new DCPDecoder (dc, log, fast));
+               } catch (KDMError& e) {
+                       /* This will be found and reported to the user when the content is examined */
+                       return shared_ptr<Decoder>();
+               }
        }
 
        shared_ptr<const ImageContent> ic = dynamic_pointer_cast<const ImageContent> (content);
@@ -54,14 +59,14 @@ decoder_factory (shared_ptr<const Content> content, shared_ptr<Log> log, bool fa
                return shared_ptr<Decoder> (new ImageDecoder (ic, log));
        }
 
-       shared_ptr<const TextSubtitleContent> rc = dynamic_pointer_cast<const TextSubtitleContent> (content);
+       shared_ptr<const StringTextFileContent> rc = dynamic_pointer_cast<const StringTextFileContent> (content);
        if (rc) {
-               return shared_ptr<Decoder> (new TextSubtitleDecoder (rc));
+               return shared_ptr<Decoder> (new StringTextFileDecoder (rc, log));
        }
 
        shared_ptr<const DCPSubtitleContent> dsc = dynamic_pointer_cast<const DCPSubtitleContent> (content);
        if (dsc) {
-               return shared_ptr<Decoder> (new DCPSubtitleDecoder (dsc));
+               return shared_ptr<Decoder> (new DCPSubtitleDecoder (dsc, log));
        }
 
        shared_ptr<const VideoMXFContent> vmc = dynamic_pointer_cast<const VideoMXFContent> (content);