Fix recognition of MXF-wrapped subtitle content vs audio/video.
[dcpomatic.git] / src / lib / content_factory.cc
index de940d0252f1651a53e143bdfefffa1e9dc2ef9d..f4d9fe4e93f7734679a7e9145af58a227f8fb37b 100644 (file)
@@ -29,6 +29,7 @@
 #include "dcp_subtitle_content.h"
 #include "util.h"
 #include <libcxml/cxml.h>
+#include <dcp/smpte_subtitle_content.h>
 
 using std::string;
 using std::list;
@@ -77,7 +78,7 @@ content_factory (shared_ptr<const Film> film, boost::filesystem::path path)
 
        string ext = path.extension().string ();
        transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
-               
+
        if (valid_image_file (path)) {
                content.reset (new ImageContent (film, path));
        } else if (SndfileContent::valid_file (path)) {
@@ -86,7 +87,11 @@ content_factory (shared_ptr<const Film> film, boost::filesystem::path path)
                content.reset (new SubRipContent (film, path));
        } else if (ext == ".xml") {
                content.reset (new DCPSubtitleContent (film, path));
-       } else {
+       } else if (ext == ".mxf" && dcp::SMPTESubtitleContent::valid_mxf (path)) {
+               content.reset (new DCPSubtitleContent (film, path));
+       }
+
+       if (!content) {
                content.reset (new FFmpegContent (film, path));
        }