No-op: remove all trailing whitespace.
[dcpomatic.git] / src / lib / content_factory.cc
index 789496d08e043c7d911ce2991eff4f689b3e4e68..3c65b43129a14a23d62628a8f14a1911495b4ec8 100644 (file)
  *  @brief Methods to create content objects.
  */
 
-#include <libcxml/cxml.h>
 #include "ffmpeg_content.h"
 #include "image_content.h"
 #include "sndfile_content.h"
 #include "subrip_content.h"
+#include "dcp_content.h"
+#include "dcp_subtitle_content.h"
 #include "util.h"
+#include <libcxml/cxml.h>
+#include <dcp/smpte_subtitle_asset.h>
 
 using std::string;
 using std::list;
@@ -45,7 +48,7 @@ content_factory (shared_ptr<const Film> film, cxml::NodePtr node, int version, l
        string const type = node->string_child ("Type");
 
        boost::shared_ptr<Content> content;
-       
+
        if (type == "FFmpeg") {
                content.reset (new FFmpegContent (film, node, version, notes));
        } else if (type == "Image") {
@@ -54,6 +57,10 @@ content_factory (shared_ptr<const Film> film, cxml::NodePtr node, int version, l
                content.reset (new SndfileContent (film, node, version));
        } else if (type == "SubRip") {
                content.reset (new SubRipContent (film, node, version));
+       } else if (type == "DCP") {
+               content.reset (new DCPContent (film, node, version));
+       } else if (type == "DCPSubtitle") {
+               content.reset (new DCPSubtitleContent (film, node, version));
        }
 
        return content;
@@ -71,14 +78,20 @@ 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)) {
                content.reset (new SndfileContent (film, path));
        } else if (ext == ".srt") {
                content.reset (new SubRipContent (film, path));
-       } else {
+       } else if (ext == ".xml") {
+               content.reset (new DCPSubtitleContent (film, path));
+       } else if (ext == ".mxf" && dcp::SMPTESubtitleAsset::valid_mxf (path)) {
+               content.reset (new DCPSubtitleContent (film, path));
+       }
+
+       if (!content) {
                content.reset (new FFmpegContent (film, path));
        }