X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fcontent_factory.cc;h=092efd7903d7dba9219c483c57a03307d6733945;hb=2e504b33eb9f38cac629ad31b7c107fb0cf5efda;hp=e800628c161dec79fdb68dc5a4fb8645353ff930;hpb=ef4cd174472dc1c4694d4451dc60b9292c60666b;p=dcpomatic.git diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc index e800628c1..092efd790 100644 --- a/src/lib/content_factory.cc +++ b/src/lib/content_factory.cc @@ -21,24 +21,28 @@ #include "ffmpeg_content.h" #include "image_content.h" #include "sndfile_content.h" +#include "subrip_content.h" #include "util.h" using std::string; +using std::list; using boost::shared_ptr; shared_ptr -content_factory (shared_ptr film, cxml::NodePtr node) +content_factory (shared_ptr film, cxml::NodePtr node, int version, list& notes) { string const type = node->string_child ("Type"); boost::shared_ptr content; if (type == "FFmpeg") { - content.reset (new FFmpegContent (film, node)); + content.reset (new FFmpegContent (film, node, version, notes)); } else if (type == "Image") { - content.reset (new ImageContent (film, node)); + content.reset (new ImageContent (film, node, version)); } else if (type == "Sndfile") { - content.reset (new SndfileContent (film, node)); + content.reset (new SndfileContent (film, node, version)); + } else if (type == "SubRip") { + content.reset (new SubRipContent (film, node, version)); } return content; @@ -48,11 +52,16 @@ shared_ptr content_factory (shared_ptr film, boost::filesystem::path path) { shared_ptr content; + + 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 { content.reset (new FFmpegContent (film, path)); }